summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Bidoul (ACSONE) <stephane.bidoul@acsone.eu>2016-05-26 12:41:01 +0200
committerDonald Stufft <donald@stufft.io>2016-05-26 06:41:01 -0400
commit4d1b7984653c4365c101c86b1436703332d79f41 (patch)
treef0006f8483fabf0e69965806c3aaa50ff8ea5424
parentb15c7f6b6a0ed13e524f1c48bd1693970302eba1 (diff)
downloadpip-4d1b7984653c4365c101c86b1436703332d79f41.tar.gz
Allow creating wheels for editable packages (#3695)
-rw-r--r--CHANGES.txt4
-rw-r--r--pip/commands/wheel.py2
-rw-r--r--pip/wheel.py7
-rw-r--r--tests/functional/test_wheel.py15
-rw-r--r--tests/unit/test_wheel.py10
5 files changed, 23 insertions, 15 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 508bdacf5..7190a9ca5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -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)**
diff --git a/pip/commands/wheel.py b/pip/commands/wheel.py
index 2796ec4be..53f85e31b 100644
--- a/pip/commands/wheel.py
+++ b/pip/commands/wheel.py
@@ -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))
diff --git a/pip/wheel.py b/pip/wheel.py
index b257d7665..01fbc9c1d 100644
--- a/pip/wheel.py
+++ b/pip/wheel.py
@@ -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:
diff --git a/tests/functional/test_wheel.py b/tests/functional/test_wheel.py
index b90604238..ac08d4280 100644
--- a/tests/functional/test_wheel.py
+++ b/tests/functional/test_wheel.py
@@ -75,6 +75,21 @@ def test_pip_wheel_builds_editable_deps(script, data):
@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):
"""
Test 'pip wheel' failure.
diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py
index b6dc1f607..0e030e5bb 100644
--- a/tests/unit/test_wheel.py
+++ b/tests/unit/test_wheel.py
@@ -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: