Fix circular import

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-11-15 01:01:33 -05:00
parent ec604cffc3
commit 04bb9ada05
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -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):
+3 -2
View File
@@ -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 "