Skip to content

Commit

Permalink
avoid using shallow wheels for non-remote file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Jun 16, 2020
1 parent 4e799cd commit 1b9dfa9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/pip/_internal/network/shallow/httpfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
from typing import Any, Optional


def url_is_remote(url):
# type: (str) -> bool
return get_url_scheme(url) in ['http', 'https']


class Url(namedtuple('Url', ['url'])):

def __new__(cls, url):
# type: (str) -> Url
scheme = get_url_scheme(url)
assert scheme in ["http", "https"]
assert url_is_remote(url)
return super(Url, cls).__new__(cls, url)


Expand Down
3 changes: 2 additions & 1 deletion src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
PreviousBuildDirError,
VcsHashUnsupported,
)
from pip._internal.network.shallow.httpfile import url_is_remote
from pip._internal.utils.filesystem import copy2_fixed
from pip._internal.utils.hashes import MissingHashes
from pip._internal.utils.logging import indent_log
Expand Down Expand Up @@ -406,7 +407,7 @@ def prepare_linked_requirement(
download_dir = self.wheel_download_dir

if link.is_wheel:
if self.use_shallow_wheels:
if self.use_shallow_wheels and url_is_remote(link.url):
return ShallowWheelDistribution(
req, self.downloader, download_dir)
if download_dir:
Expand Down
1 change: 1 addition & 0 deletions src/pip/_internal/req/req_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def perform_all_final_hydration(self):
return

exceptions = []

def do_hydrate(dist):
# type: (DistributionNeedingFinalHydration) -> None
try:
Expand Down

0 comments on commit 1b9dfa9

Please sign in to comment.