Skip to content

Commit 9de0118

Browse files
authored
Merge pull request #4421 from pypa/bugfix/4403
Do not copy project tree
2 parents 3dd65c5 + 593a566 commit 9de0118

File tree

13 files changed

+65
-50
lines changed

13 files changed

+65
-50
lines changed

news/4403.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Do not copy the whole directory tree of local file package.

news/4421.vendor.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Update ``requirements`` to ``1.`5.13``.
2+
* Update ``pip-shims`` to ``0.5.3``.

pipenv/core.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,8 @@ def do_install_dependencies(
823823
click.echo(
824824
crayons.normal(fix_utf8("Installing dependencies from Pipfile…"), bold=True)
825825
)
826-
# skip_lock should completely bypass the lockfile (broken in 4dac1676)
827-
lockfile = project.get_or_create_lockfile(from_pipfile=True)
826+
# skip_lock should completely bypass the lockfile (broken in 4dac1676)
827+
lockfile = project.get_or_create_lockfile(from_pipfile=True)
828828
else:
829829
lockfile = project.get_or_create_lockfile()
830830
if not bare:
@@ -851,7 +851,6 @@ def do_install_dependencies(
851851
"\n".join(sorted(deps))
852852
)
853853
sys.exit(0)
854-
855854
if concurrent:
856855
nprocs = PIPENV_MAX_SUBPROCESS
857856
else:

pipenv/vendor/pip_shims/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from . import shims
2727

28-
__version__ = "0.5.2"
28+
__version__ = "0.5.3"
2929

3030

3131
if "pip_shims" in sys.modules:

pipenv/vendor/pip_shims/compat.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def shim_unpack(
720720
:type unpack_fn: Callable
721721
:param str download_dir: The directory to download the file to
722722
:param TShimmedFunc tempdir_manager_provider: A callable or shim referring to
723-
`global_tempdir_manager` function from pipenv.patched.notpip or a shimmed no-op context manager
723+
`global_tempdir_manager` function from pip or a shimmed no-op context manager
724724
:param Optional[:class:`~pip._internal.req.req_install.InstallRequirement`] ireq:
725725
an Install Requirement instance, defaults to None
726726
:param Optional[:class:`~pip._internal.models.link.Link`] link: A Link instance,
@@ -904,13 +904,9 @@ def make_preparer(
904904
if options is not None and pip_options_created:
905905
for k, v in options_map.items():
906906
suppress_setattr(options, k, v, filter_none=True)
907-
if all([session is None, install_cmd is None, session_is_required]):
908-
raise TypeError(
909-
"Preparer requires a session instance which was not supplied and cannot be "
910-
"created without an InstallCommand."
911-
)
912-
elif all([session is None, session_is_required]):
913-
session = get_session(install_cmd=install_cmd, options=options)
907+
if session_is_required:
908+
if session is None:
909+
session = get_session(install_cmd=install_cmd, options=options)
914910
preparer_args["session"] = session
915911
if finder_is_required:
916912
finder = _ensure_finder(
@@ -928,7 +924,7 @@ def make_preparer(
928924
if "req_tracker" in required_args:
929925
req_tracker = tracker_ctx if req_tracker is None else req_tracker
930926
preparer_args["req_tracker"] = req_tracker
931-
927+
preparer_args["lazy_wheel"] = True
932928
result = call_function_with_correct_args(preparer_fn, **preparer_args)
933929
yield result
934930

@@ -1318,7 +1314,11 @@ def resolve( # noqa:C901
13181314
wheel_cache_provider(kwargs["cache_dir"], format_control)
13191315
) # type: ignore
13201316
ireq.is_direct = True # type: ignore
1321-
build_location_kwargs = {"build_dir": kwargs["build_dir"], "autodelete": True}
1317+
build_location_kwargs = {
1318+
"build_dir": kwargs["build_dir"],
1319+
"autodelete": True,
1320+
"parallel_builds": False
1321+
}
13221322
call_function_with_correct_args(ireq.build_location, **build_location_kwargs)
13231323
if reqset_provider is None:
13241324
raise TypeError(

pipenv/vendor/pip_shims/models.py

+11-18
Original file line numberDiff line numberDiff line change
@@ -441,27 +441,20 @@ def _ensure_methods(self, provided):
441441
)
442442
if not methods and not classmethods:
443443
return provided
444-
new_functions = provided.__dict__.copy()
445-
if classmethods:
446-
new_functions.update(
447-
{
448-
method_name: clsmethod
449-
for method_name, clsmethod in classmethods.items()
450-
if method_name not in provided.__dict__
451-
}
452-
)
453-
if methods:
454-
new_functions.update(
455-
{
456-
method_name: method
457-
for method_name, method in methods.items()
458-
if method_name not in provided.__dict__
459-
}
460-
)
461444
classname = provided.__name__
462445
if six.PY2:
463446
classname = classname.encode(sys.getdefaultencoding())
464-
type_ = type(classname, (provided,), new_functions)
447+
type_ = type(classname, (provided,), {})
448+
449+
if classmethods:
450+
for method_name, clsmethod in classmethods.items():
451+
if method_name not in provided.__dict__:
452+
type.__setattr__(type_, method_name, clsmethod)
453+
454+
if methods:
455+
for method_name, clsmethod in methods.items():
456+
if method_name not in provided.__dict__:
457+
type.__setattr__(type_, method_name, clsmethod)
465458
return type_
466459

467460
@property

pipenv/vendor/requirementslib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .models.pipfile import Pipfile
1111
from .models.requirements import Requirement
1212

13-
__version__ = "1.5.12"
13+
__version__ = "1.5.13"
1414

1515

1616
logger = logging.getLogger(__name__)

pipenv/vendor/requirementslib/models/setup_info.py

+23-9
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,14 @@ def pep517_config(self):
15801580

15811581
def build_wheel(self):
15821582
# type: () -> S
1583+
need_delete = False
15831584
if not self.pyproject.exists():
1584-
build_requires = ", ".join(['"{0}"'.format(r) for r in self.build_requires])
1585+
if not self.build_requires:
1586+
build_requires = '"setuptools", "wheel"'
1587+
else:
1588+
build_requires = ", ".join(
1589+
['"{0}"'.format(r) for r in self.build_requires]
1590+
)
15851591
self.pyproject.write_text(
15861592
six.text_type(
15871593
"""
@@ -1593,16 +1599,21 @@ def build_wheel(self):
15931599
).strip()
15941600
)
15951601
)
1596-
return build_pep517(
1602+
need_delete = True
1603+
result = build_pep517(
15971604
self.base_dir,
15981605
self.extra_kwargs["build_dir"],
15991606
config_settings=self.pep517_config,
16001607
dist_type="wheel",
16011608
)
1609+
if need_delete:
1610+
self.pyproject.unlink()
1611+
return result
16021612

16031613
# noinspection PyPackageRequirements
16041614
def build_sdist(self):
16051615
# type: () -> S
1616+
need_delete = False
16061617
if not self.pyproject.exists():
16071618
if not self.build_requires:
16081619
build_requires = '"setuptools", "wheel"'
@@ -1621,12 +1632,16 @@ def build_sdist(self):
16211632
).strip()
16221633
)
16231634
)
1624-
return build_pep517(
1635+
need_delete = True
1636+
result = build_pep517(
16251637
self.base_dir,
16261638
self.extra_kwargs["build_dir"],
16271639
config_settings=self.pep517_config,
16281640
dist_type="sdist",
16291641
)
1642+
if need_delete:
1643+
self.pyproject.unlink()
1644+
return result
16301645

16311646
def build(self):
16321647
# type: () -> "SetupInfo"
@@ -1874,10 +1889,7 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None):
18741889
ireq.link, "is_vcs", getattr(ireq.link, "is_artifact", False)
18751890
)
18761891
is_vcs = True if vcs else is_artifact_or_vcs
1877-
if is_file and not is_vcs and path is not None and os.path.isdir(path):
1878-
target = os.path.join(kwargs["src_dir"], os.path.basename(path))
1879-
shutil.copytree(path, target, symlinks=True)
1880-
ireq.source_dir = target
1892+
18811893
if not (ireq.editable and is_file and is_vcs):
18821894
if ireq.is_wheel:
18831895
only_download = True
@@ -1895,10 +1907,12 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None):
18951907
if build_location_func is None:
18961908
build_location_func = getattr(ireq, "ensure_build_location", None)
18971909
if not ireq.source_dir:
1898-
build_kwargs = {"build_dir": kwargs["build_dir"], "autodelete": False}
1910+
build_kwargs = {
1911+
"build_dir": kwargs["build_dir"],
1912+
"autodelete": False, "parallel_builds": True
1913+
}
18991914
call_function_with_correct_args(build_location_func, **build_kwargs)
19001915
ireq.ensure_has_source_dir(kwargs["src_dir"])
1901-
src_dir = ireq.source_dir
19021916
pip_shims.shims.shim_unpack(
19031917
download_dir=download_dir,
19041918
ireq=ireq,

pipenv/vendor/requirementslib/models/vcs.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,18 @@ def get_commit_hash(self, ref=None):
112112
@classmethod
113113
def monkeypatch_pip(cls):
114114
# type: () -> Tuple[Any, ...]
115+
from pip_shims.compat import get_allowed_args
116+
115117
target_module = pip_shims.shims.VcsSupport.__module__
116118
pip_vcs = importlib.import_module(target_module)
119+
args, kwargs = get_allowed_args(pip_vcs.VersionControl.run_command)
117120
run_command_defaults = pip_vcs.VersionControl.run_command.__defaults__
118-
# set the default to not write stdout, the first option sets this value
119-
new_defaults = [False] + list(run_command_defaults)[1:]
120-
new_defaults = tuple(new_defaults)
121+
if "show_stdout" not in args and "show_stdout" not in kwargs:
122+
new_defaults = run_command_defaults
123+
else:
124+
# set the default to not write stdout, the first option sets this value
125+
new_defaults = [False] + list(run_command_defaults)[1:]
126+
new_defaults = tuple(new_defaults)
121127
if six.PY3:
122128
try:
123129
pip_vcs.VersionControl.run_command.__defaults__ = new_defaults

pipenv/vendor/requirementslib/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def strip_ssh_from_git_uri(uri):
121121

122122
def add_ssh_scheme_to_git_uri(uri):
123123
# type: (S) -> S
124-
"""Cleans VCS uris from pip format"""
124+
"""Cleans VCS uris from pipenv.patched.notpip format"""
125125
if isinstance(uri, six.string_types):
126126
# Add scheme for parsing purposes, this is also what pip does
127127
if uri.startswith("git+") and "://" not in uri:

pipenv/vendor/vendor.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ requests==2.23.0
2626
idna==2.9
2727
urllib3==1.25.9
2828
certifi==2020.4.5.1
29-
requirementslib==1.5.12
29+
requirementslib==1.5.13
3030
attrs==19.3.0
3131
distlib==0.3.0
3232
packaging==20.3
@@ -39,7 +39,7 @@ semver==2.9.0
3939
toml==0.10.1
4040
cached-property==1.5.1
4141
vistir==0.5.2
42-
pip-shims==0.5.2
42+
pip-shims==0.5.3
4343
contextlib2==0.6.0.post1
4444
funcsigs==1.0.2
4545
enum34==1.1.10

tasks/vendoring/patches/vendor/pip_shims_module_names.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ diff --git a/pipenv/vendor/pip_shims/__init__.py b/pipenv/vendor/pip_shims/__ini
22
index 2af4166e..598b9ad8 100644
33
--- a/pipenv/vendor/pip_shims/__init__.py
44
+++ b/pipenv/vendor/pip_shims/__init__.py
5-
@@ -11,10 +11,13 @@ __version__ = "0.5.1"
5+
@@ -11,10 +11,13 @@ __version__ = "0.5.3"
66
if "pip_shims" in sys.modules:
77
# mainly to keep a reference to the old module on hand so it doesn't get
88
# weakref'd away

tests/integration/test_install_uri.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_get_vcs_refs(PipenvInstance_NoPyPI):
239239
@pytest.mark.urls
240240
@pytest.mark.install
241241
@pytest.mark.needs_internet
242-
@pytest.mark.skip_py27_win
242+
@pytest.mark.py3_only
243243
@pytest.mark.skip_py38
244244
def test_vcs_entry_supersedes_non_vcs(PipenvInstance):
245245
"""See issue #2181 -- non-editable VCS dep was specified, but not showing up

0 commit comments

Comments
 (0)