diff --git a/pipenv/environment.py b/pipenv/environment.py index 9c13611e..bf4df591 100644 --- a/pipenv/environment.py +++ b/pipenv/environment.py @@ -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 diff --git a/pipenv/project.py b/pipenv/project.py index c71c40ea..af155cc6 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -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): diff --git a/pipenv/utils.py b/pipenv/utils.py index 199e2b41..b1419474 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -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