From e55fcea956749e3943f2fd97a634726e53e13686 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 23 Jan 2019 08:01:29 +0530 Subject: [PATCH 1/3] Add tests for the bug --- tests/functional/test_install_wheel.py | 8 ++++++++ tests/functional/test_pep517.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/functional/test_install_wheel.py b/tests/functional/test_install_wheel.py index 9937d5a0af3..e09fdce850a 100644 --- a/tests/functional/test_install_wheel.py +++ b/tests/functional/test_install_wheel.py @@ -420,3 +420,11 @@ def test_wheel_compile_syntax_error(script, data): result = script.pip('install', '--compile', package, '--no-index') assert 'yield from' not in result.stdout assert 'SyntaxError: ' not in result.stdout + + +def test_wheel_install_with_no_cache_dir(script, tmpdir, data): + """Check wheel installations work, even with no cache. + """ + package = data.packages.join("simple.dist-0.1-py2.py3-none-any.whl") + result = script.pip('install', '--no-cache-dir', '--no-index', package) + result.assert_installed('simpledist', editable=False) diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py index 52e3acded90..a1a45d27bb9 100644 --- a/tests/functional/test_pep517.py +++ b/tests/functional/test_pep517.py @@ -109,3 +109,17 @@ def test_pep517_backend_requirements_already_satisfied(script, tmpdir, data): project_dir, ) assert 'Installing backend dependencies:' not in result.stdout + + +def test_pep517_install_with_no_cache_dir(script, tmpdir, data): + """Check builds with a custom backends work, even with no cache. + """ + project_dir = make_project( + tmpdir, requires=['test_backend'], + backend="test_backend" + ) + result = script.pip( + 'install', '--no-cache-dir', '--no-index', '-f', data.backends, + project_dir, + ) + result.assert_installed('project', editable=False) From 7db266687cb6304b0708eb408c8f15efb78eedeb Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 23 Jan 2019 08:07:23 +0530 Subject: [PATCH 2/3] Check wheel build locations only when ephem cache isn't used When the ephemeral cache is used, the build can always occur. There is no need to check for those. --- src/pip/_internal/wheel.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py index 93b4768622a..3f200b77edc 100644 --- a/src/pip/_internal/wheel.py +++ b/src/pip/_internal/wheel.py @@ -840,12 +840,6 @@ def build( newly built wheel, in preparation for installation. :return: True if all the wheels built correctly. """ - # TODO: This check fails if --no-cache-dir is set. And yet we - # might be able to build into the ephemeral cache, surely? - building_is_possible = self._wheel_dir or ( - autobuilding and self.wheel_cache.cache_dir - ) - assert building_is_possible buildset = [] format_control = self.finder.format_control @@ -884,6 +878,13 @@ def build( if not buildset: return [] + # Is any wheel build not using the ephemeral cache? + if any(not ephem_cache for _, ephem_cache in buildset): + have_directory_for_build = self._wheel_dir or ( + autobuilding and self.wheel_cache.cache_dir + ) + assert have_directory_for_build + # TODO by @pradyunsg # Should break up this method into 2 separate methods. From a1cd49abeb88f295bb3376ac39516c5ff2adae41 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Wed, 23 Jan 2019 09:56:43 +0530 Subject: [PATCH 3/3] :newspaper: --- news/6158.bugfix | 1 + news/6171.bugfix | 1 + 2 files changed, 2 insertions(+) create mode 100644 news/6158.bugfix create mode 100644 news/6171.bugfix diff --git a/news/6158.bugfix b/news/6158.bugfix new file mode 100644 index 00000000000..fe5a0352f9b --- /dev/null +++ b/news/6158.bugfix @@ -0,0 +1 @@ +Fix a crash when using --no-cache-dir with PEP 517 distributions diff --git a/news/6171.bugfix b/news/6171.bugfix new file mode 100644 index 00000000000..fe5a0352f9b --- /dev/null +++ b/news/6171.bugfix @@ -0,0 +1 @@ +Fix a crash when using --no-cache-dir with PEP 517 distributions