summaryrefslogtreecommitdiffstats
path: root/scripts/license-yaml2csv.py
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-03-29 14:03:56 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-03-30 07:43:18 +0100
commit1bcffd2a17a207004de799326aa1fc61a5a939e3 (patch)
tree71dc8125572f09cc2a0457a239f6068d6f96ffde /scripts/license-yaml2csv.py
parent4bc95dfbc28e5dffa982b338221a1302df8f7fe2 (diff)
downloadptxdist-1bcffd2a17a207004de799326aa1fc61a5a939e3.tar.gz
ptxdist-1bcffd2a17a207004de799326aa1fc61a5a939e3.tar.xz
license-yaml2csv: handle new yaml format
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/license-yaml2csv.py')
-rwxr-xr-xscripts/license-yaml2csv.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/license-yaml2csv.py b/scripts/license-yaml2csv.py
index 1c8be2119..b3f56f6fb 100755
--- a/scripts/license-yaml2csv.py
+++ b/scripts/license-yaml2csv.py
@@ -41,8 +41,8 @@ parser = argparse.ArgumentParser()
parser.add_argument('-s', '--separator', type=parse_separator, default=',',
help='field separator [,]')
parser.add_argument('-f', '--fields', type=parse_fields,
- default=['name', 'version', 'section', 'licenses', 'flags'],
- help='field list [name,version,section,licenses,flags]')
+ default=['name', 'version', 'section', 'licenses', 'license-flags'],
+ help='field list [name,version,section,licenses,license-flags]')
parser.add_argument('input', nargs='?', type=parse_input,
default=sys.stdin, help='license yaml file [stdin]')
@@ -56,6 +56,10 @@ for (_, record) in yaml.load(args.input.read(), Loader=yaml.loader.BaseLoader).i
value = record.get(field, None)
if not value:
value = ''
+ if field == 'license-flags':
+ value = " ".join(value)
+ elif not isinstance(value, str):
+ value = str(value)
quote = args.separator in value or '"' in value
if quote:
line += '"'