Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not copy project tree #4421

Merged
merged 4 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/4403.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not copy the whole directory tree of local file package.
2 changes: 2 additions & 0 deletions news/4421.vendor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Update ``requirements`` to ``1.`5.13``.
* Update ``pip-shims`` to ``0.5.3``.
5 changes: 2 additions & 3 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ def do_install_dependencies(
click.echo(
crayons.normal(fix_utf8("Installing dependencies from Pipfile…"), bold=True)
)
# skip_lock should completely bypass the lockfile (broken in 4dac1676)
lockfile = project.get_or_create_lockfile(from_pipfile=True)
# skip_lock should completely bypass the lockfile (broken in 4dac1676)
lockfile = project.get_or_create_lockfile(from_pipfile=True)
else:
lockfile = project.get_or_create_lockfile()
if not bare:
Expand All @@ -851,7 +851,6 @@ def do_install_dependencies(
"\n".join(sorted(deps))
)
sys.exit(0)

if concurrent:
nprocs = PIPENV_MAX_SUBPROCESS
else:
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/pip_shims/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from . import shims

__version__ = "0.5.2"
__version__ = "0.5.3"


if "pip_shims" in sys.modules:
Expand Down
20 changes: 10 additions & 10 deletions pipenv/vendor/pip_shims/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def shim_unpack(
:type unpack_fn: Callable
:param str download_dir: The directory to download the file to
:param TShimmedFunc tempdir_manager_provider: A callable or shim referring to
`global_tempdir_manager` function from pipenv.patched.notpip or a shimmed no-op context manager
`global_tempdir_manager` function from pip or a shimmed no-op context manager
:param Optional[:class:`~pip._internal.req.req_install.InstallRequirement`] ireq:
an Install Requirement instance, defaults to None
:param Optional[:class:`~pip._internal.models.link.Link`] link: A Link instance,
Expand Down Expand Up @@ -904,13 +904,9 @@ def make_preparer(
if options is not None and pip_options_created:
for k, v in options_map.items():
suppress_setattr(options, k, v, filter_none=True)
if all([session is None, install_cmd is None, session_is_required]):
raise TypeError(
"Preparer requires a session instance which was not supplied and cannot be "
"created without an InstallCommand."
)
elif all([session is None, session_is_required]):
session = get_session(install_cmd=install_cmd, options=options)
if session_is_required:
if session is None:
session = get_session(install_cmd=install_cmd, options=options)
preparer_args["session"] = session
if finder_is_required:
finder = _ensure_finder(
Expand All @@ -928,7 +924,7 @@ def make_preparer(
if "req_tracker" in required_args:
req_tracker = tracker_ctx if req_tracker is None else req_tracker
preparer_args["req_tracker"] = req_tracker

preparer_args["lazy_wheel"] = True
result = call_function_with_correct_args(preparer_fn, **preparer_args)
yield result

Expand Down Expand Up @@ -1318,7 +1314,11 @@ def resolve( # noqa:C901
wheel_cache_provider(kwargs["cache_dir"], format_control)
) # type: ignore
ireq.is_direct = True # type: ignore
build_location_kwargs = {"build_dir": kwargs["build_dir"], "autodelete": True}
build_location_kwargs = {
"build_dir": kwargs["build_dir"],
"autodelete": True,
"parallel_builds": False
}
call_function_with_correct_args(ireq.build_location, **build_location_kwargs)
if reqset_provider is None:
raise TypeError(
Expand Down
29 changes: 11 additions & 18 deletions pipenv/vendor/pip_shims/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,27 +441,20 @@ def _ensure_methods(self, provided):
)
if not methods and not classmethods:
return provided
new_functions = provided.__dict__.copy()
if classmethods:
new_functions.update(
{
method_name: clsmethod
for method_name, clsmethod in classmethods.items()
if method_name not in provided.__dict__
}
)
if methods:
new_functions.update(
{
method_name: method
for method_name, method in methods.items()
if method_name not in provided.__dict__
}
)
classname = provided.__name__
if six.PY2:
classname = classname.encode(sys.getdefaultencoding())
type_ = type(classname, (provided,), new_functions)
type_ = type(classname, (provided,), {})

if classmethods:
for method_name, clsmethod in classmethods.items():
if method_name not in provided.__dict__:
type.__setattr__(type_, method_name, clsmethod)

if methods:
for method_name, clsmethod in methods.items():
if method_name not in provided.__dict__:
type.__setattr__(type_, method_name, clsmethod)
return type_

@property
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .models.pipfile import Pipfile
from .models.requirements import Requirement

__version__ = "1.5.12"
__version__ = "1.5.13"


logger = logging.getLogger(__name__)
Expand Down
32 changes: 23 additions & 9 deletions pipenv/vendor/requirementslib/models/setup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,8 +1580,14 @@ def pep517_config(self):

def build_wheel(self):
# type: () -> S
need_delete = False
if not self.pyproject.exists():
build_requires = ", ".join(['"{0}"'.format(r) for r in self.build_requires])
if not self.build_requires:
build_requires = '"setuptools", "wheel"'
else:
build_requires = ", ".join(
['"{0}"'.format(r) for r in self.build_requires]
)
self.pyproject.write_text(
six.text_type(
"""
Expand All @@ -1593,16 +1599,21 @@ def build_wheel(self):
).strip()
)
)
return build_pep517(
need_delete = True
result = build_pep517(
self.base_dir,
self.extra_kwargs["build_dir"],
config_settings=self.pep517_config,
dist_type="wheel",
)
if need_delete:
self.pyproject.unlink()
return result

# noinspection PyPackageRequirements
def build_sdist(self):
# type: () -> S
need_delete = False
if not self.pyproject.exists():
if not self.build_requires:
build_requires = '"setuptools", "wheel"'
Expand All @@ -1621,12 +1632,16 @@ def build_sdist(self):
).strip()
)
)
return build_pep517(
need_delete = True
result = build_pep517(
self.base_dir,
self.extra_kwargs["build_dir"],
config_settings=self.pep517_config,
dist_type="sdist",
)
if need_delete:
self.pyproject.unlink()
return result

def build(self):
# type: () -> "SetupInfo"
Expand Down Expand Up @@ -1874,10 +1889,7 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None):
ireq.link, "is_vcs", getattr(ireq.link, "is_artifact", False)
)
is_vcs = True if vcs else is_artifact_or_vcs
if is_file and not is_vcs and path is not None and os.path.isdir(path):
target = os.path.join(kwargs["src_dir"], os.path.basename(path))
shutil.copytree(path, target, symlinks=True)
ireq.source_dir = target

if not (ireq.editable and is_file and is_vcs):
if ireq.is_wheel:
only_download = True
Expand All @@ -1895,10 +1907,12 @@ def from_ireq(cls, ireq, subdir=None, finder=None, session=None):
if build_location_func is None:
build_location_func = getattr(ireq, "ensure_build_location", None)
if not ireq.source_dir:
build_kwargs = {"build_dir": kwargs["build_dir"], "autodelete": False}
build_kwargs = {
"build_dir": kwargs["build_dir"],
"autodelete": False, "parallel_builds": True
}
call_function_with_correct_args(build_location_func, **build_kwargs)
ireq.ensure_has_source_dir(kwargs["src_dir"])
src_dir = ireq.source_dir
pip_shims.shims.shim_unpack(
download_dir=download_dir,
ireq=ireq,
Expand Down
12 changes: 9 additions & 3 deletions pipenv/vendor/requirementslib/models/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,18 @@ def get_commit_hash(self, ref=None):
@classmethod
def monkeypatch_pip(cls):
# type: () -> Tuple[Any, ...]
from pip_shims.compat import get_allowed_args

target_module = pip_shims.shims.VcsSupport.__module__
pip_vcs = importlib.import_module(target_module)
args, kwargs = get_allowed_args(pip_vcs.VersionControl.run_command)
run_command_defaults = pip_vcs.VersionControl.run_command.__defaults__
# set the default to not write stdout, the first option sets this value
new_defaults = [False] + list(run_command_defaults)[1:]
new_defaults = tuple(new_defaults)
if "show_stdout" not in args and "show_stdout" not in kwargs:
new_defaults = run_command_defaults
else:
# set the default to not write stdout, the first option sets this value
new_defaults = [False] + list(run_command_defaults)[1:]
new_defaults = tuple(new_defaults)
if six.PY3:
try:
pip_vcs.VersionControl.run_command.__defaults__ = new_defaults
Expand Down
2 changes: 1 addition & 1 deletion pipenv/vendor/requirementslib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def strip_ssh_from_git_uri(uri):

def add_ssh_scheme_to_git_uri(uri):
# type: (S) -> S
"""Cleans VCS uris from pip format"""
"""Cleans VCS uris from pipenv.patched.notpip format"""
if isinstance(uri, six.string_types):
# Add scheme for parsing purposes, this is also what pip does
if uri.startswith("git+") and "://" not in uri:
Expand Down
4 changes: 2 additions & 2 deletions pipenv/vendor/vendor.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ requests==2.23.0
idna==2.9
urllib3==1.25.9
certifi==2020.4.5.1
requirementslib==1.5.12
requirementslib==1.5.13
attrs==19.3.0
distlib==0.3.0
packaging==20.3
Expand All @@ -39,7 +39,7 @@ semver==2.9.0
toml==0.10.1
cached-property==1.5.1
vistir==0.5.2
pip-shims==0.5.2
pip-shims==0.5.3
contextlib2==0.6.0.post1
funcsigs==1.0.2
enum34==1.1.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ diff --git a/pipenv/vendor/pip_shims/__init__.py b/pipenv/vendor/pip_shims/__ini
index 2af4166e..598b9ad8 100644
--- a/pipenv/vendor/pip_shims/__init__.py
+++ b/pipenv/vendor/pip_shims/__init__.py
@@ -11,10 +11,13 @@ __version__ = "0.5.1"
@@ -11,10 +11,13 @@ __version__ = "0.5.3"
if "pip_shims" in sys.modules:
# mainly to keep a reference to the old module on hand so it doesn't get
# weakref'd away
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_install_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def test_get_vcs_refs(PipenvInstance_NoPyPI):
@pytest.mark.urls
@pytest.mark.install
@pytest.mark.needs_internet
@pytest.mark.skip_py27_win
@pytest.mark.py3_only
@pytest.mark.skip_py38
def test_vcs_entry_supersedes_non_vcs(PipenvInstance):
"""See issue #2181 -- non-editable VCS dep was specified, but not showing up
Expand Down