You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
51 lines
1.9 KiB
6 years ago
|
From d9b2cef72e129963ac082ec3737a877785232123 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||
|
Date: Sun, 2 Jun 2019 15:45:13 +0200
|
||
|
Subject: [PATCH 12/14] Add --translate-license to translate a specific license
|
||
|
|
||
|
Before, all known licenses would be listed by --show-license-map, so
|
||
|
grepping the list was enough to find a license. But now we support
|
||
|
alternative syntaxes, so this is not enough. Add a call to translate a
|
||
|
specific license:
|
||
|
|
||
|
$ python3 -m rust2rpm --translate-license GPL-3.0+
|
||
|
Upstream license tag GPL-3.0+ (GPL-3.0-or-later) translated to GPLv3+
|
||
|
GPLv3+
|
||
|
|
||
|
$ python3 -m rust2rpm --show-license-map | grep -F GPL-3.0+
|
||
|
(nada)
|
||
|
---
|
||
|
rust2rpm/__main__.py | 9 +++++++++
|
||
|
1 file changed, 9 insertions(+)
|
||
|
|
||
|
diff --git a/rust2rpm/__main__.py b/rust2rpm/__main__.py
|
||
|
index a7674fd..c55dacc 100644
|
||
|
--- a/rust2rpm/__main__.py
|
||
|
+++ b/rust2rpm/__main__.py
|
||
|
@@ -222,6 +222,8 @@ def main():
|
||
|
formatter_class=argparse.RawTextHelpFormatter)
|
||
|
parser.add_argument("--show-license-map", action="store_true",
|
||
|
help="Print license mappings and exit")
|
||
|
+ parser.add_argument("--translate-license", action="store_true",
|
||
|
+ help="Print mapping for specified license and exit")
|
||
|
parser.add_argument("--no-auto-changelog-entry", action="store_true",
|
||
|
help="Do not generate a changelog entry")
|
||
|
parser.add_argument("-", "--stdout", action="store_true",
|
||
|
@@ -248,6 +250,13 @@ def main():
|
||
|
licensing.dump_sdpx_to_fedora_map(sys.stdout)
|
||
|
return
|
||
|
|
||
|
+ if args.translate_license:
|
||
|
+ license, comments = licensing.translate_license(args.target, args.crate)
|
||
|
+ if comments:
|
||
|
+ print(comments)
|
||
|
+ print(license)
|
||
|
+ return
|
||
|
+
|
||
|
if args.crate is None:
|
||
|
parser.error("required crate/path argument missing")
|
||
|
|
||
|
--
|
||
|
2.22.0.rc3
|
||
|
|