mirror of
https://github.com/maubot/maubot
synced 2025-08-30 15:40:38 +00:00
Create license file when initializing project
This commit is contained in:
parent
6d92979dff
commit
ee04cc59a2
6 changed files with 49 additions and 397 deletions
|
@ -14,8 +14,6 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
from typing import Callable
|
||||
import pkg_resources
|
||||
import json
|
||||
import os
|
||||
|
||||
from packaging.version import Version, InvalidVersion
|
||||
|
@ -23,6 +21,8 @@ from prompt_toolkit.validation import Validator, ValidationError
|
|||
from prompt_toolkit.document import Document
|
||||
import click
|
||||
|
||||
from ..util import spdx as spdxlib
|
||||
|
||||
|
||||
class Required(Validator):
|
||||
proxy: Validator
|
||||
|
@ -75,19 +75,8 @@ class VersionValidator(ClickValidator):
|
|||
click_type = version
|
||||
|
||||
|
||||
spdx_list = None
|
||||
|
||||
|
||||
def load_spdx():
|
||||
global spdx_list
|
||||
spdx_data = pkg_resources.resource_stream("maubot.cli", "res/spdx-simple.json")
|
||||
spdx_list = json.load(spdx_data)
|
||||
|
||||
|
||||
def spdx(val: str) -> str:
|
||||
if not spdx_list:
|
||||
load_spdx()
|
||||
if val not in spdx_list:
|
||||
if spdxlib.valid(val):
|
||||
raise click.BadParameter(f"{val} is not a valid SPDX license identifier")
|
||||
return val
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue