Skip to content

Commit

Permalink
Use certain fields from library context instead of app context that a…
Browse files Browse the repository at this point in the history
…re deprecated in the app context and are removed from antsibull-core 3.0.0. (#569)
  • Loading branch information
felixfontein authored Dec 23, 2023
1 parent 640b949 commit df909a0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/569-context.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "Use certain fields from library context instead of app context that are deprecated in the app context and are removed from antsibull-core 3.0.0 (https://github.com/ansible-community/antsibull/pull/569)."
12 changes: 7 additions & 5 deletions src/antsibull/build_ansible_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def _extract_python_requires(

def prepare_command() -> int:
app_ctx = app_context.app_ctx.get()
lib_ctx = app_context.lib_ctx.get()

build_filename = os.path.join(
app_ctx.extra["data_dir"], app_ctx.extra["build_file"]
Expand All @@ -378,8 +379,8 @@ def prepare_command() -> int:
ansible_core_release_infos, collections_to_versions = asyncio.run(
get_version_info(
list(deps),
pypi_server_url=str(app_ctx.pypi_url),
galaxy_url=str(app_ctx.galaxy_url),
pypi_server_url=str(lib_ctx.pypi_url),
galaxy_url=str(lib_ctx.galaxy_url),
)
)

Expand Down Expand Up @@ -465,6 +466,7 @@ def prepare_command() -> int:

def rebuild_single_command() -> int:
app_ctx = app_context.app_ctx.get()
lib_ctx = app_context.lib_ctx.get()

deps_filename = os.path.join(app_ctx.extra["data_dir"], app_ctx.extra["deps_file"])
deps_file = DepsFile(deps_filename)
Expand Down Expand Up @@ -492,9 +494,9 @@ def rebuild_single_command() -> int:
asyncio.run(
download_collections(
included_versions,
str(app_ctx.galaxy_url),
str(lib_ctx.galaxy_url),
download_dir,
app_ctx.collection_cache,
lib_ctx.collection_cache,
)
)

Expand All @@ -508,7 +510,7 @@ def rebuild_single_command() -> int:
app_ctx.extra["ansible_version"],
deps_dir=app_ctx.extra["data_dir"],
deps_data=[dependency_data],
collection_cache=app_ctx.collection_cache,
collection_cache=lib_ctx.collection_cache,
ansible_changelog=ansible_changelog,
)

Expand Down
3 changes: 2 additions & 1 deletion src/antsibull/build_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,12 @@ def write_porting_guide_to(self, dest_dir: str) -> None:
def build_changelog() -> int:
"""Create changelog and porting guide CLI command."""
app_ctx = app_context.app_ctx.get()
lib_ctx = app_context.lib_ctx.get()

ansible_version: PypiVer = app_ctx.extra["ansible_version"]
data_dir: str = app_ctx.extra["data_dir"]
dest_data_dir: str = app_ctx.extra["dest_data_dir"]
collection_cache: str | None = app_ctx.collection_cache
collection_cache: str | None = lib_ctx.collection_cache

changelog = get_changelog(
ansible_version, deps_dir=data_dir, collection_cache=collection_cache
Expand Down
3 changes: 2 additions & 1 deletion src/antsibull/new_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@

def new_ansible_command() -> int:
app_ctx = app_context.app_ctx.get()
lib_ctx = app_context.lib_ctx.get()
collections = parse_pieces_file(
os.path.join(app_ctx.extra["data_dir"], app_ctx.extra["pieces_file"])
)
ansible_core_release_infos, collections_to_versions = asyncio.run(
get_version_info(collections, str(app_ctx.pypi_url))
get_version_info(collections, str(lib_ctx.pypi_url))
)
ansible_core_versions = [
(PypiVer(version), data[0]["requires_python"])
Expand Down

0 comments on commit df909a0

Please sign in to comment.