Unverified Commit 689ff292 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix version wrangling in docs (#7600)

parent abc40ef2
...@@ -43,6 +43,14 @@ jobs: ...@@ -43,6 +43,14 @@ jobs:
pip install --progress-bar=off -r requirements.txt pip install --progress-bar=off -r requirements.txt
echo '::endgroup::' echo '::endgroup::'
if [[ ${{ github.event_name }} == push && (${{ github.ref_type }} == tag || (${{ github.ref_type }} == branch && ${{ github.ref_name }} == release/*)) ]]; then
echo '::group::Enable version string sanitization'
# This environment variable just has to exist and must not be empty. The actual value is arbitrary.
# See docs/source/conf.py for details
export TORCHVISION_SANITIZE_VERSION_STR_IN_DOCS=1
echo '::endgroup::'
fi
# The runner does not have sufficient memory to run with as many processes as there are # The runner does not have sufficient memory to run with as many processes as there are
# cores (`-j auto`). Thus, we limit to a single process (`-j 1`) here. # cores (`-j auto`). Thus, we limit to a single process (`-j 1`) here.
sed -i -e 's/-j auto/-j 1/' Makefile sed -i -e 's/-j auto/-j 1/' Makefile
......
...@@ -92,17 +92,15 @@ author = "Torch Contributors" ...@@ -92,17 +92,15 @@ author = "Torch Contributors"
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
# built documents. # built documents.
# # version: The short X.Y version.
# The short X.Y version. # release: The full version, including alpha/beta/rc tags.
version = "main (" + torchvision.__version__ + " )" if os.environ.get("TORCHVISION_SANITIZE_VERSION_STR_IN_DOCS", None):
# The full version, including alpha/beta/rc tags.
release = "main"
VERSION = os.environ.get("VERSION", None)
if VERSION:
# Turn 1.11.0aHASH into 1.11 (major.minor only) # Turn 1.11.0aHASH into 1.11 (major.minor only)
version = ".".join(version.split(".")[:2]) version = release = ".".join(torchvision.__version__.split(".")[:2])
html_title = " ".join((project, version, "documentation")) html_title = " ".join((project, version, "documentation"))
release = version else:
version = f"main ({torchvision.__version__})"
release = "main"
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment