Fix license in mbc iit

This commit is contained in:
Tulir Asokan 2019-02-13 18:27:46 +02:00
parent f548e17c80
commit 3068245b1f
2 changed files with 4 additions and 3 deletions

View File

@ -76,7 +76,7 @@ class VersionValidator(ClickValidator):
def spdx(val: str) -> str: def spdx(val: str) -> str:
if spdxlib.valid(val): if not spdxlib.valid(val):
raise click.BadParameter(f"{val} is not a valid SPDX license identifier") raise click.BadParameter(f"{val} is not a valid SPDX license identifier")
return val return val

View File

@ -57,8 +57,9 @@ def init(name: str, id: str, version: Version, license: str, config: bool) -> No
main_class=main_class) main_class=main_class)
with open("maubot.yaml", "w") as file: with open("maubot.yaml", "w") as file:
file.write(meta) file.write(meta)
with open("LICENSE", "w") as file: if license:
file.write(spdx.get(license)["text"]) with open("LICENSE", "w") as file:
file.write(spdx.get(license)["text"])
if not os.path.isdir(name): if not os.path.isdir(name):
os.mkdir(name) os.mkdir(name)
mod = mod_template.render(config=config, name=main_class) mod = mod_template.render(config=config, name=main_class)