mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-29 07:30:51 +08:00
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:
@@ -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
|
||||
|
||||
@@ -27,6 +27,8 @@ PIP_OPTIONS_WITH_VALUES = {
|
||||
"-i",
|
||||
"--index-url",
|
||||
"--extra-index-url",
|
||||
"-e",
|
||||
"--editable",
|
||||
"-f",
|
||||
"--find-links",
|
||||
"--trusted-host",
|
||||
|
||||
Reference in New Issue
Block a user