diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-04 15:35:24 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-04 15:35:24 -0500 |
commit | 9ae65281da09ec9cc1fcb91f8733a7a62ad940fe (patch) | |
tree | e1271e9322856f472c72bec571b217a191de751b /setuptools/command/easy_install.py | |
parent | ad43d1ec63587fd73fa12154e8a81e91e78e15e3 (diff) | |
download | python-setuptools-bitbucket-9ae65281da09ec9cc1fcb91f8733a7a62ad940fe.tar.gz |
Reuse list2cmdline for argument quoting.
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-x | setuptools/command/easy_install.py | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index d05f4c65..c68fe757 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -35,6 +35,7 @@ import warnings import site import struct import contextlib +import subprocess from setuptools import Command from setuptools.sandbox import run_setup @@ -1825,36 +1826,7 @@ def is_sh(executable): def nt_quote_arg(arg): """Quote a command line argument according to Windows parsing rules""" - - result = [] - needquote = False - nb = 0 - - needquote = (" " in arg) or ("\t" in arg) - if needquote: - result.append('"') - - for c in arg: - if c == '\\': - nb += 1 - elif c == '"': - # double preceding backslashes, then add a \" - result.append('\\' * (nb * 2) + '\\"') - nb = 0 - else: - if nb: - result.append('\\' * nb) - nb = 0 - result.append(c) - - if nb: - result.append('\\' * nb) - - if needquote: - result.append('\\' * nb) # double the trailing backslashes - result.append('"') - - return ''.join(result) + return subprocess.list2cmdline([arg]) def is_python_script(script_text, filename): |