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

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,25 @@ def build(self):
f"-D ogp_site_url={site_url}",
)

def is_gnu_sed() -> bool:
"""Check if we are using GNU sed."""
try:
subprocess.run(
["sed", "--version"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=True,
)
return True
except subprocess.CalledProcessError:
return False
except FileNotFoundError:
return False
Comment on lines +660 to +673
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a module-level function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be! This is the only place its used, so I think it's okay here, but happy to move if you like.


# Disable CPython switchers, we handle them now:
run(
["sed", "-i"]
+ ([""] if sys.platform == "darwin" else [])
+ ([] if is_gnu_sed() else [""])
+ ["s/ *-A switchers=1//", self.checkout / "Doc" / "Makefile"]
)
self.versions.setup_indexsidebar(
Expand Down