From 3da8cf4a6f14abf5da05c9d46f3362dcc43d71a4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 23 Dec 2016 08:42:35 -0500 Subject: [PATCH] No longer rely on the package being installed to retrieve the version. Instead, load the project name and version by invoking the setup script. --- docs/conf.py | 14 ++++++++++---- 1 file 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