[libcalamares] update SPDX licensing on generated files
- the scripts are BSD-2-clause, - the generated files are CC0 (I'm not *100%* sure about the derived file CountryData_p.cpp, which lists countries and country codes -- it **is** extracted from CLDR data which is not CC0)
This commit is contained in:
parent
4a3378d8b9
commit
296146e4f8
@ -2,7 +2,13 @@
|
|||||||
*
|
*
|
||||||
* === This file is part of Calamares - <https://github.com/calamares> ===
|
* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* This file is derived from CLDR data from Unicode, Inc. Applicable terms:
|
* SPDX-FileCopyrightText: 1991-2019 Unicode, Inc.
|
||||||
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: CC0
|
||||||
|
*
|
||||||
|
* This file is derived from CLDR data from Unicode, Inc. Applicable terms
|
||||||
|
* are listed at http://unicode.org/copyright.html , of which the most
|
||||||
|
* important are:
|
||||||
*
|
*
|
||||||
* A. Unicode Copyright
|
* A. Unicode Copyright
|
||||||
* 1. Copyright © 1991-2019 Unicode, Inc. All rights reserved.
|
* 1. Copyright © 1991-2019 Unicode, Inc. All rights reserved.
|
||||||
@ -10,6 +16,11 @@
|
|||||||
* Unicode Data Files ("DATA FILES") include all data files under the directories:
|
* Unicode Data Files ("DATA FILES") include all data files under the directories:
|
||||||
* https://www.unicode.org/Public/
|
* https://www.unicode.org/Public/
|
||||||
* C. Terms of Use
|
* C. Terms of Use
|
||||||
|
* 1. Certain documents and files on this website contain a legend indicating
|
||||||
|
* that "Modification is permitted." Any person is hereby authorized,
|
||||||
|
* without fee, to modify such documents and files to create derivative
|
||||||
|
* works conforming to the Unicode® Standard, subject to Terms and
|
||||||
|
* Conditions herein.
|
||||||
* 2. Any person is hereby authorized, without fee, to view, use, reproduce,
|
* 2. Any person is hereby authorized, without fee, to view, use, reproduce,
|
||||||
* and distribute all documents and files, subject to the Terms and
|
* and distribute all documents and files, subject to the Terms and
|
||||||
* Conditions herein.
|
* Conditions herein.
|
||||||
|
@ -1,26 +1,8 @@
|
|||||||
/* GENERATED FILE DO NOT EDIT
|
/* GENERATED FILE DO NOT EDIT
|
||||||
*
|
*
|
||||||
* === This file is part of Calamares - <https://github.com/calamares> ===
|
* SPDX-FileCopyrightText: 2009 Arthur David Olson
|
||||||
*
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
* SPDX-License-Identifier: CC0
|
||||||
*
|
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Calamares is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
* License-Filename: LICENSE
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
*
|
||||||
* This file is derived from zone.tab, which has its own copyright statement:
|
* This file is derived from zone.tab, which has its own copyright statement:
|
||||||
*
|
*
|
||||||
|
@ -1,45 +1,9 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
#
|
#
|
||||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
# License-Filename: LICENSES/BSD2
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Python3 script to scrape some data out of ICU CLDR supplemental data.
|
|
||||||
#
|
|
||||||
### BEGIN LICENSES
|
|
||||||
#
|
|
||||||
# Copyright 2019 Adriaan de Groot <groot@kde.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
### END LICENSES
|
|
||||||
|
|
||||||
### BEGIN USAGE
|
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
Python3 script to scrape some data out of ICU CLDR supplemental data.
|
Python3 script to scrape some data out of ICU CLDR supplemental data.
|
||||||
@ -126,7 +90,7 @@ class CountryData:
|
|||||||
self.country_code = ""
|
self.country_code = ""
|
||||||
self.language_enum = "AnyLanguage"
|
self.language_enum = "AnyLanguage"
|
||||||
self.country_enum = "AnyCountry"
|
self.country_enum = "AnyCountry"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.country_code:
|
if self.country_code:
|
||||||
char0 = "'{!s}'".format(self.country_code[0])
|
char0 = "'{!s}'".format(self.country_code[0])
|
||||||
@ -134,18 +98,18 @@ class CountryData:
|
|||||||
else:
|
else:
|
||||||
char0 = "0"
|
char0 = "0"
|
||||||
char1 = "0"
|
char1 = "0"
|
||||||
|
|
||||||
return "{!s} QLocale::Language::{!s}, QLocale::Country::{!s}, {!s}, {!s} {!s},".format(
|
return "{!s} QLocale::Language::{!s}, QLocale::Country::{!s}, {!s}, {!s} {!s},".format(
|
||||||
"{",
|
"{",
|
||||||
self.language_enum,
|
self.language_enum,
|
||||||
self.country_enum,
|
self.country_enum,
|
||||||
char0,
|
char0,
|
||||||
char1,
|
char1,
|
||||||
"}")
|
"}")
|
||||||
|
|
||||||
# Must match type name below
|
# Must match type name below
|
||||||
cpp_classname = "CountryData"
|
cpp_classname = "CountryData"
|
||||||
|
|
||||||
# Must match the output format of __str__ above
|
# Must match the output format of __str__ above
|
||||||
cpp_declaration = """
|
cpp_declaration = """
|
||||||
struct CountryData
|
struct CountryData
|
||||||
@ -169,30 +133,30 @@ def extricate_subtags(l1, l2):
|
|||||||
return
|
return
|
||||||
if '{ ?; ?;' not in l2:
|
if '{ ?; ?;' not in l2:
|
||||||
return
|
return
|
||||||
|
|
||||||
# This is extremely crude "parsing" which chops up the string
|
# This is extremely crude "parsing" which chops up the string
|
||||||
# by delimiter and then extracts some substring.
|
# by delimiter and then extracts some substring.
|
||||||
l1_parts = l1.split("und_")
|
l1_parts = l1.split("und_")
|
||||||
l2_parts = l2.split(";")
|
l2_parts = l2.split(";")
|
||||||
|
|
||||||
l1_first_quote = l1_parts[1].find('"')
|
l1_first_quote = l1_parts[1].find('"')
|
||||||
l1_code = l1_parts[1][:l1_first_quote]
|
l1_code = l1_parts[1][:l1_first_quote]
|
||||||
if len(l1_code) != 2:
|
if len(l1_code) != 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
l2_brace = l2_parts[2].find("{")
|
l2_brace = l2_parts[2].find("{")
|
||||||
l2_language = l2_parts[2][l2_brace+1:].strip()
|
l2_language = l2_parts[2][l2_brace+1:].strip()
|
||||||
l2_brace = l2_parts[2].find("}")
|
l2_brace = l2_parts[2].find("}")
|
||||||
l2_country = l2_parts[2][:l2_brace-1].strip()
|
l2_country = l2_parts[2][:l2_brace-1].strip()
|
||||||
|
|
||||||
# Handle mapped cases
|
# Handle mapped cases
|
||||||
l2_language = language_mapper.get(l2_language, l2_language)
|
l2_language = language_mapper.get(l2_language, l2_language)
|
||||||
l2_language = l2_language.replace(" ", "")
|
l2_language = l2_language.replace(" ", "")
|
||||||
|
|
||||||
# Handle mapped cases and then do a bunch of standard replacements.
|
# Handle mapped cases and then do a bunch of standard replacements.
|
||||||
l2_country = country_mapper.get(l2_country, l2_country)
|
l2_country = country_mapper.get(l2_country, l2_country)
|
||||||
l2_country = l2_country.replace(" ", "").replace("-", "").replace(".","").replace("&","And")
|
l2_country = l2_country.replace(" ", "").replace("-", "").replace(".","").replace("&","And")
|
||||||
|
|
||||||
return CountryData(l1_code, l2_language, l2_country)
|
return CountryData(l1_code, l2_language, l2_country)
|
||||||
|
|
||||||
|
|
||||||
@ -213,7 +177,7 @@ def read_subtags_file():
|
|||||||
if l1:
|
if l1:
|
||||||
assert "likelySubtag" in l1, l1;
|
assert "likelySubtag" in l1, l1;
|
||||||
assert "<!--" in l2, l2;
|
assert "<!--" in l2, l2;
|
||||||
|
|
||||||
data.append(extricate_subtags(l1, l2))
|
data.append(extricate_subtags(l1, l2))
|
||||||
|
|
||||||
data.append(CountryData("", None, None))
|
data.append(CountryData("", None, None))
|
||||||
@ -224,7 +188,13 @@ cpp_header_comment = """/* GENERATED FILE DO NOT EDIT
|
|||||||
*
|
*
|
||||||
* === This file is part of Calamares - <https://github.com/calamares> ===
|
* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* This file is derived from CLDR data from Unicode, Inc. Applicable terms:
|
* SPDX-FileCopyrightText: 1991-2019 Unicode, Inc.
|
||||||
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: CC0
|
||||||
|
*
|
||||||
|
* This file is derived from CLDR data from Unicode, Inc. Applicable terms
|
||||||
|
* are listed at http://unicode.org/copyright.html , of which the most
|
||||||
|
* important are:
|
||||||
*
|
*
|
||||||
* A. Unicode Copyright
|
* A. Unicode Copyright
|
||||||
* 1. Copyright © 1991-2019 Unicode, Inc. All rights reserved.
|
* 1. Copyright © 1991-2019 Unicode, Inc. All rights reserved.
|
||||||
@ -232,6 +202,11 @@ cpp_header_comment = """/* GENERATED FILE DO NOT EDIT
|
|||||||
* Unicode Data Files ("DATA FILES") include all data files under the directories:
|
* Unicode Data Files ("DATA FILES") include all data files under the directories:
|
||||||
* https://www.unicode.org/Public/
|
* https://www.unicode.org/Public/
|
||||||
* C. Terms of Use
|
* C. Terms of Use
|
||||||
|
* 1. Certain documents and files on this website contain a legend indicating
|
||||||
|
* that "Modification is permitted." Any person is hereby authorized,
|
||||||
|
* without fee, to modify such documents and files to create derivative
|
||||||
|
* works conforming to the Unicode® Standard, subject to Terms and
|
||||||
|
* Conditions herein.
|
||||||
* 2. Any person is hereby authorized, without fee, to view, use, reproduce,
|
* 2. Any person is hereby authorized, without fee, to view, use, reproduce,
|
||||||
* and distribute all documents and files, subject to the Terms and
|
* and distribute all documents and files, subject to the Terms and
|
||||||
* Conditions herein.
|
* Conditions herein.
|
||||||
@ -259,17 +234,17 @@ def make_identifier(classname):
|
|||||||
identifier.extend(["_", c.lower()])
|
identifier.extend(["_", c.lower()])
|
||||||
else:
|
else:
|
||||||
identifier.append(c)
|
identifier.append(c)
|
||||||
|
|
||||||
return "".join(identifier)
|
return "".join(identifier)
|
||||||
|
|
||||||
|
|
||||||
def export_class(cls, data):
|
def export_class(cls, data):
|
||||||
"""
|
"""
|
||||||
Given a @p cls and a list of @p data objects from that class,
|
Given a @p cls and a list of @p data objects from that class,
|
||||||
print (to stdout) a C++ file for that data.
|
print (to stdout) a C++ file for that data.
|
||||||
"""
|
"""
|
||||||
identifier = make_identifier(cls.cpp_classname)
|
identifier = make_identifier(cls.cpp_classname)
|
||||||
|
|
||||||
with open("{!s}_p.cpp".format(cls.cpp_classname), "wt", encoding="UTF-8") as f:
|
with open("{!s}_p.cpp".format(cls.cpp_classname), "wt", encoding="UTF-8") as f:
|
||||||
f.write(cpp_header_comment)
|
f.write(cpp_header_comment)
|
||||||
f.write(cls.cpp_declaration)
|
f.write(cls.cpp_declaration)
|
||||||
@ -290,7 +265,7 @@ def export_class(cls, data):
|
|||||||
identifier,
|
identifier,
|
||||||
cls.cpp_classname))
|
cls.cpp_classname))
|
||||||
f.write(cpp_footer_comment)
|
f.write(cpp_footer_comment)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
export_class(CountryData, read_subtags_file())
|
export_class(CountryData, read_subtags_file())
|
||||||
|
@ -1,44 +1,9 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
#
|
#
|
||||||
# === This file is part of Calamares - <https://github.com/calamares> ===
|
# === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
# License-Filename: LICENSES/BSD2
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Python3 script to scrape some data out of zoneinfo/zone.tab.
|
|
||||||
#
|
|
||||||
### BEGIN LICENSES
|
|
||||||
#
|
|
||||||
# Copyright 2019 Adriaan de Groot <groot@kde.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
#
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
### END LICENSES
|
|
||||||
|
|
||||||
### BEGIN USAGE
|
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
Python3 script to scrape some data out of zoneinfo/zone.tab.
|
Python3 script to scrape some data out of zoneinfo/zone.tab.
|
||||||
@ -56,15 +21,15 @@ def scrape_file(file, regionset, zoneset):
|
|||||||
parts = line.split("\t")
|
parts = line.split("\t")
|
||||||
if len(parts) < 3:
|
if len(parts) < 3:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
zoneid = parts[2]
|
zoneid = parts[2]
|
||||||
if not "/" in zoneid:
|
if not "/" in zoneid:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
region, zone = zoneid.split("/", 1)
|
region, zone = zoneid.split("/", 1)
|
||||||
|
|
||||||
zone = zone.strip().replace("_", " ")
|
zone = zone.strip().replace("_", " ")
|
||||||
|
|
||||||
regionset.add(region)
|
regionset.add(region)
|
||||||
assert(zone not in zoneset)
|
assert(zone not in zoneset)
|
||||||
zoneset.add(zone)
|
zoneset.add(zone)
|
||||||
@ -76,11 +41,15 @@ def write_set(file, label, set):
|
|||||||
for x in sorted(set):
|
for x in sorted(set):
|
||||||
file.write("""\t\tQObject::tr("{!s}", "{!s}"),\n""".format(x, label))
|
file.write("""\t\tQObject::tr("{!s}", "{!s}"),\n""".format(x, label))
|
||||||
file.write("\t\tQString()\n\t};\n}\n\n")
|
file.write("\t\tQString()\n\t};\n}\n\n")
|
||||||
|
|
||||||
cpp_header_comment = """/* GENERATED FILE DO NOT EDIT
|
cpp_header_comment = """/* GENERATED FILE DO NOT EDIT
|
||||||
*
|
*
|
||||||
* === This file is part of Calamares - <https://github.com/calamares> ===
|
* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2009 Arthur David Olson
|
||||||
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: CC0
|
||||||
|
*
|
||||||
* This file is derived from zone.tab, which has its own copyright statement:
|
* This file is derived from zone.tab, which has its own copyright statement:
|
||||||
*
|
*
|
||||||
* This file is in the public domain, so clarified as of
|
* This file is in the public domain, so clarified as of
|
||||||
@ -111,4 +80,4 @@ if __name__ == "__main__":
|
|||||||
f.write(cpp_header_comment)
|
f.write(cpp_header_comment)
|
||||||
write_set(f, "tz_regions", regions)
|
write_set(f, "tz_regions", regions)
|
||||||
write_set(f, "tz_names", zones)
|
write_set(f, "tz_names", zones)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user