Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: exclude files that would cause problems for prebuild or jekyll #4810

Merged
merged 6 commits into from
Jan 17, 2025
Merged
Changes from 1 commit
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
21 changes: 21 additions & 0 deletions website/prebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,36 @@ def label_root_file(
add_frontmatter(f, f.read_text(), [title], top_nav_order, has_children)


def unlink_dir(path: Path) -> None:
# TODO: Use path.walk once we require Python 3.12.
for root, dirs, files in os.walk(path, topdown=False):
root_path = Path(root)
for name in files:
(root_path / name).unlink()
for name in dirs:
(root_path / name).rmdir()
jonmeow marked this conversation as resolved.
Show resolved Hide resolved


def main() -> None:
# Ensure this runs from the repo root.
os.chdir(Path(__file__).parents[1])

# bazel-generated symlinks interfere with jekyll because they may contain
# broken symlinks.
Path("bazel-out").unlink(missing_ok=True)
Path("bazel-bin").unlink(missing_ok=True)
Path("bazel-genfiles").unlink(missing_ok=True)
# bazel-execroot interferes with jekyll because it's a broken symlink.
Path("bazel-execroot").unlink()
# This is a symlink to website/favicon.png, which is moved below.
# TODO: Consider moving the icon to a location which won't break.
Path("utils/vscode/images/icon.png").unlink()
# This may contain a README.md file that jekyll can't parse and that
# shouldn't appear in the navigation tree.
unlink_dir(Path("utils/vscode/node_modules"))
zygoloid marked this conversation as resolved.
Show resolved Hide resolved
# This can cause a failure if jekyll has already been run prior to
# prebuild.
unlink_dir(Path("website/.jekyll-cache"))

# The external symlink is created by scripts/create_compdb.py, and can
# interfere with local execution.
Expand Down
Loading