From 3068245b1fb0513637d0cea763bccd2c15ccc833 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 13 Feb 2019 18:27:46 +0200 Subject: [PATCH] Fix license in mbc iit --- maubot/cli/cliq/validators.py | 2 +- maubot/cli/commands/init.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/maubot/cli/cliq/validators.py b/maubot/cli/cliq/validators.py index 99618b9..2a98252 100644 --- a/maubot/cli/cliq/validators.py +++ b/maubot/cli/cliq/validators.py @@ -76,7 +76,7 @@ class VersionValidator(ClickValidator): 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") return val diff --git a/maubot/cli/commands/init.py b/maubot/cli/commands/init.py index 63bf3c2..cc6b55e 100644 --- a/maubot/cli/commands/init.py +++ b/maubot/cli/commands/init.py @@ -57,8 +57,9 @@ def init(name: str, id: str, version: Version, license: str, config: bool) -> No main_class=main_class) with open("maubot.yaml", "w") as file: file.write(meta) - with open("LICENSE", "w") as file: - file.write(spdx.get(license)["text"]) + if license: + with open("LICENSE", "w") as file: + file.write(spdx.get(license)["text"]) if not os.path.isdir(name): os.mkdir(name) mod = mod_template.render(config=config, name=main_class)