Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a5d2ca

Browse files
authored
Test for GNU sed instead of macOS (#263)
1 parent 82e2a41 commit 4a5d2ca

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

build_docs.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,25 @@ 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+
690705
# Disable CPython switchers, we handle them now:
691706
run(
692707
["sed", "-i"]
693-
+ ([""] if sys.platform == "darwin" else [])
708+
+ ([] if is_gnu_sed() else [""])
694709
+ ["s/ *-A switchers=1//", self.checkout / "Doc" / "Makefile"]
695710
)
696711
self.versions.setup_indexsidebar(

0 commit comments

Comments
 (0)