ccaominh commented on a change in pull request #8306: autogenerate 
NOTICE.BINARY from NOTICE and licenses.yaml
URL: https://github.com/apache/incubator-druid/pull/8306#discussion_r314421850
 
 

 ##########
 File path: docs/_bin/generate-notice-binary.py
 ##########
 @@ -0,0 +1,94 @@
+#!/usr/bin/env python3
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import argparse
+import sys
+import yaml
+
+
+outfile = sys.stdout
+
+
+moduleHeaderLine = "############"
+dependencyHeaderLine = "================="
+
+def print_outfile(string):
+    print(string, file=outfile)
+
+def print_error(string):
+    print(string, file=sys.stderr)
+
+def print_jar(name, version, notice):
+    print_outfile("{} {}-{}.jar {}".format(dependencyHeaderLine, name, 
version, dependencyHeaderLine))
+    print_outfile("{}\n\n\n\n".format(notice))
+
+def print_notice(dependency):
+    if 'notice' in dependency:
+        print_outfile("{} {} {} {}".format(dependencyHeaderLine, 
dependency['name'], dependency['version'], dependencyHeaderLine))
+        if 'libraries' in dependency:
+            for library in dependency['libraries']:
+                for group_id, artifact_id in library.items():
+                    print_outfile("{}.jar".format(artifact_id))
+            print_outfile("{}\n".format(dependencyHeaderLine))
+        print_outfile("{}\n\n\n\n".format(dependency['notice']))
+    elif 'notices' in dependency:
+        for notice_entry in dependency['notices']:
+            for jar, notice in notice_entry.items():
+                print_jar(jar, dependency['version'], notice)
+
+
+def generate_notice(source_notice, dependences_yaml):
+    # Generate NOTICE.BINARY file
 
 Review comment:
   This comment is redundant with the message string on the next line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to