mirror of
https://github.com/dart-lang/sdk
synced 2024-10-04 20:39:38 +00:00
b5c63ce757
* Migrate to python3; drop python support. * Update Windows toolchain support. * Remove some unused methods. * Python 2.7 is still needed on Windows. * Update gsutil to a version that supports python3. Fixes: https://github.com/dart-lang/sdk/issues/28793 TEST=Manually tested common user journeys. Change-Id: I663a22b237a548bb82dc2e601e399e3bc3649211 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192182 Reviewed-by: William Hesse <whesse@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
61 lines
1.4 KiB
Python
Executable file
61 lines
1.4 KiB
Python
Executable file
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
#
|
|
|
|
# Finds files in the given directories and their subdirectories, and prints them
|
|
# in the json format expected by GN fuchsia_component's resources arg:
|
|
# [
|
|
# {
|
|
# "path": "path/to/file.dart",
|
|
# "dest": "data/path/to/file.dart"
|
|
# },
|
|
# ...
|
|
# ]
|
|
|
|
import sys
|
|
import os
|
|
|
|
from os.path import join, abspath, relpath
|
|
|
|
DART_DIR = abspath(join(__file__, '..', '..', '..'))
|
|
|
|
|
|
def listFiles(path):
|
|
allFiles = []
|
|
for dirpath, dirs, files in os.walk(join(DART_DIR, path)):
|
|
allFiles += [
|
|
relpath(abspath(join(dirpath, p)), DART_DIR) for p in files
|
|
]
|
|
return allFiles
|
|
|
|
|
|
def printOutput(files):
|
|
print('[')
|
|
print(',\n'.join([
|
|
' {\n "path": "%s",\n "dest": "data/%s"\n }' % (f, f)
|
|
for f in files
|
|
]))
|
|
print(']')
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) < 2:
|
|
print('Expected at least 1 arg, the paths to search.')
|
|
return 1
|
|
allFiles = []
|
|
for directory in sys.argv[1:]:
|
|
files = listFiles(directory)
|
|
if len(files) == 0:
|
|
print('Did not find any files in the directory: ' + directory)
|
|
return 2
|
|
allFiles += files
|
|
printOutput(sorted(allFiles))
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|