Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoding issues and python discovery #3225

Merged
merged 7 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix circular import
Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Nov 15, 2018
commit 04bb9ada05241e84a28aa0a3ee9cca36fdac8a84
6 changes: 3 additions & 3 deletions pipenv/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
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
Expand Down Expand Up @@ -55,6 +54,7 @@ def _infer_return_type(*args):

class finalize(object):
def __init__(self, *args, **kwargs):
from .utils import logging
logging.warn("weakref.finalize unavailable, not cleaning...")

def detach(self):
Expand Down Expand Up @@ -100,7 +100,7 @@ def __init__(self, suffix="", prefix="", dir=None):

@classmethod
def _cleanup(cls, name, warn_message):
rmtree(name)
vistir.path.rmtree(name)
warnings.warn(warn_message, ResourceWarning)

def __repr__(self):
Expand All @@ -114,7 +114,7 @@ def __exit__(self, exc, value, tb):

def cleanup(self):
if self._finalizer.detach():
rmtree(self.name)
vistir.path.rmtree(self.name)


def _sanitize_params(prefix, suffix, dir):
Expand Down
5 changes: 3 additions & 2 deletions pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from click_didyoumean import DYMCommandCollection

from .. import environments
from ..__version__ import __version__
from .options import (
CONTEXT_SETTINGS, PipenvGroup, code_option, common_options, deploy_option,
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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 "
Expand Down