diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-23 08:42:35 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2016-12-23 08:42:35 -0500 |
commit | 3da8cf4a6f14abf5da05c9d46f3362dcc43d71a4 (patch) | |
tree | 43fdb5b03d3a61a1ef6dc92b7eb8e8a1e0da2009 | |
parent | 6245d0966d8dfb0fa2893c8a3e7d760c31d134d7 (diff) | |
download | pytest-runner-3da8cf4a6f14abf5da05c9d46f3362dcc43d71a4.tar.gz |
No longer rely on the package being installed to retrieve the version. Instead, load the project name and version by invoking the setup script.
-rw-r--r-- | docs/conf.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/docs/conf.py b/docs/conf.py index 46d614b..adc9df7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import pkg_resources +import os +import sys +import subprocess extensions = [ 'sphinx.ext.autodoc', @@ -9,11 +11,15 @@ extensions = [ ] # General information about the project. -project = 'skeleton' + +root = os.path.join(os.path.dirname(__file__), '..') +setup_script = os.path.join(root, 'setup.py') +dist_info_cmd = [sys.executable, setup_script, '--name', '--version'] +output_bytes = subprocess.check_output(dist_info_cmd, cwd=root) +project, version = output_bytes.decode('utf-8').split() + copyright = '2016 Jason R. Coombs' -# The short X.Y version. -version = pkg_resources.get_distribution(project).version # The full version, including alpha/beta/rc tags. release = version |