Skip to content

Commit 3af9093

Browse files
authored
Merge pull request #9274 from sbidoul/pip-wheel-must-keep-clone-sbi
2 parents 7b7469b + 9361faa commit 3af9093

File tree

6 files changed

+30
-7
lines changed

6 files changed

+30
-7
lines changed

news/9273.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a regression that made ``pip wheel`` do a VCS export instead of a VCS clone
2+
for editable requirements. This broke VCS requirements that need the VCS
3+
information to build correctly.

news/9337.bugfix.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``pip download`` of editable VCS requirements that need VCS information
2+
to build correctly.

news/9338.removal.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the VCS export feature that was used only with editable VCS
2+
requirements and had correctness issues.

src/pip/_internal/operations/prepare.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def prepare_editable_requirement(
547547
'hash.'.format(req)
548548
)
549549
req.ensure_has_source_dir(self.src_dir)
550-
req.update_editable(self.download_dir is None)
550+
req.update_editable()
551551

552552
dist = _get_prepared_distribution(
553553
req, self.req_tracker, self.finder, self.build_isolation,

src/pip/_internal/req/req_install.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@ def ensure_has_source_dir(
611611
)
612612

613613
# For editable installations
614-
def update_editable(self, obtain=True):
615-
# type: (bool) -> None
614+
def update_editable(self):
615+
# type: () -> None
616616
if not self.link:
617617
logger.debug(
618618
"Cannot update repository at %s; repository location is "
@@ -645,10 +645,7 @@ def update_editable(self, obtain=True):
645645
)
646646
deprecated(reason, replacement, gone_in="21.0", issue=7554)
647647
hidden_url = hide_url(self.link.url)
648-
if obtain:
649-
vcs_backend.obtain(self.source_dir, url=hidden_url)
650-
else:
651-
vcs_backend.export(self.source_dir, url=hidden_url)
648+
vcs_backend.obtain(self.source_dir, url=hidden_url)
652649
else:
653650
assert 0, (
654651
'Unexpected version control type (in {}): {}'.format(

tests/functional/test_wheel.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,25 @@ def test_pip_wheel_builds_editable(script, data):
169169
result.did_create(wheel_file_path)
170170

171171

172+
@pytest.mark.network
173+
def test_pip_wheel_git_editable_keeps_clone(script, tmpdir):
174+
"""
175+
Test that `pip wheel -e giturl` preserves a git clone in src.
176+
"""
177+
script.pip(
178+
'wheel',
179+
'--no-deps',
180+
'-e',
181+
'git+https://github.com/pypa/pip-test-package#egg=pip-test-package',
182+
'--src',
183+
tmpdir / 'src',
184+
'--wheel-dir',
185+
tmpdir,
186+
)
187+
assert (tmpdir / 'src' / 'pip-test-package').exists()
188+
assert (tmpdir / 'src' / 'pip-test-package' / '.git').exists()
189+
190+
172191
def test_pip_wheel_builds_editable_does_not_create_zip(script, data, tmpdir):
173192
"""
174193
Test 'pip wheel' of editables does not create zip files

0 commit comments

Comments
 (0)