Skip to content

Commit

Permalink
Use setuptools_scm in Sphinx config instead of calling setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sbraz committed Apr 11, 2021
1 parent 02ea859 commit 01b4b3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import subprocess
import sys

import setuptools_scm

try:
from importlib import metadata
except ImportError:
Expand Down Expand Up @@ -71,10 +73,8 @@
if os.environ.get("READTHEDOCS") == "True":
version = metadata.version("pymediainfo")
else:
# The project root is the parent directory
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Get the version from setup.py --version (inspired by jaraco.packaging)
version = subprocess.check_output([sys.executable, "setup.py", "--version"], cwd=root, universal_newlines=True).strip()
# fallback_root must be specified for this to work with PyPI tarballs
version = setuptools_scm.get_version(root="..", fallback_root="..", relative_to=__file__)
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ commands =
pytest -n auto {posargs}

[testenv:docs]
deps = sphinx
deps =
setuptools_scm
sphinx
commands = sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" --color -W {posargs}

[testenv:black]
Expand Down

0 comments on commit 01b4b3f

Please sign in to comment.