File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5757 - name : Check pywebview pin is single-sourced
5858 run : |
5959 python scripts/read_desktop_pywebview_spec.py
60- python <<'PY'
61- import sys
62- from pathlib import Path
63-
64- for path in sorted(Path(".github/workflows").glob("*.yml")):
65- text = path.read_text()
66- if "pywebview>=" in text or "pywebview<" in text:
67- print(f"{path} hardcodes a pywebview version; use scripts/read_desktop_pywebview_spec.py", file=sys.stderr)
68- sys.exit(1)
69- if "read_desktop_pywebview_spec.py" not in text and "pywebview" in text.lower():
70- if path.name in ("release.yml", "tests.yml"):
71- print(f"{path} installs pywebview but does not read the pin from pyproject", file=sys.stderr)
72- sys.exit(1)
73- PY
60+ python scripts/check_pywebview_workflow_pin.py
7461
7562 - name : Install pip-tools
7663 # Pin matches update-lock.yml so lock verification uses the same resolver.
Original file line number Diff line number Diff line change 1+ """Fail if workflow YAML hardcodes a pywebview version instead of read_desktop_pywebview_spec."""
2+
3+ from __future__ import annotations
4+
5+ import sys
6+ from pathlib import Path
7+
8+ READ_SCRIPT = "read_desktop_pywebview_spec.py"
9+ PYWEBVIEW_INSTALL_WORKFLOWS = ("release.yml" , "tests.yml" )
10+
11+
12+ def main () -> None :
13+ for path in sorted (Path (".github/workflows" ).glob ("*.yml" )):
14+ text = path .read_text ()
15+ if "pywebview>=" in text or "pywebview<" in text :
16+ print (
17+ f"{ path } hardcodes a pywebview version; use scripts/{ READ_SCRIPT } " ,
18+ file = sys .stderr ,
19+ )
20+ raise SystemExit (1 )
21+ if READ_SCRIPT not in text and "pywebview" in text .lower ():
22+ if path .name in PYWEBVIEW_INSTALL_WORKFLOWS :
23+ print (
24+ f"{ path } installs pywebview but does not read the pin from pyproject" ,
25+ file = sys .stderr ,
26+ )
27+ raise SystemExit (1 )
28+
29+
30+ if __name__ == "__main__" :
31+ main ()
You can’t perform that action at this time.
0 commit comments