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

Commit 8e03b78

Browse files
committed
Apply format
1 parent 88276cc commit 8e03b78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2794
-1863
lines changed

build/android_artifacts.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ def cp_files(args):
2424

2525
def main():
2626
parser = argparse.ArgumentParser()
27-
parser.add_argument('-i', dest='input_pairs', nargs=2, action='append',
28-
help='The input file and its destination.')
27+
parser.add_argument(
28+
'-i',
29+
dest='input_pairs',
30+
nargs=2,
31+
action='append',
32+
help='The input file and its destination.'
33+
)
2934
cp_files(parser.parse_args())
3035
return 0
3136

build/copy_info_plist.py

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,60 @@
2020
import git_revision
2121
import os
2222

23-
def GetClangVersion(bitcode) :
24-
clang_executable = str(os.path.join("..", "..", "buildtools", "mac-x64", "clang", "bin", "clang++"))
23+
24+
def GetClangVersion(bitcode):
25+
clang_executable = str(
26+
os.path.join(
27+
"..", "..", "buildtools", "mac-x64", "clang", "bin", "clang++"
28+
)
29+
)
2530
if bitcode:
2631
clang_executable = "clang++"
2732
version = subprocess.check_output([clang_executable, "--version"])
2833
return version.splitlines()[0]
2934

35+
3036
def main():
3137

3238
parser = argparse.ArgumentParser(
33-
description='Copies the Info.plist and adds extra fields to it like the git hash of the engine')
39+
description='Copies the Info.plist and adds extra fields to it like the git hash of the engine'
40+
)
3441

35-
parser.add_argument('--source', help='Path to Info.plist source template', type=str, required=True)
36-
parser.add_argument('--destination', help='Path to destination Info.plist', type=str, required=True)
37-
parser.add_argument('--bitcode', help='Built with bitcode', action='store_true')
38-
parser.add_argument('--minversion', help='Minimum device OS version like "9.0"', type=str)
42+
parser.add_argument(
43+
'--source',
44+
help='Path to Info.plist source template',
45+
type=str,
46+
required=True
47+
)
48+
parser.add_argument(
49+
'--destination',
50+
help='Path to destination Info.plist',
51+
type=str,
52+
required=True
53+
)
54+
parser.add_argument(
55+
'--bitcode', help='Built with bitcode', action='store_true'
56+
)
57+
parser.add_argument(
58+
'--minversion', help='Minimum device OS version like "9.0"', type=str
59+
)
3960

4061
args = parser.parse_args()
4162

4263
text = open(args.source).read()
4364
engine_path = os.path.join(os.getcwd(), "..", "..", "flutter")
4465
revision = git_revision.GetRepositoryVersion(engine_path)
45-
bitcode = args.bitcode is not None;
66+
bitcode = args.bitcode is not None
4667
clang_version = GetClangVersion(bitcode)
47-
text = text.format(revision = revision, clang_version = clang_version, min_version = args.minversion)
68+
text = text.format(
69+
revision=revision,
70+
clang_version=clang_version,
71+
min_version=args.minversion
72+
)
4873

4974
with open(args.destination, "w") as outfile:
5075
outfile.write(text)
5176

77+
5278
if __name__ == "__main__":
5379
main()

build/dart/tools/dart_package_name.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
import os
1111
import sys
1212

13+
1314
# TODO(johnmccutchan): Use the yaml package to parse.
1415
def PackageName(line):
1516
assert line.startswith("name:")
1617
return line.split(":")[1].strip()
1718

19+
1820
def main(pubspec_file):
1921
source_file = open(pubspec_file, "r")
2022
for line in source_file:
@@ -25,15 +27,19 @@ def main(pubspec_file):
2527
# Couldn't find it.
2628
return -1
2729

30+
2831
if __name__ == '__main__':
2932
parser = argparse.ArgumentParser(
3033
description="This script outputs the package name specified in the"
31-
"pubspec.yaml")
32-
parser.add_argument("--pubspec",
33-
dest="pubspec_file",
34-
metavar="<pubspec-file>",
35-
type=str,
36-
required=True,
37-
help="Path to pubspec file")
34+
"pubspec.yaml"
35+
)
36+
parser.add_argument(
37+
"--pubspec",
38+
dest="pubspec_file",
39+
metavar="<pubspec-file>",
40+
type=str,
41+
required=True,
42+
help="Path to pubspec file"
43+
)
3844
args = parser.parse_args()
3945
sys.exit(main(args.pubspec_file))

build/dart/tools/dart_pkg.py

Lines changed: 93 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
USE_LINKS = sys.platform != "win32"
1818

19-
DART_ANALYZE = os.path.join(os.path.dirname(os.path.abspath(__file__)),
20-
"dart_analyze.py")
19+
DART_ANALYZE = os.path.join(
20+
os.path.dirname(os.path.abspath(__file__)), "dart_analyze.py"
21+
)
22+
2123

2224
def dart_filter(path):
2325
if os.path.isdir(path):
@@ -142,7 +144,7 @@ def remove_broken_symlinks(root_dir):
142144

143145

144146
def analyze_entrypoints(dart_sdk, package_root, entrypoints):
145-
cmd = [ "python", DART_ANALYZE ]
147+
cmd = ["python", DART_ANALYZE]
146148
cmd.append("--dart-sdk")
147149
cmd.append(dart_sdk)
148150
cmd.append("--entrypoints")
@@ -161,60 +163,84 @@ def analyze_entrypoints(dart_sdk, package_root, entrypoints):
161163

