You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/03/01 11:48:51 UTC

[GitHub] [incubator-seatunnel] zhongjiajie commented on a change in pull request #1210: [Feature] [ci] Automatically generate LICENSE

zhongjiajie commented on a change in pull request #1210:
URL: https://github.com/apache/incubator-seatunnel/pull/1210#discussion_r816699022



##########
File path: bin/license.py
##########
@@ -0,0 +1,376 @@
+#!/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 os
+import sys
+
+if len(sys.argv) - 1 != 3:
+    print("The length of arguments should be 2!")
+    print("The first argument should be the path to the THIRD-PARTY.txt file.")
+    print("The second argument should be the path to the LICENSE file.")
+    print("The third argument should be a flag that controls whether to print the diff or change the LICENSE file.")
+    exit(-1)
+
+third_party = sys.argv[1]
+license = sys.argv[2]
+print_diff = sys.argv[3]
+
+with open(third_party, "r") as f:
+    licenses = f.readlines()
+
+licenses_keyword_map = {
+    "Apache 2.0 License": ["Apache", "APL2"],
+    "MIT License": ["MIT"],
+    "BSD License": ["BSD"],
+    "CC0-1.0 License": ["CC0"],
+    "CDDL License": ["CDDL"],
+    "Eclipse Public License": ["Eclipse"],
+    "Public Domain License": ["Public Domain"],
+    "Mozilla Public License Version 2.0": ["Mozilla Public License"],
+    "Go License": ["The Go license"],
+    "Unicode License": ["Unicode/ICU License"]
+}
+unknown_licenses_map = {
+    "commons-beanutils:commons-beanutils:1.7.0": "(Apache License, Version 2.0) Apache Commons BeanUtils (commons-beanutils:commons-beanutils:1.7.0 - https://commons.apache.org/proper/commons-beanutils/)",
+    "commons-pool:commons-pool:1.5.4": "(The Apache Software License, Version 2.0) Commons Pool (commons-pool:commons-pool:1.5.4 - http://commons.apache.org/pool/)",
+    "org.antlr:antlr-runtime:3.4": "(BSD licence) ANTLR 3 Runtime (org.antlr:antlr-runtime:3.4 - http://www.antlr.org)",
+    "javax.transaction:jta:1.1": "(CDDL + GPLv2 with classpath exception) Java Transaction API (javax.transaction:jta:1.1 - http://java.sun.com/products/jta)",
+    "javax.servlet.jsp:jsp-api:2.1": "(CDDL + GPLv2 with classpath exception) Java Servlet API (javax.servlet.jsp:jsp-api:2.1 - https://javaee.github.io/javaee-jsp-api)",
+    "javax.servlet:servlet-api:2.5": "(CDDL + GPLv2 with classpath exception) Java Servlet API (javax.servlet:servlet-api:2.5 - http://servlet-spec.java.net)",
+    "oro:oro:2.0.8": "(Apache License, Version 1.1) ORO (oro:oro:2.0.8 - https://mvnrepository.com/artifact/oro/oro)",
+    "org.hyperic:sigar:1.6.5.132": "(Apache License, Version 2.0) Sigar (org.hyperic:sigar:1.6.5.132 - https://github.com/hyperic/sigar)"
+}
+licenses_describe_map = {
+    "Apache 2.0 License":
+        """The following components are provided under the Apache License. See project link for details.
+The text of each license is the standard Apache 2.0 license.
+""",
+    "MIT License": """The following components are provided under the MIT License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "BSD License": """The following components are provided under a BSD license. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "CC0-1.0 License": """The following components are provided under the CC0-1.0 License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "CDDL License": """The following components are provided under the CDDL License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Eclipse Public License": """The following components are provided under the Eclipse Public License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Public Domain License": """The following components are provided under the Public Domain License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Mozilla Public License Version 2.0": """The following components are provided under the Mozilla Public License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Unicode License": """The following components are provided under the Unicode License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Go License": """The following components are provided under the Go License. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+""",
+    "Other License": """The following components are provided under some minority Licenses. See project link for details.
+The text of each license is also included at licenses/LICENSE-[project].txt.
+"""
+}
+licenses_map = {
+    "Apache 2.0 License": [],
+    "MIT License": [],
+    "BSD License": [],
+    "CC0-1.0 License": [],
+    "CDDL License": [],
+    "Eclipse Public License": [],
+    "Public Domain License": [],
+    "Mozilla Public License Version 2.0": [],
+    "Unicode License": [],
+    "Go License": [],
+    "Other License": []
+}
+
+for _ in licenses:

Review comment:
       > I think `_` is usually used for unused variables, why do you think using `_` is easier maintain?
   
   Yeah, the best practices is for unused variables or for list/tuple comprehension




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org