|
|
a2934d |
diff -up pip-19.3.1/news/7872.bugfix.pip7873 pip-19.3.1/news/7872.bugfix
|
|
|
a2934d |
--- pip-19.3.1/news/7872.bugfix.pip7873 2022-05-24 08:34:03.285054864 -0600
|
|
|
a2934d |
+++ pip-19.3.1/news/7872.bugfix 2022-05-24 08:34:03.285054864 -0600
|
|
|
a2934d |
@@ -0,0 +1 @@
|
|
|
a2934d |
+Prevent an infinite recursion with ``pip wheel`` when ``$TMPDIR`` is within the source directory.
|
|
|
a2934d |
diff -up pip-19.3.1/src/pip/_internal/download.py.pip7873 pip-19.3.1/src/pip/_internal/download.py
|
|
|
a2934d |
--- pip-19.3.1/src/pip/_internal/download.py.pip7873 2019-10-17 13:32:34.000000000 -0600
|
|
|
a2934d |
+++ pip-19.3.1/src/pip/_internal/download.py 2022-05-24 08:35:17.013833331 -0600
|
|
|
a2934d |
@@ -350,12 +350,24 @@ def _copy2_ignoring_special_files(src, d
|
|
|
a2934d |
|
|
|
a2934d |
def _copy_source_tree(source, target):
|
|
|
a2934d |
# type: (str, str) -> None
|
|
|
a2934d |
+ target_abspath = os.path.abspath(target)
|
|
|
a2934d |
+ target_basename = os.path.basename(target_abspath)
|
|
|
a2934d |
+ target_dirname = os.path.dirname(target_abspath)
|
|
|
a2934d |
+
|
|
|
a2934d |
def ignore(d, names):
|
|
|
a2934d |
- # Pulling in those directories can potentially be very slow,
|
|
|
a2934d |
- # exclude the following directories if they appear in the top
|
|
|
a2934d |
- # level dir (and only it).
|
|
|
a2934d |
- # See discussion at https://github.com/pypa/pip/pull/6770
|
|
|
a2934d |
- return ['.tox', '.nox'] if d == source else []
|
|
|
a2934d |
+ skipped = [] # type: List[str]
|
|
|
a2934d |
+ if d == source:
|
|
|
a2934d |
+ # Pulling in those directories can potentially be very slow,
|
|
|
a2934d |
+ # exclude the following directories if they appear in the top
|
|
|
a2934d |
+ # level dir (and only it).
|
|
|
a2934d |
+ # See discussion at https://github.com/pypa/pip/pull/6770
|
|
|
a2934d |
+ skipped += ['.tox', '.nox']
|
|
|
a2934d |
+ if os.path.abspath(d) == target_dirname:
|
|
|
a2934d |
+ # Prevent an infinite recursion if the target is in source.
|
|
|
a2934d |
+ # This can happen when TMPDIR is set to ${PWD}/...
|
|
|
a2934d |
+ # and we copy PWD to TMPDIR.
|
|
|
a2934d |
+ skipped += [target_basename]
|
|
|
a2934d |
+ return skipped
|
|
|
a2934d |
|
|
|
a2934d |
kwargs = dict(ignore=ignore, symlinks=True) # type: CopytreeKwargs
|
|
|
a2934d |
|
|
|
a2934d |
diff -up pip-19.3.1/src/pip/_internal/operations/prepare.py.pip7873 pip-19.3.1/src/pip/_internal/operations/prepare.py
|
|
|
a2934d |
diff -up pip-19.3.1/tests/data/src/extension/extension.c.pip7873 pip-19.3.1/tests/data/src/extension/extension.c
|
|
|
a2934d |
diff -up pip-19.3.1/tests/data/src/extension/setup.py.pip7873 pip-19.3.1/tests/data/src/extension/setup.py
|
|
|
a2934d |
--- pip-19.3.1/tests/data/src/extension/setup.py.pip7873 2022-05-24 08:34:03.285054864 -0600
|
|
|
a2934d |
+++ pip-19.3.1/tests/data/src/extension/setup.py 2022-05-24 08:34:03.285054864 -0600
|
|
|
a2934d |
@@ -0,0 +1,4 @@
|
|
|
a2934d |
+from setuptools import Extension, setup
|
|
|
a2934d |
+
|
|
|
a2934d |
+module = Extension('extension', sources=['extension.c'])
|
|
|
a2934d |
+setup(name='extension', version='0.0.1', ext_modules = [module])
|
|
|
a2934d |
diff -up pip-19.3.1/tests/functional/test_wheel.py.pip7873 pip-19.3.1/tests/functional/test_wheel.py
|
|
|
a2934d |
--- pip-19.3.1/tests/functional/test_wheel.py.pip7873 2019-10-17 13:32:34.000000000 -0600
|
|
|
a2934d |
+++ pip-19.3.1/tests/functional/test_wheel.py 2022-05-24 08:34:03.285054864 -0600
|
|
|
a2934d |
@@ -1,6 +1,7 @@
|
|
|
a2934d |
"""'pip wheel' tests"""
|
|
|
a2934d |
import os
|
|
|
a2934d |
import re
|
|
|
a2934d |
+import sys
|
|
|
a2934d |
from os.path import exists
|
|
|
a2934d |
|
|
|
a2934d |
import pytest
|
|
|
a2934d |
@@ -228,6 +229,24 @@ def test_pip_wheel_with_user_set_in_conf
|
|
|
a2934d |
assert "Successfully built withpyproject" in result.stdout, result.stdout
|
|
|
a2934d |
|
|
|
a2934d |
|
|
|
a2934d |
+@pytest.mark.skipif(sys.platform.startswith('win'),
|
|
|
a2934d |
+ reason='The empty extension module does not work on Win')
|
|
|
a2934d |
+def test_pip_wheel_ext_module_with_tmpdir_inside(script, data, common_wheels):
|
|
|
a2934d |
+ tmpdir = data.src / 'extension/tmp'
|
|
|
a2934d |
+ tmpdir.mkdir()
|
|
|
a2934d |
+ script.environ['TMPDIR'] = str(tmpdir)
|
|
|
a2934d |
+
|
|
|
a2934d |
+ # To avoid a test dependency on a C compiler, we set the env vars to "noop"
|
|
|
a2934d |
+ # The .c source is empty anyway
|
|
|
a2934d |
+ script.environ['CC'] = script.environ['LDSHARED'] = str('true')
|
|
|
a2934d |
+
|
|
|
a2934d |
+ result = script.pip(
|
|
|
a2934d |
+ 'wheel', data.src / 'extension',
|
|
|
a2934d |
+ '--no-index', '-f', common_wheels
|
|
|
a2934d |
+ )
|
|
|
a2934d |
+ assert "Successfully built extension" in result.stdout, result.stdout
|
|
|
a2934d |
+
|
|
|
a2934d |
+
|
|
|
a2934d |
@pytest.mark.network
|
|
|
a2934d |
def test_pep517_wheels_are_not_confused_with_other_files(script, tmpdir, data):
|
|
|
a2934d |
"""Check correct wheels are copied. (#6196)
|