Skip to content

Commit

Permalink
docs: improve changelog integration for latest builds again
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Oct 17, 2022
1 parent 75a3854 commit 0e77758
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
5 changes: 4 additions & 1 deletion docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
Changelog
=========

.. ifconfig:: include_changelog_staging
.. ifconfig:: build_type == 'latest'

.. warning::
This is a documentation build for an unreleased version of pypdfium2, so it is possible that new changes are not logged yet.

Next
----
Expand Down
28 changes: 20 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

# Configuration file for the Sphinx documentation builder.
# See https://www.sphinx-doc.org/en/master/usage/configuration.html
# and https://docs.readthedocs.io/en/stable/environment-variables.html

import os
import sys
import time
from os.path import (
Expand All @@ -14,17 +16,27 @@

sys.path.insert(0, join(dirname(dirname(dirname(abspath(__file__)))), "setupsrc"))
from pl_setup.packaging_base import (
get_changelog_staging,
run_cmd,
SourceTree,
)

def _have_changelog():
log = get_changelog_staging()
if log:
return True

def _get_build_type():

# RTD uses git checkout --force origin/... which results in a detached HEAD state, so we cannot easily get the branch name
# Thus query for an RTD-specific environment variable instead
rtd_version_name = os.environ.get("READTHEDOCS_VERSION_NAME", None)
if rtd_version_name:
return rtd_version_name

branch = run_cmd(["git", "branch", "--show-current"], cwd=SourceTree, capture=True)
if branch == "stable":
return "stable"
else:
return False
return "latest"


include_changelog_staging = _have_changelog()
build_type = _get_build_type()

project = "pypdfium2"
author = "pypdfium2-team"
Expand Down Expand Up @@ -68,4 +80,4 @@ def _have_changelog():


def setup(app):
app.add_config_value("include_changelog_staging", False, "env")
app.add_config_value("build_type", "latest", "env")

0 comments on commit 0e77758

Please sign in to comment.