summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2016-11-03 08:29:58 -0400
committerGitHub <noreply@github.com>2016-11-03 08:29:58 -0400
commit20cae694dd2841e15ec0a0d92765e43b7fad0036 (patch)
treed8cee97b55a3009fb9bcc9906bf8f3b5a15b0e55
parent382a7e111be499195c1b3321ff6d649c34605992 (diff)
downloadpip-revert-3724-norm-path.tar.gz
Revert "Normalize file URLs"revert-3724-norm-path
-rw-r--r--pip/index.py10
-rw-r--r--pip/req/req_install.py6
-rw-r--r--tests/data/src/singlemodule/subdir/.placeholder0
-rw-r--r--tests/functional/test_install_reqs.py23
4 files changed, 4 insertions, 35 deletions
diff --git a/pip/index.py b/pip/index.py
index 5487f9c7d..f653f6e6a 100644
--- a/pip/index.py
+++ b/pip/index.py
@@ -1036,16 +1036,6 @@ class Link(object):
return True
- def normalize(self):
- parsed = urllib_parse.urlsplit(self.url)
- if parsed.scheme == 'file':
- path = urllib_request.url2pathname(parsed.path)
- path = normalize_path(path)
- path = urllib_request.pathname2url(path)
- self.url = urllib_parse.urlunsplit(
- (parsed.scheme, parsed.netloc,
- path, parsed.query, parsed.fragment))
-
FormatControl = namedtuple('FormatControl', 'no_binary only_binary')
"""This object has two fields, no_binary and only_binary.
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
index 7c6bb332a..1a98f377b 100644
--- a/pip/req/req_install.py
+++ b/pip/req/req_install.py
@@ -212,8 +212,10 @@ class InstallRequirement(object):
# it's a local file, dir, or url
if link:
- # Normalize URLs
- link.normalize()
+ # Handle relative file URLs
+ if link.scheme == 'file' and re.search(r'\.\./', link.url):
+ link = Link(
+ path_to_url(os.path.normpath(os.path.abspath(link.path))))
# wheel file
if link.is_wheel:
wheel = Wheel(link.filename) # can raise InvalidWheelFilename
diff --git a/tests/data/src/singlemodule/subdir/.placeholder b/tests/data/src/singlemodule/subdir/.placeholder
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/data/src/singlemodule/subdir/.placeholder
+++ /dev/null
diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py
index 53f47a34a..c78a21786 100644
--- a/tests/functional/test_install_reqs.py
+++ b/tests/functional/test_install_reqs.py
@@ -337,29 +337,6 @@ def test_constrained_to_url_install_same_url(script, data):
assert 'Running setup.py install for singlemodule' in result.stdout
-def test_constraints_constrain_to_local_dotdot(script, data):
- to_install = data.src.join("singlemodule/subdir/..")
- script.scratch_path.join("constraints.txt").write(
- "file://%s#egg=singlemodule" % to_install
- )
- result = script.pip(
- 'install', '--no-index', '-f', data.find_links, '-c',
- script.scratch_path / 'constraints.txt', to_install)
- assert 'Running setup.py install for singlemodule' in result.stdout
-
-
-def test_constraints_constrain_to_local_extraslash(script, data):
- to_install = data.src.join("singlemodule")
- to_install = '//'.join(to_install.rsplit('/', 1))
- script.scratch_path.join("constraints.txt").write(
- "file://%s#egg=singlemodule" % to_install
- )
- result = script.pip(
- 'install', '--no-index', '-f', data.find_links, '-c',
- script.scratch_path / 'constraints.txt', to_install)
- assert 'Running setup.py install for singlemodule' in result.stdout
-
-
@pytest.mark.network
def test_double_install_spurious_hash_mismatch(script, tmpdir):
"""Make sure installing the same hashed sdist twice doesn't throw hash