Skip to content

Commit 6f2077e

Browse files
committed
build-swift: Explicitly use python3
This changes build-swift script shebang to use Python 3 explicitly. The code is already compatible and functional with python3, so this removes any implied backward compatibility, and removes any ambiguity based on the user's current environment, especially since some systems, like macOS, still link 'python' to Python 2. This also removes the now unnecessary 'from __future__' imports, and the 'six' module, which is only necessary for python2 compatibility.
1 parent 83e3ae8 commit 6f2077e

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

utils/build-script

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# This source file is part of the Swift.org open source project
44
#
@@ -8,14 +8,10 @@
88
# See https://swift.org/LICENSE.txt for license information
99
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010

11-
1211
"""
1312
The ultimate tool for building Swift.
1413
"""
1514

16-
17-
from __future__ import absolute_import, print_function, unicode_literals
18-
1915
import json
2016
import os
2117
import platform
@@ -32,8 +28,6 @@ from build_swift.build_swift.constants import SWIFT_BUILD_ROOT
3228
from build_swift.build_swift.constants import SWIFT_REPO_NAME
3329
from build_swift.build_swift.constants import SWIFT_SOURCE_ROOT
3430

35-
import six
36-
3731
from swift_build_support.swift_build_support import build_script_invocation
3832
from swift_build_support.swift_build_support import shell
3933
from swift_build_support.swift_build_support import targets
@@ -119,7 +113,7 @@ class JSONDumper(json.JSONEncoder):
119113
def default(self, o):
120114
if hasattr(o, '__dict__'):
121115
return vars(o)
122-
return six.text_type(o)
116+
return str(o)
123117

124118

125119
def print_xcodebuild_versions(file=sys.stdout):
@@ -506,7 +500,7 @@ def main_preset():
506500
try:
507501
preset_parser.read_files(args.preset_file_names)
508502
except presets.PresetError as e:
509-
fatal_error(six.text_type(e))
503+
fatal_error(str(e))
510504

511505
if args.show_presets:
512506
for name in sorted(preset_parser.preset_names,
@@ -527,7 +521,7 @@ def main_preset():
527521
args.preset,
528522
vars=args.preset_substitutions)
529523
except presets.PresetError as e:
530-
fatal_error(six.text_type(e))
524+
fatal_error(str(e))
531525

532526
preset_args = migration.migrate_swift_sdks(preset.args)
533527

0 commit comments

Comments
 (0)