fix: skip pip --editable option value in registry date updater (#368)

`-e`/`--editable` consumes a path argument in `pip install`, but was not
listed in `PIP_OPTIONS_WITH_VALUES`. As a result `_extract_pypi_package`
returned the editable path (e.g. `.` or `./local/pkg`) instead of the
real package, causing a wasted/incorrect PyPI lookup.

Add `-e` and `--editable` to the option set so the path argument is
skipped, matching how the other value-taking pip options are handled.
Add regression tests for `pip install -e ./local/pkg py4csr` and
`pip install -e .`.
This commit is contained in:
陈家名
2026-07-09 20:04:45 +08:00
committed by GitHub
parent f32fbf60bd
commit f5ae8362c0
2 changed files with 14 additions and 0 deletions
@@ -69,3 +69,15 @@ def test_extract_pypi_package_skips_index_option_values():
)
assert MODULE._extract_pypi_package(install_cmd) == "py4csr"
def test_extract_pypi_package_skips_editable_option_value():
install_cmd = "pip install -e ./local/pkg py4csr"
assert MODULE._extract_pypi_package(install_cmd) == "py4csr"
def test_extract_pypi_package_returns_none_for_editable_only_install():
install_cmd = "pip install -e ."
assert MODULE._extract_pypi_package(install_cmd) is None
+2
View File
@@ -27,6 +27,8 @@ PIP_OPTIONS_WITH_VALUES = {
"-i",
"--index-url",
"--extra-index-url",
"-e",
"--editable",
"-f",
"--find-links",
"--trusted-host",