162164
def main():
163165
parser = argparse.ArgumentParser(description='Generate a dart-pkg')
164-
parser.add_argument('--dart-sdk',
165-
action='store',
166-
metavar='dart_sdk',
167-
help='Path to the Dart SDK.')
168-
parser.add_argument('--package-name',
169-
action='store',
170-
metavar='package_name',
171-
help='Name of package',
172-
required=True)
173-
parser.add_argument('--pkg-directory',
174-
metavar='pkg_directory',
175-
help='Directory where dart_pkg should go',
176-
required=True)
177-
parser.add_argument('--package-root',
178-
metavar='package_root',
179-
help='packages/ directory',
180-
required=True)
181-
parser.add_argument('--stamp-file',
182-
metavar='stamp_file',
183-
help='timestamp file',
184-
required=True)
185-
parser.add_argument('--entries-file',
186-
metavar='entries_file',
187-
help='script entries file',
188-
required=True)
189-
parser.add_argument('--package-sources',
190-
metavar='package_sources',
191-
help='Package sources',
192-
nargs='+')
193-
parser.add_argument('--package-entrypoints',
194-
metavar='package_entrypoints',
195-
help='Package entry points for analyzer',
196-
nargs='*',
197-
default=[])
198-
parser.add_argument('--sdk-ext-directories',
199-
metavar='sdk_ext_directories',
200-
help='Directory containing .dart sources',
201-
nargs='*',
202-
default=[])
203-
parser.add_argument('--sdk-ext-files',
204-
metavar='sdk_ext_files',
205-
help='List of .dart files that are part of sdk_ext.',
206-
nargs='*',
207-
default=[])
208-
parser.add_argument('--sdk-ext-mappings',
209-
metavar='sdk_ext_mappings',
210-
help='Mappings for SDK extension libraries.',
211-
nargs='*',
212-
default=[])
213-
parser.add_argument('--read_only',
214-
action='store_true',
215-
dest='read_only',
216-
help='Package is a read only package.',
217-
default=False)
166+
parser.add_argument(
167+
'--dart-sdk',
168+
action='store',
169+
metavar='dart_sdk',
170+
help='Path to the Dart SDK.'
171+
)
172+
parser.add_argument(
173+
'--package-name',
174+
action='store',
175+
metavar='package_name',
176+
help='Name of package',
177+
required=True
178+
)
179+
parser.add_argument(
180+
'--pkg-directory',
181+
metavar='pkg_directory',
182+
help='Directory where dart_pkg should go',
183+
required=True
184+
)
185+
parser.add_argument(
186+
'--package-root',
187+
metavar='package_root',
188+
help='packages/ directory',
189+
required=True
190+
)
191+
parser.add_argument(
192+
'--stamp-file',
193+
metavar='stamp_file',
194+
help='timestamp file',
195+
required=True
196+
)
197+
parser.add_argument(
198+
'--entries-file',
199+
metavar='entries_file',
200+
help='script entries file',
201+
required=True
202+
)
203+
parser.add_argument(
204+
'--package-sources',
205+
metavar='package_sources',
206+
help='Package sources',
207+
nargs='+'
208+
)
209+
parser.add_argument(
210+
'--package-entrypoints',
211+
metavar='package_entrypoints',
212+
help='Package entry points for analyzer',
213+
nargs='*',
214+
default=[]
215+
)
216+
parser.add_argument(
217+
'--sdk-ext-directories',
218+
metavar='sdk_ext_directories',
219+
help='Directory containing .dart sources',
220+
nargs='*',
221+
default=[]
222+
)
223+
parser.add_argument(
224+
'--sdk-ext-files',
225+
metavar='sdk_ext_files',
226+
help='List of .dart files that are part of sdk_ext.',
227+
nargs='*',
228+
default=[]
229+
)
230+
parser.add_argument(
231+
'--sdk-ext-mappings',
232+
metavar='sdk_ext_mappings',
233+
help='Mappings for SDK extension libraries.',
234+
nargs='*',
235+
default=[]
236+
)
237+
parser.add_argument(
238+
'--read_only',
239+
action='store_true',
240+
dest='read_only',
241+
help='Package is a read only package.',
242+
default=False
243+
)
218244
args = parser.parse_args()
219245

220246
# We must have a pubspec.yaml.
@@ -233,14 +259,16 @@ def main():
233259
sdkext_path = os.path.join(lib_path, '_sdkext')
234260
if mappings:
235261
with open(sdkext_path, 'w') as stream:
236-
json.dump(mappings, stream, sort_keys=True,
237-
indent=2, separators=(',', ': '))
262+
json.dump(
263+
mappings, stream, sort_keys=True, indent=2, separators=(',', ': ')
264+
)
238265
else:
239266
remove_if_exists(sdkext_path)
240267

241268
# Copy or symlink package sources into pkg directory.
242-
common_source_prefix = os.path.dirname(os.path.commonprefix(
243-
args.package_sources))
269+
common_source_prefix = os.path.dirname(
270+
os.path.commonprefix(args.package_sources)
271+
)
244272
for source in args.package_sources:
245273
relative_source = os.path.relpath(source, common_source_prefix)
246274
target = os.path.join(target_dir, relative_source)
@@ -263,8 +291,9 @@ def main():
263291
target = os.path.join(sdk_ext_dir, relative_source)
264292
copy_or_link(source, target)
265293

266-
common_source_prefix = os.path.dirname(os.path.commonprefix(
267-
args.sdk_ext_files))
294+
common_source_prefix = os.path.dirname(
295+
os.path.commonprefix(args.sdk_ext_files)
296+
)
268297
for source in args.sdk_ext_files:
269298
relative_source = os.path.relpath(source, common_source_prefix)
270299
target = os.path.join(sdk_ext_dir, relative_source)
@@ -293,5 +322,6 @@ def main():
293322

294323
return 0
295324

325+
296326
if __name__ == '__main__':
297327
sys.exit(main())

0 commit comments

Comments
 (0)