Files
MapLibreParticleLab/scripts/generate-license.py
2019-10-09 19:31:40 +02:00

40 lines
1.6 KiB
Python

#!/usr/bin/python
import os
import json
path = os.getcwd()
with open(path + "/LICENSE.md", 'w') as licenseFile:
licenseFile.write("<!-- This file was generated. Use `make android-license` to update. --> \n")
licenseFile.write("## Additional Mapbox GL licenses \n")
with open(path + "/MapboxGLAndroidSDK/build/reports/licenses/licenseReleaseReport.json", 'r') as dataFile:
data = json.load(dataFile)
gradleLicensePlugin ="""
{
"project": "Gradle License Plugin",
"url": "https://github.com/jaredsburrows/gradle-license-plugin",
"licenses": [
{
"license": "The Apache Software License, Version 2.0",
"license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
]
}
"""
data.append(json.loads(gradleLicensePlugin))
licenseName = ""
licenseUrl = ""
for entry in data:
projectName = entry["project"]
projectUrl = entry["url"]
for license in entry["licenses"]:
licenseName = license["license"]
licenseUrl = license["license_url"]
licenseFile.write("Mapbox GL uses portions of the %s. \n" % projectName +
("URL: [%s](%s) \n" % (projectUrl, projectUrl) if projectUrl is not None else "") +
"License: [%s](%s)" % (licenseName, licenseUrl) +
"\n\n===========================================================================\n\n")