Public Access
fix(setup): extract version from filename for mirror installs
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:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
dede38cbe8
commit
cacc7d0ddf
@@ -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(f" WARN: mirror download failed for {entry.get('name')}: {e}")
|
||||||
click.echo(" Falling back to galaxy.ansible.com")
|
click.echo(" Falling back to galaxy.ansible.com")
|
||||||
return False
|
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(
|
local_entries.append(
|
||||||
{
|
{
|
||||||
"name": entry["name"],
|
"name": entry["name"],
|
||||||
"version": entry.get("version"),
|
"version": ver_match.group(1) if ver_match else entry.get("version"),
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"source": str(dest),
|
"source": str(dest),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user