Skip to content

Commit

Permalink
update package-files test_data for build-ansible.sh change
Browse files Browse the repository at this point in the history
  • Loading branch information
gotmax23 committed Nov 22, 2023
1 parent 36f1b7c commit c8d0501
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_data/package-files/7.5.0/build-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MAJOR="7"
# For idempotency, remove build data or built output first
rm -rf ansible-build-data built

pip3 install --user --upgrade antsibull
pip3 install --user --upgrade "antsibull==0.59.1"
git clone https://github.com/ansible-community/ansible-build-data.git
mkdir -p built collection-cache
BUILD_DATA_DIR="ansible-build-data/${MAJOR}"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/package-files/8.1.0/build-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MAJOR="8"
# For idempotency, remove build data or built output first
rm -rf ansible-build-data built

pip3 install --user --upgrade antsibull
pip3 install --user --upgrade "antsibull==0.59.1"
git clone https://github.com/ansible-community/ansible-build-data.git
mkdir -p built collection-cache
BUILD_DATA_DIR="ansible-build-data/${MAJOR}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MAJOR="8"
# For idempotency, remove build data or built output first
rm -rf ansible-build-data built

pip3 install --user --upgrade antsibull
pip3 install --user --upgrade "antsibull==0.59.1"
git clone https://github.com/ansible-community/ansible-build-data.git
mkdir -p built collection-cache
BUILD_DATA_DIR="ansible-build-data/${MAJOR}"
Expand Down
18 changes: 17 additions & 1 deletion tests/verify_package_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import aiohttp
from packaging.version import Version as PypiVer

import antsibull.build_ansible_commands
from antsibull.cli import antsibull_build
from antsibull.constants import MINIMUM_ANSIBLE_VERSIONS

Expand All @@ -38,6 +39,7 @@
SDIST_PATH = f"{PYPI_PATH}/source/a/ansible/ansible-{{version}}.tar.gz"

ANTSIBULL_BUILD = os.environ.get("ANTSIBULL_BUILD", "antsibull-build")
PLACEHOLDER_ANTSIBULL_VERSION = "0.59.1"


@dataclasses.dataclass
Expand Down Expand Up @@ -154,7 +156,11 @@ def generate_package_files(
if force_generate_setup_cfg
else contextlib.nullcontext()
)
with cm, cm2:
with cm, cm2, patch_object(
antsibull.build_ansible_commands,
"antsibull_version",
PLACEHOLDER_ANTSIBULL_VERSION,
):
if r := antsibull_build.run(
[
"antsibull-build",
Expand Down Expand Up @@ -189,6 +195,16 @@ def patch_dict(mapping: MutableMapping, key: Any, value: Any) -> Iterator[None]:
mapping[key] = old


@contextlib.contextmanager
def patch_object(object: Any, attr: str, new_value: Any) -> Iterator[None]:
old_value = getattr(object, attr)
try:
setattr(object, attr, new_value)
yield
finally:
setattr(object, attr, old_value)


def write_file_list(
version: str, source_dir: Path, build_dir: Path | None = None
) -> DIST_TUPLE:
Expand Down

0 comments on commit c8d0501

Please sign in to comment.