diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e190953..1e8056e 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -75,7 +75,7 @@ jobs: - run: | mk python-release owner=vkottler \ - repo=yambs version=2.4.0 + repo=yambs version=2.4.1 if: | matrix.python-version == '3.11' && matrix.system == 'ubuntu-latest' diff --git a/README.md b/README.md index ffa1c7e..9726e6d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ===================================== generator=datazen version=3.1.3 - hash=56e5498dfc3e0d2dbd23a5dfbfe11761 + hash=2c699e065c46c9a82b34dd32519fb24e ===================================== --> -# yambs ([2.4.0](https://pypi.org/project/yambs/)) +# yambs ([2.4.1](https://pypi.org/project/yambs/)) [![python](https://img.shields.io/pypi/pyversions/yambs.svg)](https://pypi.org/project/yambs/) ![Build Status](https://github.com/vkottler/yambs/workflows/Python%20Package/badge.svg) diff --git a/config b/config index fe54bd7..26b96da 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit fe54bd7904feb629013ede54268ec7823f05535c +Subproject commit 26b96dae9397a89768a5c83dd387e92a8bae2c95 diff --git a/local/variables/package.yaml b/local/variables/package.yaml index 5c10cdb..3565943 100644 --- a/local/variables/package.yaml +++ b/local/variables/package.yaml @@ -1,5 +1,5 @@ --- major: 2 minor: 4 -patch: 0 +patch: 1 entry: mbs diff --git a/pyproject.toml b/pyproject.toml index 6d9c6b9..5c5c8b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__" [project] name = "yambs" -version = "2.4.0" +version = "2.4.1" description = "Yet another meta build-system." readme = "README.md" requires-python = ">=3.11" @@ -36,6 +36,8 @@ test = [ "yamllint", "yambs", "vmklib", + "sphinx", + "sphinx-book-theme", "setuptools-wrapper", "types-setuptools", "types-requests" diff --git a/tests/commands/test_native.py b/tests/commands/test_native.py index b22103a..273dad1 100644 --- a/tests/commands/test_native.py +++ b/tests/commands/test_native.py @@ -31,6 +31,5 @@ def test_native_command_basic(): assert yambs_main([PKG_NAME, "native"]) == 0 # Try to build (if we can). - # Re-enable this when we fix the third party script. if platform == "linux" and which("ninja"): - run(["ninja", "all"], check=True) + run(["ninja", "all", "format-check"], check=True) diff --git a/yambs/__init__.py b/yambs/__init__.py index cd76271..0a9911b 100644 --- a/yambs/__init__.py +++ b/yambs/__init__.py @@ -1,7 +1,7 @@ # ===================================== # generator=datazen # version=3.1.3 -# hash=97870f506d5d2f9b5b8e3527f76efa07 +# hash=24e206542fae6896b37aff43eec1c8ec # ===================================== """ @@ -10,4 +10,4 @@ DESCRIPTION = "Yet another meta build-system." PKG_NAME = "yambs" -VERSION = "2.4.0" +VERSION = "2.4.1" diff --git a/yambs/dependency/handlers/yambs/github.py b/yambs/dependency/handlers/yambs/github.py index 9498742..e57fa3b 100644 --- a/yambs/dependency/handlers/yambs/github.py +++ b/yambs/dependency/handlers/yambs/github.py @@ -50,16 +50,17 @@ def audit_downloads( dest = root.joinpath(name) - if dest.is_file(): - continue - for suffix in to_download: if name.endswith(suffix): - # Download the file. - req = requests.get(asset["browser_download_url"], timeout=10) - with dest.open("wb") as dest_fd: - for chunk in req.iter_content(chunk_size=4096): - dest_fd.write(chunk) + # Download if necessary. + if not dest.is_file(): + # Download the file. + req = requests.get( + asset["browser_download_url"], timeout=10 + ) + with dest.open("wb") as dest_fd: + for chunk in req.iter_content(chunk_size=4096): + dest_fd.write(chunk) data["assets"][suffix] = str(dest) break @@ -73,6 +74,7 @@ def audit_extract(root: Path, data: DependencyData) -> Path: if "directory" not in data: # The expected directory is just the name of the tarball with no # suffix. + assert TARBALL in data["assets"], data["assets"] expected = Path(data["assets"][TARBALL].replace(TARBALL, "")) # The name of the project is the directory name without the version diff --git a/yambs/dev_requirements.txt b/yambs/dev_requirements.txt index 76370d8..5eaecd0 100644 --- a/yambs/dev_requirements.txt +++ b/yambs/dev_requirements.txt @@ -7,6 +7,8 @@ isort yamllint yambs vmklib +sphinx +sphinx-book-theme setuptools-wrapper types-setuptools types-requests diff --git a/yambs/generate/ninja/format.py b/yambs/generate/ninja/format.py index 324b4c1..02abccc 100644 --- a/yambs/generate/ninja/format.py +++ b/yambs/generate/ninja/format.py @@ -42,7 +42,7 @@ def write_format_target( # Just checks formatting. stream.write("rule clang-format-check" + linesep) - stream.write(" command = {cmd} -n --Werror $in" + linesep) + stream.write(f" command = {cmd} -n --Werror $in" + linesep) paths = list(paths) if paths: diff --git a/yambs/github/__init__.py b/yambs/github/__init__.py index 18bc262..34316ca 100644 --- a/yambs/github/__init__.py +++ b/yambs/github/__init__.py @@ -14,6 +14,12 @@ # internal from yambs.schemas import YambsDictCodec as _YambsDictCodec +GIHTUB_HEADERS = { + "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28", +} +ReleaseData = Dict[str, Any] + class Github(_YambsDictCodec, _BasicDictCodec): """GitHub repository information.""" @@ -50,12 +56,6 @@ def latest_repo_release_api_url(owner: str, repo: str) -> str: ).geturl() -GIHTUB_HEADERS = { - "Accept": "application/vnd.github+json", - "X-GitHub-Api-Version": "2022-11-28", -} - - def check_api_token() -> None: """Check for a GitHub API token set via the environment.""" @@ -66,9 +66,6 @@ def check_api_token() -> None: ] = f"Bearer {os.environ['GITHUB_API_TOKEN']}" -ReleaseData = Dict[str, Any] - - def latest_release_data( owner: str, repo: str, *args, timeout: float = None, **kwargs ) -> ReleaseData: @@ -76,10 +73,27 @@ def latest_release_data( check_api_token() - return requests.get( # type: ignore - latest_repo_release_api_url(owner, repo), - *args, - timeout=timeout, - headers=GIHTUB_HEADERS, - **kwargs, - ).json() + result: ReleaseData = {} + + # codecov was bugging out. + tries = kwargs.get("tries", 5) + + while not validate_release(result) and tries: + result = requests.get( + latest_repo_release_api_url(owner, repo), + *args, + timeout=timeout, + headers=GIHTUB_HEADERS, + **kwargs, + ).json() + tries -= 1 + + assert validate_release(result), result + + return result + + +def validate_release(data: ReleaseData) -> bool: + """Ensure that GitHub release data actually contains data.""" + + return all(x in data for x in ["name", "html_url", "assets"])