Skip to content

Commit dd5a038

Browse files
keithartemcm
authored andcommitted
Update build-script-helper to python3
This was just a run of 2to3 on this script. Fixes swiftlang/swift#58528
1 parent 3e802a8 commit dd5a038

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Utilities/build-script-helper.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python
2-
3-
from __future__ import print_function
1+
#!/usr/bin/env python3
42

53
import argparse
64
from distutils import file_util
@@ -66,10 +64,10 @@ def swiftpm(action, swift_exec, swiftpm_args, env=None):
6664
subprocess.check_call(cmd, env=env)
6765

6866
def swiftpm_bin_path(swift_exec, swiftpm_args, env=None):
69-
swiftpm_args = list(filter(lambda arg: arg != '-v' and arg != '--verbose', swiftpm_args))
67+
swiftpm_args = [arg for arg in swiftpm_args if arg != '-v' and arg != '--verbose']
7068
cmd = [swift_exec, 'build', '--show-bin-path'] + swiftpm_args
7169
print(' '.join(cmd))
72-
return subprocess.check_output(cmd, env=env).strip()
70+
return subprocess.check_output(cmd, env=env).strip().decode("UTF-8")
7371

7472
def get_swiftpm_options(args):
7573
swiftpm_args = [
@@ -121,7 +119,7 @@ def get_swiftpm_options(args):
121119

122120
def install_binary(file, source_dir, install_dir, verbose):
123121
print('Installing %s into: %s' % (file, install_dir))
124-
cmd = ['rsync', '-a', os.path.join(source_dir.decode('UTF-8'), file), install_dir]
122+
cmd = ['rsync', '-a', os.path.join(source_dir, file), install_dir]
125123
if verbose:
126124
print(' '.join(cmd))
127125
subprocess.check_call(cmd)
@@ -153,12 +151,7 @@ def add_rpath(rpath, binary, verbose):
153151
print(stdout)
154152

155153
def should_test_parallel():
156-
if platform.system() == 'Linux':
157-
distro = platform.linux_distribution()
158-
if distro[0] != 'Ubuntu':
159-
# Workaround hang in Process.run() that hasn't been tracked down yet.
160-
return False
161-
return True
154+
return platform.system() != 'Linux'
162155

163156
def handle_invocation(args):
164157
swiftpm_args = get_swiftpm_options(args)
@@ -308,9 +301,8 @@ def install_libraries(args, build_dir, universal_lib_dir, toolchain_lib_dir, tar
308301
delete_rpath(driver_lib_dir_path, lib_path, args.verbose)
309302

310303
# Fixup the TSC and llbuild rpaths
311-
driver_libs = map(lambda d: os.path.join('lib', d), ['libSwiftDriver', 'libSwiftOptions', 'libSwiftDriverExecution'])
312-
tsc_libs = map(lambda d: os.path.join('dependencies', 'swift-tools-support-core', 'lib', d),
313-
['libTSCBasic', 'libTSCLibc', 'libTSCUtility'])
304+
driver_libs = [os.path.join('lib', d) for d in ['libSwiftDriver', 'libSwiftOptions', 'libSwiftDriverExecution']]
305+
tsc_libs = [os.path.join('dependencies', 'swift-tools-support-core', 'lib', d) for d in ['libTSCBasic', 'libTSCLibc', 'libTSCUtility']]
314306
for lib in driver_libs + tsc_libs:
315307
for target in targets:
316308
lib_path = os.path.join(build_dir, target,

0 commit comments

Comments
 (0)