From 050c5bc5efa0cc3cafcf644d99cf20be40568d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=8E=AE=20=28Jade=20Lin=29?= Date: Sat, 12 Oct 2024 10:53:41 +0800 Subject: [PATCH] ci: avoid dependabot scanning raw requirements file --- .readthedocs.yaml | 2 +- scripts/export_requirements_txt.py | 4 +++- scripts/{ => requirements}/requirements-dev.txt | 0 scripts/{ => requirements}/requirements-docs.txt | 0 scripts/{ => requirements}/requirements-mini.txt | 0 scripts/{ => requirements}/requirements.txt | 0 6 files changed, 4 insertions(+), 2 deletions(-) rename scripts/{ => requirements}/requirements-dev.txt (100%) rename scripts/{ => requirements}/requirements-docs.txt (100%) rename scripts/{ => requirements}/requirements-mini.txt (100%) rename scripts/{ => requirements}/requirements.txt (100%) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index daeb189..3d083b1 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,7 +7,7 @@ build: python: install: - - requirements: ./scripts/requirements-docs.txt + - requirements: ./scripts/requirements/requirements-docs.txt - path: . sphinx: diff --git a/scripts/export_requirements_txt.py b/scripts/export_requirements_txt.py index 9ed850e..da70b48 100644 --- a/scripts/export_requirements_txt.py +++ b/scripts/export_requirements_txt.py @@ -6,7 +6,7 @@ from pathlib import Path Format = enum.Enum("Format", "requirements setuppy") -BASE_DIR = Path(__file__).parent +BASE_DIR = Path(__file__).parent / "requirements" def fix_end_of_file(text): @@ -23,6 +23,8 @@ def pdm_export(args, filename, format: Format): ['# This a dummy setup.py to enable GitHub "Used By" stats', output] ) p = Path(filename) + if not p.parent.exists(): + p.parent.mkdir(parents=True) is_new = not p.exists() if is_new or p.read_text() != output: p.write_text(output) diff --git a/scripts/requirements-dev.txt b/scripts/requirements/requirements-dev.txt similarity index 100% rename from scripts/requirements-dev.txt rename to scripts/requirements/requirements-dev.txt diff --git a/scripts/requirements-docs.txt b/scripts/requirements/requirements-docs.txt similarity index 100% rename from scripts/requirements-docs.txt rename to scripts/requirements/requirements-docs.txt diff --git a/scripts/requirements-mini.txt b/scripts/requirements/requirements-mini.txt similarity index 100% rename from scripts/requirements-mini.txt rename to scripts/requirements/requirements-mini.txt diff --git a/scripts/requirements.txt b/scripts/requirements/requirements.txt similarity index 100% rename from scripts/requirements.txt rename to scripts/requirements/requirements.txt