Skip to content

Commit

Permalink
Install matplotlib for opengraph preview images (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner authored Jan 20, 2025
1 parent 4e7299d commit 2efa5bc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ def build(self):
blurb = self.venv / "bin" / "blurb"

if self.includes_html:
# Define a tag to enable opengraph socialcards previews
# (used in Doc/conf.py and requires matplotlib)
sphinxopts.append("-t create-social-cards")

# Disable CPython switchers, we handle them now:
run(
["sed", "-i"]
Expand Down Expand Up @@ -783,13 +787,17 @@ def build_venv(self):
So we can reuse them from builds to builds, while they contain
different Sphinx versions.
"""
requirements = [self.theme] + self.version.requirements
if self.includes_html:
# opengraph previews
requirements.append("matplotlib>=3")

venv_path = self.build_root / ("venv-" + self.version.name)
run([sys.executable, "-m", "venv", venv_path])
run(
[venv_path / "bin" / "python", "-m", "pip", "install", "--upgrade"]
+ ["--upgrade-strategy=eager"]
+ [self.theme]
+ self.version.requirements,
+ requirements,
cwd=self.checkout / "Doc",
)
run([venv_path / "bin" / "python", "-m", "pip", "freeze", "--all"])
Expand Down

0 comments on commit 2efa5bc

Please sign in to comment.