diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 043325c7..c2b37840 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -1,13 +1,8 @@ from __future__ import print_function -import os, subprocess, sys, uuid, textwrap +import os, shlex, subprocess, sys, textwrap, uuid from collections import namedtuple from .util import prepare_command, get_build_verbosity_extra_flags -try: - from shlex import quote as shlex_quote -except ImportError: - from pipes import quote as shlex_quote - def get_python_configurations(build_selector): PythonConfiguration = namedtuple('PythonConfiguration', ['identifier', 'path']) @@ -132,14 +127,14 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef pybin_paths=' '.join(c.path+'/bin' for c in platform_configs), test_requires=' '.join(test_requires), test_extras=test_extras, - test_command=shlex_quote( + test_command=shlex.quote( prepare_command(test_command, project='/project') if test_command else '' ), - before_build=shlex_quote( + before_build=shlex.quote( prepare_command(before_build, project='/project') if before_build else '' ), build_verbosity_flag=' '.join(get_build_verbosity_extra_flags(build_verbosity)), - repair_command=shlex_quote( + repair_command=shlex.quote( prepare_command(repair_command, wheel='"$1"', dest_dir='/tmp/repaired_wheels') if repair_command else '' ), environment_exports='\n'.join(environment.as_shell_commands()), diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 7480990f..6e71d673 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -3,10 +3,6 @@ import tempfile import os, subprocess, shlex, sys, shutil from collections import namedtuple from glob import glob -try: - from shlex import quote as shlex_quote -except ImportError: - from pipes import quote as shlex_quote from .util import prepare_command, get_build_verbosity_extra_flags, download @@ -46,7 +42,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef if shell: print('+ %s' % args) else: - print('+ ' + ' '.join(shlex_quote(a) for a in args)) + print('+ ' + ' '.join(shlex.quote(a) for a in args)) return subprocess.check_call(args, env=env, cwd=cwd, shell=shell) diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py index 0aedbcac..14839ba3 100644 --- a/cibuildwheel/util.py +++ b/cibuildwheel/util.py @@ -1,13 +1,8 @@ from fnmatch import fnmatch import warnings -import os +import os, urllib.request from time import sleep -try: - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen - def prepare_command(command, **kwargs): ''' @@ -68,7 +63,7 @@ def download(url, dest): repeat_num = 3 for i in range(repeat_num): try: - response = urlopen(url) + response = urllib.request.urlopen(url) except: if i == repeat_num - 1: raise diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index c50c9810..26b93b7f 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -3,11 +3,6 @@ import os, tempfile, subprocess, shutil, sys from collections import namedtuple from glob import glob -try: - from shlex import quote as shlex_quote -except ImportError: - from pipes import quote as shlex_quote - from .util import prepare_command, get_build_verbosity_extra_flags, download