diff --git a/scripts/component_hash_update/pyproject.toml b/scripts/component_hash_update/pyproject.toml index 97894e485ac8a53d44d764228095fe495dd9758c..ddf27831a7f3b0db5b70b26c60ab9cb7c5c94e42 100644 --- a/scripts/component_hash_update/pyproject.toml +++ b/scripts/component_hash_update/pyproject.toml @@ -1,5 +1,7 @@ [build-system] -requires = ["setuptools >= 61.0"] +requires = ["setuptools >= 61.0", + "setuptools_scm >= 8.0", +] build-backend = "setuptools.build_meta" [project] diff --git a/scripts/component_hash_update/src/component_hash_update/__init__.py b/scripts/component_hash_update/src/component_hash_update/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/scripts/component_hash_update/src/component_hash_update/download.py b/scripts/component_hash_update/src/component_hash_update/download.py index aa64d5982236114cd294a5ec6051ef212e297c99..0b54800ed9a6a624407daff236e7e0e23102e3ee 100644 --- a/scripts/component_hash_update/src/component_hash_update/download.py +++ b/scripts/component_hash_update/src/component_hash_update/download.py @@ -17,6 +17,7 @@ import hashlib from datetime import datetime from ruamel.yaml import YAML from packaging.version import Version, InvalidVersion +from importlib.resources import files from typing import Optional @@ -204,13 +205,13 @@ def download_hash(only_downloads: [str]) -> None: 'repoWithReleases': [r['graphql_id'] for r in releases.values()], 'repoWithTags': [t['graphql_id'] for t in tags.values()], } - with open("list_releases.graphql") as query: - response = s.post("https://api.github.com/graphql", - json={'query': query.read(), 'variables': ql_params}, - headers={ - "Authorization": f"Bearer {os.environ['API_KEY']}", - } - ) + response = s.post("https://api.github.com/graphql", + json={'query': files(__package__).joinpath('list_releases.graphql').read_text(), + 'variables': ql_params}, + headers={ + "Authorization": f"Bearer {os.environ['API_KEY']}", + } + ) if 'x-ratelimit-used' in response.headers._store: logger.info("Github graphQL API ratelimit status: used %s of %s. Next reset at %s", response.headers['X-RateLimit-Used'], diff --git a/scripts/list_releases.graphql b/scripts/component_hash_update/src/component_hash_update/list_releases.graphql similarity index 100% rename from scripts/list_releases.graphql rename to scripts/component_hash_update/src/component_hash_update/list_releases.graphql