No longer rely on the package being installed to retrieve the version. Instead, load the project name and version by invoking the setup script.

This commit is contained in:
Jason R. Coombs 2016-12-23 08:42:35 -05:00
parent 6245d0966d
commit 3da8cf4a6f

View File

@ -1,7 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pkg_resources import os
import sys
import subprocess
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
@ -9,11 +11,15 @@ extensions = [
] ]
# General information about the project. # 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' 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. # The full version, including alpha/beta/rc tags.
release = version release = version