mirror of
https://github.com/maubot/maubot
synced 2025-08-29 01:10: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,7 +88,10 @@ def init(name: str, id: str, version: Version, license: str, config: bool) -> No
|
|||
file.write(meta)
|
||||
if license:
|
||||
with open("LICENSE", "w") as file:
|
||||
file.write(spdx.get(license)["licenseText"])
|
||||
if license.startswith("LicenseRef-"):
|
||||
file.write("** You must include the license text here **")
|
||||
else:
|
||||
file.write(spdx.get(license)["licenseText"])
|
||||
if not os.path.isdir(name):
|
||||
os.mkdir(name)
|
||||
mod = mod_template.render(config=config, name=main_class)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
import zipfile
|
||||
|
||||
import pkg_resources
|
||||
|
@ -42,4 +43,5 @@ def get(id: str) -> dict[str, str]:
|
|||
def valid(id: str) -> bool:
|
||||
if not spdx_list:
|
||||
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