mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Escape command line requirements as necessary
- Fixes #2998 Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fixed a bug which prevented installing pinned versions which used redirection symbols from the command line.
|
||||
@@ -40,6 +40,7 @@ from .utils import (
|
||||
rmtree,
|
||||
clean_resolved_dep,
|
||||
parse_indexes,
|
||||
escape_cmd
|
||||
)
|
||||
from . import environments, pep508checker, progress
|
||||
from .environments import (
|
||||
@@ -1398,6 +1399,7 @@ def pip_install(
|
||||
pip_command.append("--upgrade-strategy=only-if-needed")
|
||||
if no_deps:
|
||||
pip_command.append("--no-deps")
|
||||
install_reqs = [escape_cmd(req) for req in install_reqs]
|
||||
pip_command.extend(install_reqs)
|
||||
pip_command.extend(prepare_pip_source_args(sources))
|
||||
if not ignore_hashes:
|
||||
|
||||
@@ -1048,6 +1048,12 @@ def handle_remove_readonly(func, path, exc):
|
||||
raise
|
||||
|
||||
|
||||
def escape_cmd(cmd):
|
||||
if any(special_char in cmd for special_char in ["<", ">", "&", ".", "^", "|", "?"]):
|
||||
cmd = '\'{0}\''.format(cmd)
|
||||
return cmd
|
||||
|
||||
|
||||
@contextmanager
|
||||
def atomic_open_for_write(target, binary=False, newline=None, encoding=None):
|
||||
"""Atomically open `target` for writing.
|
||||
|
||||
Reference in New Issue
Block a user