Skip to content

Commit 866cad5

Browse files
committed
Use Python to update the makefile
1 parent c341248 commit 866cad5

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

build_docs.py

+6-21
Original file line numberDiff line numberDiff line change
@@ -687,27 +687,12 @@ def build(self):
687687
f"-D ogp_site_url={site_url}",
688688
)
689689

690-
def is_gnu_sed() -> bool:
691-
"""Check if we are using GNU sed."""
692-
try:
693-
subprocess.run(
694-
["sed", "--version"],
695-
stdout=subprocess.DEVNULL,
696-
stderr=subprocess.DEVNULL,
697-
check=True,
698-
)
699-
return True
700-
except subprocess.CalledProcessError:
701-
return False
702-
except FileNotFoundError:
703-
return False
704-
705-
# Disable CPython switchers, we handle them now:
706-
run(
707-
["sed", "-i"]
708-
+ ([] if is_gnu_sed() else [""])
709-
+ ["s/ *-A switchers=1//", self.checkout / "Doc" / "Makefile"]
710-
)
690+
if self.version.as_tuple() < (3, 8):
691+
# Disable CPython switchers, we handle them now:
692+
text = (self.checkout / "Doc" / "Makefile").read_text(encoding="utf-8")
693+
text = text.replace(" -A switchers=1", "")
694+
(self.checkout / "Doc" / "Makefile").write_text(text, encoding="utf-8")
695+
711696
self.versions.setup_indexsidebar(
712697
self.version,
713698
self.checkout / "Doc" / "tools" / "templates" / "indexsidebar.html",

0 commit comments

Comments
 (0)