pylint scripts under sky, remove dead scripts under sky/tools/roll (flutter/engine#38334)

This commit is contained in:
Zachary Anderson 2022-12-19 09:52:41 -08:00 committed by GitHub
parent 37acc8260e
commit dcee06a479
13 changed files with 37 additions and 323 deletions

View File

@ -343,9 +343,6 @@
../../../flutter/sky/tools/dist_dart_pkg.py
../../../flutter/sky/tools/install_framework_headers.py
../../../flutter/sky/tools/objcopy.py
../../../flutter/sky/tools/roll/patch.py
../../../flutter/sky/tools/roll/roll.py
../../../flutter/sky/tools/roll/utils.py
../../../flutter/testing
../../../flutter/third_party/accessibility/README.md
../../../flutter/third_party/accessibility/ax/ax_enum_util_unittest.cc

View File

@ -5571,7 +5571,6 @@ FILE: ../../../flutter/shell/profiling/sampling_profiler.h
FILE: ../../../flutter/shell/version/version.cc
FILE: ../../../flutter/shell/version/version.h
FILE: ../../../flutter/shell/vmservice/empty.dart
FILE: ../../../flutter/sky/tools/roll/patches/chromium/android_build.patch
FILE: ../../../flutter/third_party/accessibility/base/color_utils.h
FILE: ../../../flutter/third_party/accessibility/base/compiler_specific.h
FILE: ../../../flutter/third_party/accessibility/base/container_utils.h

View File

@ -74,6 +74,7 @@ pylint-2.7 --rcfile=.pylintrc \
"build/" \
"ci/" \
"impeller/" \
"sky/" \
"tools/gn" \
"testing/"

View File

@ -13,7 +13,7 @@ import shutil
import subprocess
import sys
from create_xcframework import create_xcframework
from create_xcframework import create_xcframework # pylint: disable=import-error
DSYMUTIL = os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'buildtools', 'mac-x64',
@ -39,8 +39,8 @@ def main():
parser.add_argument('--arm64-out-dir', type=str, required=True)
parser.add_argument('--simulator-x64-out-dir', type=str, required=True)
parser.add_argument('--simulator-arm64-out-dir', type=str, required=False)
parser.add_argument('--strip', action="store_true", default=False)
parser.add_argument('--dsym', action="store_true", default=False)
parser.add_argument('--strip', action='store_true', default=False)
parser.add_argument('--dsym', action='store_true', default=False)
args = parser.parse_args()
@ -108,9 +108,10 @@ def main():
process_framework(args, dst, framework, framework_binary)
generate_gen_snapshot(args, dst, x64_out_dir, arm64_out_dir)
zip_archive(dst)
return 0
def create_framework(
def create_framework( # pylint: disable=too-many-arguments
args, dst, framework, arm64_framework, simulator_framework,
simulator_x64_framework, simulator_arm64_framework
):
@ -122,7 +123,7 @@ def create_framework(
return 1
if not os.path.isfile(simulator_x64_dylib):
print('Cannot find iOS simulator dylib at %s' % simulator_dylib)
print('Cannot find iOS simulator dylib at %s' % simulator_x64_dylib)
return 1
shutil.rmtree(framework, True)
@ -143,12 +144,12 @@ def create_framework(
process_framework(
args, dst, simulator_framework, simulator_framework_binary
)
simulator_framework = simulator_framework
else:
simulator_framework = simulator_x64_framework
# Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the
# x64 simulator framework if only that one exists.
# Create XCFramework from the arm-only fat framework and the arm64/x64
# simulator frameworks, or just the x64 simulator framework if only that one
# exists.
xcframeworks = [simulator_framework, framework]
create_xcframework(location=dst, name='Flutter', frameworks=xcframeworks)
@ -158,10 +159,12 @@ def create_framework(
framework_binary
])
return 0
def embed_codesign_configuration(config_path, contents):
with open(config_path, 'w') as f:
f.write('\n'.join(contents) + '\n')
with open(config_path, 'w') as file:
file.write('\n'.join(contents) + '\n')
def zip_archive(dst):
@ -189,7 +192,7 @@ def zip_archive(dst):
'without_entitlements.txt',
],
cwd=dst)
if (os.path.exists(os.path.join(dst, 'Flutter.dSYM'))):
if os.path.exists(os.path.join(dst, 'Flutter.dSYM')):
subprocess.check_call(['zip', '-r', 'Flutter.dSYM.zip', 'Flutter.dSYM'],
cwd=dst)
@ -204,7 +207,7 @@ def process_framework(args, dst, framework, framework_binary):
unstripped_out = os.path.join(dst, 'Flutter.unstripped')
shutil.copyfile(framework_binary, unstripped_out)
subprocess.check_call(["strip", "-x", "-S", framework_binary])
subprocess.check_call(['strip', '-x', '-S', framework_binary])
def generate_gen_snapshot(args, dst, x64_out_dir, arm64_out_dir):

View File

@ -10,7 +10,7 @@ import shutil
import sys
import os
from create_xcframework import create_xcframework
from create_xcframework import create_xcframework # pylint: disable=import-error
DSYMUTIL = os.path.join(
os.path.dirname(__file__), '..', '..', '..', 'buildtools', 'mac-x64',
@ -31,8 +31,8 @@ def main():
'--simulator-x64-out-dir', '--simulator-out-dir', type=str, required=True
)
parser.add_argument('--simulator-arm64-out-dir', type=str, required=False)
parser.add_argument('--strip', action="store_true", default=False)
parser.add_argument('--dsym', action="store_true", default=False)
parser.add_argument('--strip', action='store_true', default=False)
parser.add_argument('--dsym', action='store_true', default=False)
args = parser.parse_args()
@ -64,7 +64,7 @@ def main():
return 1
if not os.path.isfile(simulator_x64_dylib):
print('Cannot find iOS simulator dylib at %s' % simulator_dylib)
print('Cannot find iOS simulator dylib at %s' % simulator_x64_dylib)
return 1
if not os.path.isfile(DSYMUTIL):
@ -88,12 +88,12 @@ def main():
'-output', simulator_framework_binary
])
process_framework(args, simulator_framework, simulator_framework_binary)
simulator_framework = simulator_framework
else:
simulator_framework = simulator_x64_framework
# Create XCFramework from the arm-only fat framework and the arm64/x64 simulator frameworks, or just the
# x64 simulator framework if only that one exists.
# Create XCFramework from the arm-only fat framework and the arm64/x64
# simulator frameworks, or just the x64 simulator framework if only that one
# exists.
xcframeworks = [simulator_framework, framework]
create_xcframework(location=args.dst, name='Flutter', frameworks=xcframeworks)
@ -104,6 +104,7 @@ def main():
])
process_framework(args, framework, framework_binary)
return 0
def process_framework(args, framework, framework_binary):
@ -116,7 +117,7 @@ def process_framework(args, framework, framework_binary):
unstripped_out = os.path.join(args.dst, 'Flutter.unstripped')
shutil.copyfile(framework_binary, unstripped_out)
subprocess.check_call(["strip", "-x", "-S", framework_binary])
subprocess.check_call(['strip', '-x', '-S', framework_binary])
if __name__ == '__main__':

