fix(setup): extract version from filename for mirror installs
CI / validate (pull_request) Failing after 47s
CI / auto-merge (pull_request) Skipped

Type: url entries in requirements.yml don't have a version field —
the version is embedded in the tarball filename. Extract it with a
regex so ansible-galaxy can install the correct version from the
local file.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
emil
2026-08-08 23:38:07 +02:00
co-authored by Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent dede38cbe8
commit cacc7d0ddf
+5 -1
View File
@@ -138,10 +138,14 @@ def _try_gitea_mirror_install(galaxy: str, requirements: Path) -> bool:
click.echo(f" WARN: mirror download failed for {entry.get('name')}: {e}")
click.echo(" Falling back to galaxy.ansible.com")
return False
# Extract version from filename (e.g. ansible-posix-2.2.2.tar.gz)
import re
ver_match = re.search(r"(\d+\.\d+\.\d+)", filename)
local_entries.append(
{
"name": entry["name"],
"version": entry.get("version"),
"version": ver_match.group(1) if ver_match else entry.get("version"),
"type": "file",
"source": str(dest),
}