Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9985bc0

Browse files
authored
Migrate all Python hashbangs to Python 3 (#27838)
Migrates all `#!/usr/bin/env python` hashbang lines to use python3. Also updates the licence tool to treat python3 scripts on par with python 2 scripts. Issue: flutter/flutter#83043
1 parent b69df5e commit 9985bc0

40 files changed

+95
-74
lines changed

build/copy_info_plist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
@@ -13,9 +13,9 @@
1313
usage: copy_info_plist.py <src_path> <dest_path> --bitcode=<enable_bitcode>
1414
"""
1515

16-
from __future__ import absolute_import
17-
from __future__ import division
18-
from __future__ import print_function
16+
17+
18+
1919
import subprocess
2020

2121
import sys

build/dart/tools/dart_package_name.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
2+
#
23
# Copyright 2013 The Flutter Authors. All rights reserved.
34
# Use of this source code is governed by a BSD-style license that can be
45
# found in the LICENSE file.

build/dart/tools/dart_pkg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
@@ -81,7 +81,7 @@ def copy(from_root, to_root, filter_func=None):
8181
os.makedirs(to_dir)
8282
shutil.copy(from_path, to_path)
8383

84-
dirs[:] = filter(wrapped_filter, dirs)
84+
dirs[:] = list(filter(wrapped_filter, dirs))
8585

8686

8787
def copy_or_link(from_root, to_root, filter_func=None):
@@ -114,7 +114,7 @@ def list_files(from_root, filter_func=None):
114114
for name in filter(wrapped_filter, files):
115115
path = os.path.join(root, name)
116116
file_list.append(path)
117-
dirs[:] = filter(wrapped_filter, dirs)
117+
dirs[:] = list(filter(wrapped_filter, dirs))
118118
return file_list
119119

120120

build/generate_coverage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
@@ -84,7 +84,7 @@ def main():
8484

8585
RemoveIfExists(raw_profile)
8686

87-
print "Running test %s to gather profile." % os.path.basename(absolute_test_path)
87+
print("Running test %s to gather profile." % os.path.basename(absolute_test_path))
8888

8989
test_command = [absolute_test_path]
9090

build/git_revision.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
55
# found in the LICENSE file.
66

77
"""Get the Git HEAD revision of a specified Git repository."""
8-
from __future__ import absolute_import
9-
from __future__ import division
10-
from __future__ import print_function
8+
9+
10+
1111

1212
import sys
1313
import subprocess

build/zip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
2+
#
23
# Copyright 2013 The Flutter Authors. All rights reserved.
34
# Use of this source code is governed by a BSD-style license that can be
45
# found in the LICENSE file.

ci/firebase_testlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
#
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be

ci/licenses_golden/tool_signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Signature: 17e2c7f169a5804317b8f79ab1f8a838
1+
Signature: fdaf33383efb94fa6bbc158cbc25635c
22

shell/platform/fuchsia/flutter/build/asset_package.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
2+
#
23
# Copyright 2013 The Flutter Authors. All rights reserved.
34
# Use of this source code is governed by a BSD-style license that can be
45
# found in the LICENSE file.

shell/platform/fuchsia/flutter/build/gen_debug_wrapper_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
2+
#
23
# Copyright 2013 The Flutter Authors. All rights reserved.
34
# Use of this source code is governed by a BSD-style license that can be
45
# found in the LICENSE file.

0 commit comments

Comments
 (0)