Merge pull request #9274 from sbidoul/pip-wheel-must-keep-clone-sbi

This commit is contained in:
Pradyun Gedam 2021-01-17 15:30:57 +00:00 committed by GitHub
commit 3af9093a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 7 deletions

3
news/9273.bugfix.rst Normal file
View File

@ -0,0 +1,3 @@
Fix a regression that made ``pip wheel`` do a VCS export instead of a VCS clone
for editable requirements. This broke VCS requirements that need the VCS
information to build correctly.

2
news/9337.bugfix.rst Normal file
View File

@ -0,0 +1,2 @@
Fix ``pip download`` of editable VCS requirements that need VCS information
to build correctly.

2
news/9338.removal.rst Normal file
View File

@ -0,0 +1,2 @@
Remove the VCS export feature that was used only with editable VCS
requirements and had correctness issues.

View File

@ -547,7 +547,7 @@ class RequirementPreparer:
'hash.'.format(req)
)
req.ensure_has_source_dir(self.src_dir)
req.update_editable(self.download_dir is None)
req.update_editable()
dist = _get_prepared_distribution(
req, self.req_tracker, self.finder, self.build_isolation,

View File

@ -611,8 +611,8 @@ class InstallRequirement:
)
# For editable installations
def update_editable(self, obtain=True):
# type: (bool) -> None
def update_editable(self):
# type: () -> None
if not self.link:
logger.debug(
"Cannot update repository at %s; repository location is "
@ -645,10 +645,7 @@ class InstallRequirement:
)
deprecated(reason, replacement, gone_in="21.0", issue=7554)
hidden_url = hide_url(self.link.url)
if obtain:
vcs_backend.obtain(self.source_dir, url=hidden_url)
else:
vcs_backend.export(self.source_dir, url=hidden_url)
vcs_backend.obtain(self.source_dir, url=hidden_url)
else:
assert 0, (
'Unexpected version control type (in {}): {}'.format(

View File

@ -169,6 +169,25 @@ def test_pip_wheel_builds_editable(script, data):
result.did_create(wheel_file_path)
@pytest.mark.network
def test_pip_wheel_git_editable_keeps_clone(script, tmpdir):
"""
Test that `pip wheel -e giturl` preserves a git clone in src.
"""
script.pip(
'wheel',
'--no-deps',
'-e',
'git+https://github.com/pypa/pip-test-package#egg=pip-test-package',
'--src',
tmpdir / 'src',
'--wheel-dir',
tmpdir,
)
assert (tmpdir / 'src' / 'pip-test-package').exists()
assert (tmpdir / 'src' / 'pip-test-package' / '.git').exists()
def test_pip_wheel_builds_editable_does_not_create_zip(script, data, tmpdir):
"""
Test 'pip wheel' of editables does not create zip files