diff --git a/lockfile/src/parsers/pypi.rs b/lockfile/src/parsers/pypi.rs index 8eb996a05..e2330f816 100644 --- a/lockfile/src/parsers/pypi.rs +++ b/lockfile/src/parsers/pypi.rs @@ -57,7 +57,9 @@ fn line<'a>(input: &'a str, registry: &mut Option<&'a str>) -> IResult<&'a str, // // Since `ThirdPartyVersion` only allows a single registry, we only record the // primary one. - if let Some(index_url) = line.strip_prefix("--index-url") { + if let Some(index_url) = + line.strip_prefix("--index-url ").or_else(|| line.strip_prefix("-i ")) + { *registry = Some(index_url.trim()); line = ""; } diff --git a/lockfile/src/python.rs b/lockfile/src/python.rs index f383c3b87..ea55da30f 100644 --- a/lockfile/src/python.rs +++ b/lockfile/src/python.rs @@ -304,7 +304,7 @@ mod tests { Package { name: "other-registry".into(), version: PackageVersion::ThirdParty(ThirdPartyVersion { - registry: "https://mirror1.phylum.io/simple/".into(), + registry: "https://mirror2.phylum.io/simple/".into(), version: "1.2.3".into(), }), package_type: PackageType::PyPi, diff --git a/tests/fixtures/requirements-locked.txt b/tests/fixtures/requirements-locked.txt index c59235206..c1515d4ee 100644 --- a/tests/fixtures/requirements-locked.txt +++ b/tests/fixtures/requirements-locked.txt @@ -34,5 +34,6 @@ tomli @ https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a25 -e /tmp/editable ; python_version >= "3.7" and python_version < "3.12" --index-url https://mirror1.phylum.io/simple/ ---extra-index-url https://mirror2.phylum.io/simple/ +-i https://mirror2.phylum.io/simple/ +--extra-index-url https://mirror3.phylum.io/simple/ other-registry==1.2.3