mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
+3
-3
@@ -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):
|
||||
|
||||
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user