[Impeller] Remove check_licenses.py (flutter/engine#52970)

I could not find any users of this. As I understand, this was from a time [when Impeller wasn't a part of the
engine](https://github.com/flutter/flutter/issues/97686). Now the engine licenses checkers are sufficient.
This commit is contained in:
Chinmay Garde
2024-05-21 14:16:22 -07:00
committed by GitHub
parent 0c370f2f09
commit 740b05b784
2 changed files with 0 additions and 77 deletions

View File

@@ -202,7 +202,6 @@
../../../flutter/impeller/tessellator/tessellator_unittests.cc
../../../flutter/impeller/toolkit/android/README.md
../../../flutter/impeller/toolkit/android/toolkit_android_unittests.cc
../../../flutter/impeller/tools/check_licenses.py
../../../flutter/impeller/tools/malioc_cores.py
../../../flutter/impeller/tools/malioc_diff.py
../../../flutter/impeller/tools/metal_library.py

View File

@@ -1,76 +0,0 @@
# 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 os
def contains_license_block(source_file):
# This check is somewhat easier than in the engine because all sources need to
# have the same license.
py_license = """# 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."""
c_license = py_license.replace('#', '//')
# Make sure we don't read the entire file into memory.
read_size = (max(len(py_license), len(c_license)))
for lic in [c_license, py_license]:
with open(source_file) as source:
if source.read(read_size).startswith(lic):
return True
return False
def is_source_file(path):
known_extensions = [
'.cc',
'.cpp',
'.c',
'.h',
'.hpp',
'.py',
'.sh',
'.gn',
'.gni',
'.glsl',
'.sl.h',
'.vert',
'.frag',
'.tesc',
'.tese',
'.yaml',
'.dart',
]
for extension in known_extensions:
if os.path.basename(path).endswith(extension):
return True
return False
# Checks that all source files have the same license preamble.
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--source-root', type=str, required=True, help='The source root.')
args = parser.parse_args()
assert os.path.exists(args.source_root)
source_files = set()
for root, _, files in os.walk(os.path.abspath(args.source_root)):
for file in files:
file_path = os.path.join(root, file)
if is_source_file(file_path):
source_files.add(file_path)
for source_file in source_files:
if not contains_license_block(source_file):
raise Exception('Could not find valid license block in source ', source_file)
if __name__ == '__main__':
main()