File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111# All configuration values have a default; values that are commented out
1212# serve to show the default.
1313
14- import sys , os
14+ import sys
15+ import os
16+ import pkg_resources
1517
1618# If extensions (or modules to document with autodoc) are in another directory,
1719# add these directories to sys.path here. If the directory is relative to the
4547# |version| and |release|, also used in various other places throughout the
4648# built documents.
4749#
50+
51+ try :
52+ release = pkg_resources .get_distribution ('webstack-flask-jwt' ).version
53+ except pkg_resources .DistributionNotFound :
54+ print ('webstack-flask-jwt must be installed to build the documentation.' )
55+ print ('Install from source using `pip install -e .` in a virtualenv.' )
56+ sys .exit (1 )
57+
4858# The short X.Y version.
49- version = '0.3.4'
50- # The full version, including alpha/beta/rc tags.
51- release = version
59+ version = '.' .join (release .split ('.' )[:2 ])
60+
5261
5362# The language for content autogenerated by Sphinx. Refer to documentation
5463# for a list of supported languages.
Original file line number Diff line number Diff line change 1515 <https://github.com/mattupstate/flask-jwt/raw/develop#egg=Flask-JWT-dev>`_
1616
1717"""
18-
18+ import ast
1919import sys
20+ import re
2021
2122from setuptools import setup , find_packages
2223from setuptools .command .test import test as TestCommand
2324
25+ _version_re = re .compile (r'__version__\s+=\s+(.*)' )
26+
27+ PROJECT = 'flask_jwt'
28+
29+ with open (PROJECT + '/__init__.py' , 'rb' ) as f :
30+ version = str (ast .literal_eval (_version_re .search (
31+ f .read ().decode ('utf-8' )).group (1 )))
2432
2533def get_requirements (suffix = '' ):
2634 with open ('requirements%s.txt' % suffix ) as f :
2735 rv = f .read ().splitlines ()
2836 return rv
2937
30-
3138def get_long_description ():
3239 with open ('README.rst' ) as f :
3340 rv = f .read ()
@@ -54,7 +61,7 @@ def run_tests(self):
5461
5562setup (
5663 name = 'webstack-flask-jwt' ,
57- version = '0.3.4' ,
64+ version = version ,
5865 url = 'https://github.com/webstack/flask-jwt' ,
5966 license = 'MIT' ,
6067 author = 'Matt Wright' ,
You can’t perform that action at this time.
0 commit comments