View File

@ -10,8 +10,6 @@ import shutil
import sys
import os
from create_xcframework import create_xcframework
buildroot_dir = os.path.abspath(
os.path.join(os.path.realpath(__file__), '..', '..', '..', '..')
)
@ -32,10 +30,10 @@ def main():
parser.add_argument('--dst', type=str, required=True)
parser.add_argument('--arm64-out-dir', type=str, required=True)
parser.add_argument('--x64-out-dir', type=str, required=True)
parser.add_argument('--strip', action="store_true", default=False)
parser.add_argument('--dsym', action="store_true", default=False)
parser.add_argument('--strip', action='store_true', default=False)
parser.add_argument('--dsym', action='store_true', default=False)
# TODO(godofredoc): Remove after recipes v2 have landed.
parser.add_argument('--zip', action="store_true", default=False)
parser.add_argument('--zip', action='store_true', default=False)
args = parser.parse_args()
@ -93,6 +91,8 @@ def main():
])
process_framework(dst, args, fat_framework, fat_framework_binary)
return 0
def regenerate_symlinks(fat_framework):
"""Regenerates the symlinks structure.
@ -142,7 +142,7 @@ def process_framework(dst, args, fat_framework, fat_framework_binary):
unstripped_out = os.path.join(dst, 'FlutterMacOS.unstripped')
shutil.copyfile(fat_framework_binary, unstripped_out)
subprocess.check_call(["strip", "-x", "-S", fat_framework_binary])
subprocess.check_call(['strip', '-x', '-S', fat_framework_binary])
# Zip FlutterMacOS.framework.
if args.zip:

View File

@ -24,7 +24,7 @@ def main():
parser.add_argument('--x64-out-dir', type=str)
parser.add_argument('--arm64-out-dir', type=str)
parser.add_argument('--armv7-out-dir', type=str)
parser.add_argument('--zip', action="store_true", default=False)
parser.add_argument('--zip', action='store_true', default=False)
args = parser.parse_args()

View File

@ -5,7 +5,6 @@
# found in the LICENSE file.
import argparse
import errno
import os
import shutil
import subprocess
@ -46,7 +45,8 @@ def create_xcframework(location, name, frameworks):
# Remove old xcframework.
shutil.rmtree(output_xcframework)
# xcrun xcodebuild -create-xcframework -framework foo/baz.framework -framework bar/baz.framework -output output/
# xcrun xcodebuild -create-xcframework -framework foo/baz.framework \
# -framework bar/baz.framework -output output/
command = ['xcrun', 'xcodebuild', '-quiet', '-create-xcframework']
for framework in frameworks:

View File

@ -8,7 +8,6 @@ import argparse
import errno
import os
import shutil
import subprocess
import sys
@ -31,10 +30,10 @@ def main():
# Remove old headers.
try:
shutil.rmtree(os.path.normpath(args.location))
except OSError as e:
except OSError as err:
# Ignore only "not found" errors.
if e.errno != errno.ENOENT:
raise e
if err.errno != errno.ENOENT:
raise err
# Create the directory to copy the files to.
if not os.path.isdir(args.location):

View File

@ -1,46 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import utils
def patch_and_filter(dest_dir, relative_patches_dir):
os.chdir(dest_dir)
utils.filter_file(
"build/landmines.py", lambda line: not "gyp_environment" in line
)
utils.commit("filter gyp_environment out of build/landmines.py")
patch(dest_dir, relative_patches_dir)
def patch(dest_dir, relative_patches_dir=os.curdir):
"""Applies the *.patch files in |relative_patches_dir|.
Args:
relative_patches_dir: A directory path relative to the current directory.
Defaults to the directory of this file.
Raises:
subprocess.CalledProcessError if the patch couldn't be applied.
"""
patches_dir = os.path.join(
os.path.dirname(os.path.realpath(__file__)), relative_patches_dir
)
assert os.path.isdir(patches_dir)
os.chdir(dest_dir)
for p in utils.find(["*.patch"], patches_dir):
print("applying patch %s" % os.path.basename(p))
try:
utils.system(["git", "apply", p])
utils.commit("applied patch %s" % os.path.basename(p))
except subprocess.CalledProcessError:
print("ERROR: patch %s failed to apply" % os.path.basename(p))
raise

View File

@ -1,33 +0,0 @@
--- a/build/android/pylib/constants/__init__.py
+++ b/build/android/pylib/constants/__init__.py
@@ -184,7 +184,7 @@ class ANDROID_SDK_VERSION_CODES(object):
LOLLIPOP_MR1 = 22
ANDROID_SDK_VERSION = ANDROID_SDK_VERSION_CODES.LOLLIPOP_MR1
-ANDROID_SDK_BUILD_TOOLS_VERSION = '22.0.0'
+ANDROID_SDK_BUILD_TOOLS_VERSION = '22.0.1'
ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT,
'third_party/android_tools/sdk')
ANDROID_SDK_TOOLS = os.path.join(ANDROID_SDK_ROOT,
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -1682,7 +1682,7 @@
'android_host_arch%': '<!(uname -m)',
# Android API-level of the SDK used for compilation.
'android_sdk_version%': '22',
- 'android_sdk_build_tools_version%': '22.0.0',
+ 'android_sdk_build_tools_version%': '22.0.1',
'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
},
# Copy conditionally-set variables out one scope.
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -17,7 +17,7 @@ if (is_android) {
if (!defined(default_android_sdk_root)) {
default_android_sdk_root = "//third_party/android_tools/sdk"
default_android_sdk_version = "22"
- default_android_sdk_build_tools_version = "22.0.0"
+ default_android_sdk_build_tools_version = "22.0.1"
}
if (!defined(google_play_services_library)) {

View File

@ -1,173 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import json
import os
import subprocess
import sys
import urllib.request, urllib.error, urllib.parse
from utils import commit
from utils import system
import patch
# //base and its dependencies
_base_deps = [
'base',
'testing',
'third_party/ashmem',
'third_party/libevent',
'third_party/tcmalloc',
]
# //build and its dependencies
_build_deps = [
'build',
'third_party/android_testrunner',
'third_party/binutils',
'third_party/instrumented_libraries',
'third_party/pymock',
'tools/android',
'tools/clang',
'tools/generate_library_loader',
'tools/gritsettings',
'tools/valgrind',
]
_third_party_deps = [
'third_party/android_platform',
'third_party/apple_apsl',
'third_party/expat',
'third_party/freetype-android',
'third_party/harfbuzz-ng',
'third_party/iccjpeg',
'third_party/jinja2',
'third_party/jsr-305',
'third_party/junit',
'third_party/libjpeg',
'third_party/libpng',
'third_party/markupsafe',
'third_party/mesa',
'third_party/mockito',
'third_party/ply',
'third_party/qcms',
'third_party/robolectric',
'third_party/zlib',
]
dirs_from_chromium = _base_deps + _build_deps + _third_party_deps
dirs_from_mojo = [
'mojo/android',
'mojo/application',
'mojo/common',
('mojo/dart/embedder', ['embedder.gni']),
'mojo/dart/packages/mojo',
'mojo/data_pipe_utils',
'mojo/edk',
'mojo/environment',
'mojo/java',
'mojo/message_pump',
'mojo/services',
'mojo/skia',
'services/sensors',
]
# The contents of these files before the roll will be preserved after the roll,
# even though they live in directories rolled in from Chromium.
files_not_to_roll = [
'build/config/ui.gni',
'build/ls.py',
'build/module_args/mojo.gni',
'tools/android/download_android_tools.py',
'tools/android/VERSION_LINUX_NDK',
'tools/android/VERSION_LINUX_SDK',
'tools/android/VERSION_MACOSX_NDK',
'tools/android/VERSION_MACOSX_SDK',
]
def rev(source_dir, dest_dir, dirs_to_rev, name, revision_file=None):
for dir_to_rev in dirs_to_rev:
if type(dir_to_rev) is tuple:
d, file_subset = dir_to_rev
else:
d = dir_to_rev
file_subset = None
print("removing directory %s" % d)
try:
system(["git", "rm", "-r", d], cwd=dest_dir)
except subprocess.CalledProcessError:
print("Could not remove %s" % d)
print("cloning directory %s" % d)
if file_subset is None:
files = system(["git", "ls-files", d], cwd=source_dir).splitlines()
else:
files = [os.path.join(d, f) for f in file_subset]
for f in files:
source_path = os.path.join(source_dir, f)
if not os.path.isfile(source_path):
continue
dest_path = os.path.join(dest_dir, f)
system(["mkdir", "-p", os.path.dirname(dest_path)], cwd=source_dir)
system(["cp", source_path, dest_path], cwd=source_dir)
system(["git", "add", d], cwd=dest_dir)
for f in files_not_to_roll:
system(["git", "checkout", "HEAD", f], cwd=dest_dir)
src_commit = system(["git", "rev-parse", "HEAD"], cwd=source_dir).strip()
if revision_file:
with open(revision_file, 'w') as f:
f.write(src_commit)
system(["git", "add", "."], cwd=dest_dir)
commit("Update to %s %s" % (name, src_commit), cwd=dest_dir)
def main():
parser = argparse.ArgumentParser(
description="Update the mojo repo's " +
"snapshot of things imported from chromium."
)
parser.add_argument("--mojo-dir", type=str)
parser.add_argument("--chromium-dir", type=str)
parser.add_argument("--dest-dir", type=str)
args = parser.parse_args()
dest_dir = os.path.abspath(args.dest_dir)
if args.mojo_dir:
rev(
os.path.abspath(args.mojo_dir),
dest_dir,
dirs_from_mojo,
'mojo',
revision_file='mojo/VERSION'
)
if args.chromium_dir:
rev(
os.path.abspath(args.chromium_dir), dest_dir, dirs_from_chromium,
'chromium'
)
try:
patch.patch_and_filter(dest_dir, os.path.join('patches', 'chromium'))
except subprocess.CalledProcessError:
print("ERROR: Roll failed due to a patch not applying")
print("Fix the patch to apply, commit the result, and re-run this script")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@ -1,34 +0,0 @@
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import fnmatch
import os
import subprocess
def commit(message, cwd=None):
subprocess.call(['git', 'commit', '-a', '-m', message], cwd=cwd)
def system(command, cwd=None):
return subprocess.check_output(command, cwd=cwd)
def find(patterns, start='.'):
for path, dirs, files in os.walk(start):
for basename in files + dirs:
if any([fnmatch.fnmatch(basename, pattern) for pattern in patterns]):
filename = os.path.join(path, basename)
yield filename
def filter_file(path, predicate):
with open(path, 'r+') as f:
lines = f.readlines()
new_lines = [line for line in lines if predicate(line)]
f.seek(0)
f.truncate()
f.write(''.join(new_lines))