1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Allow creating wheels for editable packages (#3695)

This commit is contained in:
Stéphane Bidoul (ACSONE) 2016-05-26 12:41:01 +02:00 committed by Donald Stufft
parent b15c7f6b6a
commit 4d1b798465
5 changed files with 23 additions and 15 deletions

View file

@ -8,6 +8,10 @@
* Fix regression in pip freeze: when there is more than one git remote,
priority is given to the remote named origin (:issue:`3616`)
* Pip wheel now works on editable packages too (it was only working on
editable dependencies before); this allows running pip wheel on the result
of pip freeze in presence of editable requirements (:issue:`3291`)
**8.1.2 (2016-05-10)**

View file

@ -157,6 +157,8 @@ class WheelCommand(RequirementCommand):
if options.build_dir:
options.build_dir = os.path.abspath(options.build_dir)
options.src_dir = os.path.abspath(options.src_dir)
with self._build_session(options) as session:
finder = self._build_package_finder(options, session)
build_delete = (not (options.no_clean or options.build_dir))

View file

@ -759,11 +759,8 @@ class WheelBuilder(object):
if not autobuilding:
logger.info(
'Skipping %s, due to already being wheel.', req.name)
elif req.editable:
if not autobuilding:
logger.info(
'Skipping bdist_wheel for %s, due to being editable',
req.name)
elif autobuilding and req.editable:
pass
elif autobuilding and req.link and not req.link.is_artifact:
pass
elif autobuilding and not req.source_dir:

View file

@ -74,6 +74,21 @@ def test_pip_wheel_builds_editable_deps(script, data):
assert wheel_file_path in result.files_created, result.stdout
@pytest.mark.network
def test_pip_wheel_builds_editable(script, data):
"""
Test 'pip wheel' builds an editable package
"""
script.pip('install', 'wheel')
editable_path = os.path.join(data.src, 'simplewheel-1.0')
result = script.pip(
'wheel', '--no-index', '-e', editable_path
)
wheel_file_name = 'simplewheel-1.0-py%s-none-any.whl' % pyversion[0]
wheel_file_path = script.scratch / wheel_file_name
assert wheel_file_path in result.files_created, result.stdout
@pytest.mark.network
def test_pip_wheel_fail(script, data):
"""

View file

@ -380,16 +380,6 @@ class TestWheelBuilder(object):
assert "due to already being wheel" in caplog.text()
assert mock_build_one.mock_calls == []
def test_skip_building_editables(self, caplog):
with patch('pip.wheel.WheelBuilder._build_one') as mock_build_one:
editable = Mock(editable=True, is_wheel=False, constraint=False)
reqset = Mock(requirements=Mock(values=lambda: [editable]),
wheel_download_dir='/wheel/dir')
wb = wheel.WheelBuilder(reqset, Mock())
wb.build()
assert "due to being editable" in caplog.text()
assert mock_build_one.mock_calls == []
class TestWheelCache: