Finalize CCLite 0.1.8 release candidate
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SUFFIXES = {".md", ".inp", ".py", ".json"}
|
||||
SKIP_PARTS = {
|
||||
".git",
|
||||
".venv",
|
||||
"__pycache__",
|
||||
"build-codex-gcc",
|
||||
"build-codex-gcc-clean",
|
||||
"output",
|
||||
"FEMLite",
|
||||
"SPHLite",
|
||||
}
|
||||
|
||||
|
||||
def should_check(path: Path, root: Path) -> bool:
|
||||
relative = path.relative_to(root)
|
||||
if any(part in SKIP_PARTS for part in relative.parts):
|
||||
return False
|
||||
if path.suffix not in SUFFIXES:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--root", required=True)
|
||||
args = parser.parse_args()
|
||||
root = Path(args.root).resolve()
|
||||
failures: list[str] = []
|
||||
|
||||
for path in sorted(root.rglob("*")):
|
||||
if not path.is_file() or not should_check(path, root):
|
||||
continue
|
||||
data = path.read_bytes()
|
||||
if data.startswith(b"\xef\xbb\xbf"):
|
||||
failures.append(str(path.relative_to(root)))
|
||||
|
||||
if failures:
|
||||
print("UTF-8 BOM found:")
|
||||
for item in failures:
|
||||
print(f" {item}")
|
||||
return 1
|
||||
|
||||
print("UTF-8 without BOM check passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user