Skip to content

Commit 8c05d55

Browse files
authored
Merge pull request swiftlang#67496 from kavon/no-more-pipes
No more `pipes`
2 parents a8c4323 + b5e0f95 commit 8c05d55

File tree

11 files changed

+19
-26
lines changed

11 files changed

+19
-26
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ endif()
12141214
# Find required dependencies.
12151215
#
12161216

1217-
find_package(Python3 COMPONENTS Interpreter REQUIRED)
1217+
find_package(Python3 3.6 COMPONENTS Interpreter REQUIRED)
12181218

12191219
#
12201220
# Find optional dependencies.

docs/HowToGuides/GettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ toolchain as a one-off, there are a couple of differences:
191191
### Spot check dependencies
192192

193193
* Run `cmake --version`; this should be at least 3.19.6 (3.24.2 if you want to use Xcode for editing on macOS).
194-
* Run `python3 --version`; check that this succeeds.
194+
* Run `python3 --version`; this should be at least 3.6.
195195
* Run `ninja --version`; check that this succeeds.
196196
* If you installed and want to use Sccache: Run `sccache --version`; check
197197
that this succeeds.

test/SourceKit/lit.local.cfg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
import pipes
2+
import shlex
33

44

55
if 'sourcekit' not in config.available_features:
@@ -18,5 +18,4 @@ else:
1818
config.substitutions.append( ('%sourcekitd-test', '%s -module-cache-path %r' % (config.sourcekitd_test, config.clang_module_cache_path)) )
1919
config.substitutions.append( ('%complete-test', '%s -module-cache-path=%r' % (config.complete_test, config.clang_module_cache_path)) )
2020
config.substitutions.append( ('%swiftlib_dir', config.swiftlib_dir) )
21-
config.substitutions.append( ('%sed_clean', '%s %s' % (pipes.quote(sys.executable), sk_path_sanitize) ) )
22-
21+
config.substitutions.append( ('%sed_clean', '%s %s' % (shlex.quote(sys.executable), sk_path_sanitize) ) )

test/lit.cfg

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import subprocess
2727
import sys
2828
import socket
2929
import glob
30-
import pipes
3130
from distutils.sysconfig import get_python_lib
3231

3332
import lit
@@ -129,11 +128,7 @@ def get_lldb_python_interpreter(lldb_build_root):
129128
return python_path
130129

131130
if not platform.system() == 'Windows':
132-
# Python 3.3 has shlex.quote, while previous Python have pipes.quote
133-
if sys.version_info[0:2] >= (3, 2):
134-
shell_quote = shlex.quote
135-
else:
136-
shell_quote = pipes.quote
131+
shell_quote = shlex.quote
137132
else:
138133
# In Windows neither pipe.quote nor shlex.quote works.
139134
def shell_quote(s):

utils/build-script-impl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function with_pushd() {
344344
}
345345

346346
function quoted_print() {
347-
python3 -c 'import pipes; import sys; print(" ".join(pipes.quote(arg) for arg in sys.argv[1:]))' "$@"
347+
python3 -c 'import shlex; import sys; print(" ".join(shlex.quote(arg) for arg in sys.argv[1:]))' "$@"
348348
}
349349

350350
function toupper() {

utils/build_swift/build_swift/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import sys
2424
from copy import copy as _copy
2525
from pathlib import Path
26-
from pipes import quote as _quote
26+
from shlex import quote as _quote
2727
from shlex import split
2828
from subprocess import CalledProcessError
2929

utils/coverage/coverage-generate-data

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import argparse
1313
import logging
1414
import multiprocessing
1515
import os
16-
import pipes
1716
import platform
17+
import shlex
1818
import subprocess
1919
import sys
2020
import timeit
@@ -38,7 +38,7 @@ global_build_subdir = ''
3838

3939
def quote_shell_cmd(cmd):
4040
"""Return `cmd` as a properly quoted shell string"""
41-
return ' '.join([pipes.quote(a) for a in cmd])
41+
return ' '.join([shlex.quote(a) for a in cmd])
4242

4343

4444
def call(cmd, verbose=True, show_cmd=True):

utils/rth

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import argparse
1313
import glob
1414
import os
15-
import pipes
1615
import platform
1716
import shlex
1817
import shutil
@@ -27,7 +26,7 @@ def verbose_print_command(command):
2726
if platform.system() == 'Windows':
2827
print(subprocess.list2cmdline(command))
2928
else:
30-
print(" ".join(pipes.quote(c) for c in command))
29+
print(" ".join(shlex.quote(c) for c in command))
3130
sys.stdout.flush()
3231

3332

utils/sil-opt-verify-all-modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import glob
1414
import multiprocessing
1515
import os
16-
import pipes
16+
import shlex
1717
import subprocess
1818
import sys
1919
import tempfile
@@ -91,7 +91,7 @@ def get_verify_resource_dir_modules_commands(
9191

9292

9393
def quote_shell_command(args):
94-
return " ".join([pipes.quote(a) for a in args])
94+
return " ".join([shlex.quote(a) for a in args])
9595

9696

9797
def run_commands_in_parallel(commands):

utils/swift_build_support/swift_build_support/build_script_invocation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# ===---------------------------------------------------------------------===#
1212

1313
import os
14-
import pipes
1514
import platform
15+
import shlex
1616

1717
from build_swift.build_swift import argparse
1818
from build_swift.build_swift.constants import BUILD_SCRIPT_IMPL_PATH
@@ -128,9 +128,9 @@ def convert_to_impl_arguments(self):
128128
"--build-jobs", str(args.build_jobs),
129129
"--lit-jobs", str(args.lit_jobs),
130130
"--common-cmake-options=%s" % ' '.join(
131-
pipes.quote(opt) for opt in cmake.common_options()),
131+
shlex.quote(opt) for opt in cmake.common_options()),
132132
"--build-args=%s" % ' '.join(
133-
pipes.quote(arg) for arg in cmake.build_args()),
133+
shlex.quote(arg) for arg in cmake.build_args()),
134134
"--dsymutil-jobs", str(args.dsymutil_jobs),
135135
'--build-swift-libexec', str(args.build_swift_libexec).lower(),
136136
'--swift-enable-backtracing', str(args.swift_enable_backtracing).lower(),
@@ -167,7 +167,7 @@ def convert_to_impl_arguments(self):
167167
args.host_target, product_name))
168168
cmake_opts = product.cmake_options
169169

170-
# FIXME: We should be using pipes.quote here but we run into issues
170+
# FIXME: We should be using shlex.quote here but we run into issues
171171
# with build-script-impl/cmake not being happy with all of the
172172
# extra "'" in the strings. To fix this easily, we really need to
173173
# just invoke cmake from build-script directly rather than futzing
@@ -398,7 +398,7 @@ def convert_to_impl_arguments(self):
398398
if args.extra_cmake_options:
399399
impl_args += [
400400
"--extra-cmake-options=%s" % ' '.join(
401-
pipes.quote(opt) for opt in args.extra_cmake_options)
401+
shlex.quote(opt) for opt in args.extra_cmake_options)
402402
]
403403

404404
if args.lto_type is not None:

utils/swift_build_support/swift_build_support/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# ----------------------------------------------------------------------------
1515

1616
import os
17-
import pipes
1817
import platform
18+
import shlex
1919
import shutil
2020
import subprocess
2121
import sys
@@ -35,7 +35,7 @@ def _fatal_error(message):
3535

3636

3737
def _quote(arg):
38-
return pipes.quote(str(arg))
38+
return shlex.quote(str(arg))
3939

4040

4141
def quote_command(args):

0 commit comments

Comments
 (0)