Skip to content

Commit 92311a5

Browse files
committed
Pull oauth2_provider.__version__ from pkg_resources
1 parent 9577d5b commit 92311a5

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

docs/conf.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,12 @@
5353
copyright = u'2013, Evonove'
5454

5555

56-
def get_version(package):
57-
"""
58-
Return package version as listed in `__version__` in `init.py`.
59-
"""
60-
init_py = open(os.path.join(package, '__init__.py')).read()
61-
return re.match("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
62-
63-
6456
# The version info for the project you're documenting, acts as replacement for
6557
# |version| and |release|, also used in various other places throughout the
6658
# built documents.
6759
#
6860
# The short X.Y version.
69-
version = get_version(os.path.join("..", "oauth2_provider"))
61+
version = oauth2_provider.__version__
7062
# The full version, including alpha/beta/rc tags.
7163
release = version
7264

oauth2_provider/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
__version__ = '0.12.0'
1+
import pkg_resources
22

3-
__author__ = "Massimiliano Pippi & Federico Frenguelli"
43

5-
default_app_config = 'oauth2_provider.apps.DOTConfig'
4+
__version__ = pkg_resources.require("django-oauth-toolkit")[0].version
65

7-
VERSION = __version__ # synonym
6+
default_app_config = "oauth2_provider.apps.DOTConfig"

0 commit comments

Comments
 (0)