mirror of
https://github.com/maubot/maubot
synced 2025-08-29 21:20:37 +00:00
Support custom licenses
This commit is contained in:
parent
fe4d2f02bb
commit
bd351b71fe
2 changed files with 7 additions and 2 deletions
|
@ -88,6 +88,9 @@ def init(name: str, id: str, version: Version, license: str, config: bool) -> No
|
||||||
file.write(meta)
|
file.write(meta)
|
||||||
if license:
|
if license:
|
||||||
with open("LICENSE", "w") as file:
|
with open("LICENSE", "w") as file:
|
||||||
|
if license.startswith("LicenseRef-"):
|
||||||
|
file.write("** You must include the license text here **")
|
||||||
|
else:
|
||||||
file.write(spdx.get(license)["licenseText"])
|
file.write(spdx.get(license)["licenseText"])
|
||||||
if not os.path.isdir(name):
|
if not os.path.isdir(name):
|
||||||
os.mkdir(name)
|
os.mkdir(name)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
@ -42,4 +43,5 @@ def get(id: str) -> dict[str, str]:
|
||||||
def valid(id: str) -> bool:
|
def valid(id: str) -> bool:
|
||||||
if not spdx_list:
|
if not spdx_list:
|
||||||
load()
|
load()
|
||||||
return id in spdx_list
|
custom_license = re.compile('LicenseRef-[a-zA-Z0-9.-]*$')
|
||||||
|
return bool(custom_license.match(id)) or id in spdx_list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue