Fix path reformatting for posix python path

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2019-02-22 12:12:45 -05:00
parent 7f7550764b
commit 3f3e61ecf1
3 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ class Environment(object):
@property
def python(self):
"""Path to the environment python"""
py = vistir.compat.Path(self.base_paths["scripts"]).joinpath("python").as_posix()
py = vistir.compat.Path(self.base_paths["scripts"]).joinpath("python").absolute().as_posix()
if not py:
return vistir.compat.Path(sys.executable).as_posix()
return py
+5 -4
View File
@@ -17,10 +17,10 @@ import vistir
from first import first
import pipfile
import pipfile.api
from .vendor import pipfile
from .vendor.pipfile import api as pipfile_api
from cached_property import cached_property
from .vendor.cached_property import cached_property
from .cmdparse import Script
from .environment import Environment
@@ -117,7 +117,8 @@ else:
u"name": u"pypi",
}
pipfile.api.DEFAULT_SOURCE = DEFAULT_SOURCE
pipfile_api.DEFAULT_SOURCE = DEFAULT_SOURCE
pipfile.api = pipfile_api
class SourceNotFound(KeyError):
+8 -5
View File
@@ -26,8 +26,8 @@ from six.moves.urllib.parse import urlparse
from vistir.compat import ResourceWarning, lru_cache
from vistir.misc import fs_str
import crayons
import parse
from .vendor import crayons
from .vendor import parse
from . import environments
from .exceptions import PipenvUsageError
@@ -281,7 +281,7 @@ class Resolver(object):
@staticmethod
@lru_cache()
def _get_pip_command():
from pip_shims.shims import Command
from .vendor.pip_shims.shims import Command
class PipCommand(Command):
"""Needed for pip-tools."""
@@ -1373,7 +1373,7 @@ def temp_path():
def load_path(python):
from ._compat import Path
import delegator
from .vendor import delegator
import json
python = Path(python).as_posix()
json_dump_commmand = '"import json, sys; print(json.dumps(sys.path));"'
@@ -1487,7 +1487,7 @@ def handle_remove_readonly(func, path, exc):
warnings.warn(default_warning_message.format(path), ResourceWarning)
return
raise
raise exc
def escape_cmd(cmd):
@@ -1816,7 +1816,10 @@ def make_posix(path):
"""
if not isinstance(path, six.string_types):
raise TypeError("Expected a string for path, received {0!r}...".format(path))
starts_with_sep = path.startswith(os.path.sep)
separated = normalize_path(path).split(os.path.sep)
if isinstance(separated, (list, tuple)):
path = posixpath.join(*separated)
if starts_with_sep:
path = "/{0}".format(path)
return path