8000 fix quoting · ofek/codecov-python@3bf567a · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bf567a

Browse files
committed
fix quoting
codecov#169
1 parent ba51a78 commit 3bf567a

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

codecov/__init__.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@
1414
except ImportError: # pragma: no cover
1515
from urllib import urlencode
1616

17-
try:
18-
from shlex import quote
19-
except ImportError: # pragma: no cover
20-
from pipes import quote
17+
quote = None
18+
if sys.platform == 'win32': # pragma: no cover
19+
try:
20+
# https://github.com/python/cpython/blob/3.7/Lib/subprocess.py#L174-L175
21+
from subprocess import list2cmdline
22+
23+
def quote(arg):
24+
return list2cmdline([arg])
25+
except ImportError:
26+
pass
27+
28+
if quote is None:
29+
try:
30+
from shlex import quote
31+
except ImportError: # pragma: no cover
32+
from pipes import quote
2133

2234
import subprocess
2335

@@ -181,7 +193,7 @@ def try_to_run(cmd, shell=True):
181193

182194
def run_python_coverage(args):
183195
"""Run the Python coverage tool
184-
196+
185197
If it's importable in this Python, launch it using 'python -m'.
186198
Otherwise, look it up on PATH like any other command.
187199
"""

0 commit comments

Comments
 (0)
0