Skip to content

Commit d0e377e

Browse files
committed
[utils] Use Python 2 compatible name for text=True
1 parent bcddc9b commit d0e377e

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

utils/check-incremental

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def compile_and_stat(compile_args, output_file):
3535
"""
3636
subprocess.check_call(compile_args)
3737

38-
md5 = subprocess.check_output(["md5", "-q", output_file], text=True)
38+
md5 = subprocess.check_output(["md5", "-q", output_file],
39+
universal_newlines=True)
3940
mtime = time.ctime(os.path.getmtime(output_file))
4041

4142
if VERBOSE:

utils/refactor-check-compiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def run_cmd(cmd, desc):
1111
try:
12-
return subprocess.check_output(cmd, text=True)
12+
return subprocess.check_output(cmd, universal_newlines=True)
1313
except subprocess.CalledProcessError:
1414
print('FAILED ' + desc + ':', file=sys.stderr)
1515
print(' '.join(cmd), file=sys.stderr)

utils/swift-darwin-postprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def main(arguments):
3333
def unrpathize(filename):
3434
dylibsOutput = subprocess.check_output(
3535
['xcrun', 'dyldinfo', '-dylibs', filename],
36-
text=True)
36+
universal_newlines=True)
3737

3838
# Do not rewrite @rpath-relative load commands for these libraries:
3939
# they are test support libraries that are never installed under

utils/swift-rpathize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def main(arguments):
5656
def rpathize(filename):
5757
dylibsOutput = subprocess.check_output(
5858
['xcrun', 'dyldinfo', '-dylibs', filename],
59-
text=True)
59+
universal_newlines=True)
6060

6161
# The output from dyldinfo -dylibs is a line of header followed by one
6262
# install name per line, indented with spaces.

utils/swift_build_support/swift_build_support/shell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def capture(command, stderr=None, env=None, dry_run=None, echo=True,
133133
_env.update(env)
134134
try:
135135
return subprocess.check_output(command, env=_env, stderr=stderr,
136-
text=True)
136+
universal_newlines=True)
137137
except subprocess.CalledProcessError as e:
138138
if allow_non_zero_exit:
139139
return e.output
@@ -217,7 +217,8 @@ def run(*args, **kwargs):
217217
return(None, 0, args)
218218

219219
my_pipe = subprocess.Popen(
220-
*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
220+
*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
221+
universal_newlines=True,
221222
**kwargs)
222223
(output, _) = my_pipe.communicate()
223224
ret = my_pipe.wait()

0 commit comments

Comments
 (0)