mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #4275 from pypa/bugfix/4273
Don't check against root directory
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fix a bug that Pipenv rejects to work under the root directory.
|
||||
+4
-9
@@ -126,8 +126,11 @@ def do_clear():
|
||||
|
||||
try:
|
||||
vistir.path.rmtree(PIPENV_CACHE_DIR, onerror=vistir.path.handle_remove_readonly)
|
||||
# Other processes may be writing into this directory simultaneously.
|
||||
vistir.path.rmtree(
|
||||
locations.USER_CACHE_DIR, onerror=vistir.path.handle_remove_readonly
|
||||
locations.USER_CACHE_DIR,
|
||||
ignore_errors=environments.PIPENV_IS_CI,
|
||||
onerror=vistir.path.handle_remove_readonly
|
||||
)
|
||||
except OSError as e:
|
||||
# Ignore FileNotFoundError. This is needed for Python 2.7.
|
||||
@@ -568,14 +571,6 @@ def ensure_project(
|
||||
system = True
|
||||
if not project.pipfile_exists and deploy:
|
||||
raise exceptions.PipfileNotFound
|
||||
# Fail if working under /
|
||||
if not project.name:
|
||||
click.echo(
|
||||
"{0}: Pipenv is not intended to work under the root directory, "
|
||||
"please choose another path.".format(crayons.red("ERROR")),
|
||||
err=True
|
||||
)
|
||||
sys.exit(1)
|
||||
# Skip virtualenv creation when --system was used.
|
||||
if not system:
|
||||
ensure_virtualenv(
|
||||
|
||||
+4
-12
@@ -682,18 +682,10 @@ class Project(object):
|
||||
|
||||
def create_pipfile(self, python=None):
|
||||
"""Creates the Pipfile, filled with juicy defaults."""
|
||||
from .vendor.pip_shims.shims import (
|
||||
ConfigOptionParser, make_option_group, index_group
|
||||
)
|
||||
|
||||
config_parser = ConfigOptionParser(name=self.name)
|
||||
config_parser.add_option_group(make_option_group(index_group, config_parser))
|
||||
install = config_parser.option_groups[0]
|
||||
indexes = (
|
||||
" ".join(install.get_option("--extra-index-url").default)
|
||||
.lstrip("\n")
|
||||
.split("\n")
|
||||
)
|
||||
from .vendor.pip_shims.shims import InstallCommand
|
||||
# Inherit the pip's index configuration of install command.
|
||||
command = InstallCommand()
|
||||
indexes = command.cmd_opts.get_option("--extra-index-url").default
|
||||
sources = [DEFAULT_SOURCE]
|
||||
for i, index in enumerate(indexes):
|
||||
if not index:
|
||||
|
||||
Reference in New Issue
Block a user