From df48e446b04ce0272a7d0c9e0a70dc5cedb07076 Mon Sep 17 00:00:00 2001 From: Didip Kerabat Date: Fri, 8 Apr 2022 04:13:17 -0700 Subject: [PATCH] Fix the other 2 python scripts that generates license. (#12340) Fixes YAML.load_all issues on two of the Python scripts that generate license. The broken Python files interfere with some of the Maven tasks. --- distribution/bin/generate-binary-license.py | 8 ++++---- distribution/bin/generate-binary-notice.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/distribution/bin/generate-binary-license.py b/distribution/bin/generate-binary-license.py index e69bc7025e9..ec564e13b46 100755 --- a/distribution/bin/generate-binary-license.py +++ b/distribution/bin/generate-binary-license.py @@ -102,7 +102,7 @@ def print_license(license): license_phrase += "see {}".format(each_file) else: license_phrase += ", {}".format(each_file) - + license_phrase += "." print_license_phrase(license_phrase) @@ -133,11 +133,11 @@ def print_license_name_underbar(license_name): def generate_license(apache_license_v2, license_yaml): print_log_to_stderr("=== Generating the contents of LICENSE.BINARY file ===\n") - + # Print Apache license first. print_outfile(apache_license_v2) with open(license_yaml, encoding='utf-8') as registry_file: - licenses_list = list(yaml.load_all(registry_file)) + licenses_list = list(yaml.load_all(registry_file, Loader=yaml.Loader)) # Group licenses by license_name, license_category, and then module. licenses_map = {} @@ -172,7 +172,7 @@ if __name__ == "__main__": parser.add_argument('license_yaml', metavar='', type=str) parser.add_argument('out_path', metavar='', type=str) args = parser.parse_args() - + with open(args.apache_license, encoding="ascii") as apache_license_file: apache_license_v2 = apache_license_file.read() license_yaml = args.license_yaml diff --git a/distribution/bin/generate-binary-notice.py b/distribution/bin/generate-binary-notice.py index a7778812b92..00f0c1f73d6 100755 --- a/distribution/bin/generate-binary-notice.py +++ b/distribution/bin/generate-binary-notice.py @@ -57,7 +57,7 @@ def generate_notice(source_notice, dependences_yaml): # Print Apache license first. print_outfile(source_notice) with open(dependences_yaml, encoding='utf-8') as registry_file: - dependencies = list(yaml.load_all(registry_file)) + dependencies = list(yaml.load_all(registry_file, Loader=yaml.Loader)) # Group dependencies by module modules_map = defaultdict(list)