From e94495ec8da8d0265fa50757aa8a3b3d7cc4e348 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 15 Nov 2018 01:01:33 -0500 Subject: [PATCH] Fix circular import Signed-off-by: Dan Ryan --- pipenv/_compat.py | 6 +++--- pipenv/cli/command.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pipenv/_compat.py b/pipenv/_compat.py index 35ff2188..09f65669 100644 --- a/pipenv/_compat.py +++ b/pipenv/_compat.py @@ -14,7 +14,6 @@ import sys import warnings import vistir from tempfile import _bin_openflags, gettempdir, _mkstemp_inner, mkdtemp -from .utils import logging, rmtree try: from tempfile import _infer_return_type @@ -55,6 +54,7 @@ except ImportError: class finalize(object): def __init__(self, *args, **kwargs): + from .utils import logging logging.warn("weakref.finalize unavailable, not cleaning...") def detach(self): @@ -100,7 +100,7 @@ class TemporaryDirectory(object): @classmethod def _cleanup(cls, name, warn_message): - rmtree(name) + vistir.path.rmtree(name) warnings.warn(warn_message, ResourceWarning) def __repr__(self): @@ -114,7 +114,7 @@ class TemporaryDirectory(object): def cleanup(self): if self._finalizer.detach(): - rmtree(self.name) + vistir.path.rmtree(self.name) def _sanitize_params(prefix, suffix, dir): diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 14120e35..5a39fb02 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -15,7 +15,6 @@ import click_completion from click_didyoumean import DYMCommandCollection -from .. import environments from ..__version__ import __version__ from .options import ( CONTEXT_SETTINGS, PipenvGroup, code_option, common_options, deploy_option, @@ -115,6 +114,7 @@ def cli( return 1 if envs: echo("The following environment variables can be set, to do various things:\n") + from .. import environments for key in environments.__dict__: if key.startswith("PIPENV"): echo(" - {0}".format(crayons.normal(key, bold=True))) @@ -161,7 +161,8 @@ def cli( # --rm was passed… elif rm: # Abort if --system (or running in a virtualenv). - if environments.PIPENV_USE_SYSTEM: + from .environments import PIPENV_USE_SYSTEM + if PIPENV_USE_SYSTEM: echo( crayons.red( "You are attempting to remove a virtualenv that "