mirror of https://github.com/pypa/pip
Support forward slash on windows (#4563)
Support forward slash on windows
This commit is contained in:
parent
21be153044
commit
29bab5adbd
|
@ -0,0 +1 @@
|
|||
Local Packages can now be referenced using forward slashes on Windows.
|
|
@ -194,9 +194,12 @@ class InstallRequirement(object):
|
|||
link = Link(name)
|
||||
else:
|
||||
p, extras = _strip_extras(path)
|
||||
if (os.path.isdir(p) and
|
||||
(os.path.sep in name or name.startswith('.'))):
|
||||
|
||||
looks_like_dir = os.path.isdir(p) and (
|
||||
os.path.sep in name or
|
||||
(os.path.altsep is not None and os.path.altsep in name) or
|
||||
name.startswith('.')
|
||||
)
|
||||
if looks_like_dir:
|
||||
if not is_installable_dir(p):
|
||||
raise InstallationError(
|
||||
"Directory %r is not installable. File 'setup.py' "
|
||||
|
|
|
@ -26,3 +26,18 @@ class TestInstallRequirementBuildDirectory(object):
|
|||
assert os.path.dirname(tmp_build_dir) == os.path.dirname(tmp_dir)
|
||||
os.rmdir(tmp_dir)
|
||||
assert not os.path.exists(tmp_dir)
|
||||
|
||||
def test_forward_slash_results_in_a_link(self, tmpdir):
|
||||
install_dir = tmpdir / "foo" / "bar"
|
||||
|
||||
# Just create a file for letting the logic work
|
||||
setup_py_path = install_dir / "setup.py"
|
||||
os.makedirs(str(install_dir))
|
||||
with open(setup_py_path, 'w') as f:
|
||||
f.write('')
|
||||
|
||||
requirement = InstallRequirement.from_line(
|
||||
str(install_dir).replace(os.sep, os.altsep or os.sep)
|
||||
)
|
||||
|
||||
assert requirement.link is not None
|
||||
|
|
Loading…
Reference in New Issue