Skip to content

Commit 016a965

Browse files
zsimicZoran Simic
andauthored
Correctly handle install package[extras] (#50)
* Correctly handle `install package[extras]` * Corrected test assert to apply to both uv and pip * Fewer tests with pip --------- Co-authored-by: Zoran Simic <zsimic@netflix.com>
1 parent fbcbd89 commit 016a965

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/pickley/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ def resolve(self, settings: "TrackedSettings"):
222222
pip_spec = self.given_package_spec
223223
canonical_name, version = CFG.despecced(self.given_package_spec)
224224
if version:
225-
pip_spec = f"{canonical_name}=={version}"
226225
self.resolution_reason = "pinned"
227226
if canonical_name == bstrap.PICKLEY:
228227
self._set_canonical(canonical_name, version)
@@ -276,7 +275,9 @@ def resolve(self, settings: "TrackedSettings"):
276275
line = lines[0]
277276
canonical_name, version = CFG.despecced(line)
278277
if version:
279-
self.pip_spec = [f"{canonical_name}=={version}"]
278+
if canonical_name == self.given_package_spec:
279+
self.pip_spec = [f"{canonical_name}=={version}"]
280+
280281
if not self.resolution_reason:
281282
self.resolution_reason = "package spec"
282283

tests/test_ops.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ def test_install_pypi(cli):
177177
assert cli.failed
178178
assert "mgit was not installed with pickley" in cli.logged
179179

180+
if bstrap.USE_UV:
181+
cli.run("-nv install yq[test]")
182+
assert cli.succeeded
183+
assert "Would run: uv -q pip install yq[test]" in cli.logged
184+
180185
# Simulate a few older versions to exercise grooming
181186
runez.touch(".pk/mgit-/bin/mgit", logger=None) # Simulate a buggy old installation
182187
runez.touch(".pk/mgit-0.9rc5+local/bin/mgit", logger=None)

0 commit comments

Comments
 (0)