Allow virtual env creation in dir with leading dash

Invoke pew with a double dash separator ("--"), to make it clear that
the virtualenv name is a positional argument. Since the virtualenv
name includes all or at least the beginning of the directory name,
trying to create a virtualenv in a directory with a leading dash in
its name will cause pew to erroneously parse the virtualenv name as an
optional argument. Adding the separator causes the virtualenv name to
be parsed correctly.

Fixes #439
This commit is contained in:
David Noetzel
2018-06-25 14:40:55 -05:00
parent 4b4b384fe0
commit d3513ee382
+2 -1
View File
@@ -914,7 +914,6 @@ def do_create_virtualenv(python=None, site_packages=False):
'-m',
'pipenv.pew',
'new',
project.virtualenv_name,
'-d',
'-a',
project.project_directory,
@@ -932,6 +931,8 @@ def do_create_virtualenv(python=None, site_packages=False):
err=True,
)
cmd = cmd + ['-p', python]
if not project.is_venv_in_project():
cmd = cmd + ['--', project.virtualenv_name]
# Actually create the virtualenv.
with spinner():
try: