Cleanup version handling slightly (#149)

Some improvements I saw over on
https://github.com/FactoryBoy/factory_boy/pull/676/files that looked
useful here as well.
This commit is contained in:
Jeff Widman
2020-03-09 13:10:02 -07:00
committed by GitHub
parent 70abd78e55
commit 3929742d9c
2 changed files with 16 additions and 10 deletions
+6 -10
View File
@@ -17,6 +17,8 @@ import pkg_resources
import sys
import time
import flask_debugtoolbar
BUILD_DATE = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
@@ -56,16 +58,10 @@ copyright = u'2012-{0}'.format(BUILD_DATE.year)
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
try:
release = pkg_resources.get_distribution('Flask-DebugToolbar').version
except pkg_resources.DistributionNotFound:
print('Flask-DebugToolbar must be installed to build the documentation.')
print('Install from source using `pip install -e .` in a virtualenv.')
sys.exit(1)
if 'dev' in release:
release = ''.join(release.partition('dev')[:2])
#
# The full version, including alpha/beta/rc tags.
release = flask_debugtoolbar.__version__
# The short X.Y version.
version = '.'.join(release.split('.')[:2])
# The language for content autogenerated by Sphinx. Refer to documentation