Skip to content

Commit

Permalink
Add setuptools_scm to make application version available in Django, R…
Browse files Browse the repository at this point in the history
…efs #322
  • Loading branch information
rstorey committed Oct 4, 2018
1 parent 3d6aaee commit 26c34b2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.rst
include README.md
include MANIFEST.in
recursive-include concordia *
recursive-include tests *.py
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ django-storages = "*"
markdown = ">=3.0.1"
"django-bootstrap4" = "*"
django-robots = "*"
setuptools-scm = "*"

[dev-packages]
invoke = "*"
Expand Down
10 changes: 9 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions concordia/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from setuptools_scm import get_version


def system_configuration(request):
Expand All @@ -10,6 +11,7 @@ def system_configuration(request):
"SENTRY_PUBLIC_DSN": getattr(settings, "SENTRY_PUBLIC_DSN", None),
"CONCORDIA_ENVIRONMENT": settings.CONCORDIA_ENVIRONMENT,
"S3_BUCKET_NAME": getattr(settings, "S3_BUCKET_NAME", None),
"APPLICATION_VERSION": get_version(),
}


Expand Down
4 changes: 4 additions & 0 deletions concordia/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ <h3>{% trans 'My actions' %}</h3>
</ul>
{% endif %}
</div>
<div class="module" id="version-module">
<h2>Application Version</h2>
<h3>{{ APPLICATION_VERSION }}
</div>
</div>
{% endblock sidebar%}
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import find_packages, setup

VERSION = __import__("concordia").get_version()
INSTALL_REQUIREMENTS = ["<2.1,>=2.0.9"]
INSTALL_REQUIREMENTS = ["boto3", "Django<2.1,>=2.0.9"]
SCRIPTS = ["manage.py"]
DESCRIPTION = "Transcription crowdsourcing"
CLASSIFIERS = """\
Expand All @@ -12,7 +12,7 @@
Programming Language :: Python :: 3.6
""".splitlines()

with open("README.rst", "r") as f:
with open("README.md", "r") as f:
LONG_DESCRIPTION = f.read()


Expand All @@ -26,4 +26,9 @@
scripts=SCRIPTS,
install_requires=INSTALL_REQUIREMENTS,
classifiers=CLASSIFIERS,
use_scm_version={
"write_to": "version.txt",
"tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$",
},
setup_requires=["setuptools_scm"],
)

0 comments on commit 26c34b2

Please sign in to comment.