mirror of
https://github.com/pallets-eco/flask-debugtoolbar.git
synced 2026-05-04 07:19:08 -05:00
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:
+6
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user