Skip to content

Commit 65f0ad9

Browse files
committed
Update "Excel" reference to "XLSX" reference
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent d0fa8ec commit 65f0ad9

File tree

14 files changed

+55
-51
lines changed

14 files changed

+55
-51
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Add Dockerfile to run aboutcode with docker
1414
* Add new option to choose extract license from ScanCode LicenseDB or DJC License Library
1515
* Add ability to transform Excel formatted file
16-
* Support Excel file format for `inventory`, `gen` and `attrib`
16+
* Support XLSX file format for `inventory`, `gen` and `attrib`
1717
* Add 'spdx_license_key' support
1818
* Add option to save error log in `check` command
1919
* New `gen_license` option

docs/source/general.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AboutCode Toolkit Defined
99

1010
AboutCode Toolkit is a tool for your software development team to document your code inside your codebase, typically in preparation for a product release, side-by-side with the actual code. ABOUT file(s) have a simple, standard format that identifies components and their associated licenses. The current AboutCode Toolkit subcommands are:
1111

12-
- **attrib**: Generate a Product Attribution notice document from your ABOUT file(s), JSON, CSV or Excel. You can also generate documents for other purposes (such as a License Reference) by varying your input control file and your template.
12+
- **attrib**: Generate a Product Attribution notice document from your ABOUT file(s), JSON, CSV or XLSX. You can also generate documents for other purposes (such as a License Reference) by varying your input control file and your template.
1313

1414
- **check**: A simple command to validate the ABOUT file(s) and output errors/warnings if any on the terminal.
1515

@@ -21,7 +21,7 @@ AboutCode Toolkit is a tool for your software development team to document your
2121

2222
- **inventory**: Generate a Software Inventory list (.csv, .json or .xlsx format) from your codebase based on ABOUT file(s). Note that this Software Inventory will only include components that have AboutCode Toolkit data. In another word, if you do not create AboutCode Toolkit files for your own original software components, these components will not show up in the generated inventory.
2323

24-
- **transform**: A command to transform an input CSV/JSON/Excel by applying renaming and/or filtering and then output to a new CSV/JSON/Excel file.
24+
- **transform**: A command to transform an input CSV/JSON/XLSX by applying renaming and/or filtering and then output to a new CSV/JSON/Excel file.
2525

2626
Additional AboutCode Toolkit information is available at:
2727

@@ -173,11 +173,11 @@ Fields Renaming and Optional Custom Fields
173173

174174
Since your input's field name may not match with the AboutCode Toolkit standard field name, you can use the transform subcommand to do the transformation.
175175

176-
A transform configuration file is used to describe which transformations and validations to apply to a source CSV/JSON/Excel file. This is a simple text file using YAML format, using the same format as an .ABOUT file.
176+
A transform configuration file is used to describe which transformations and validations to apply to a source CSV/JSON/XLSX file. This is a simple text file using YAML format, using the same format as an .ABOUT file.
177177

178178
The attributes that can be set in a configuration file are:
179179

180-
- field_renamings: An optional map of source field name to target new field name that is used to rename CSV/JSON/Excel fields.
180+
- field_renamings: An optional map of source field name to target new field name that is used to rename CSV/JSON/XLSX fields.
181181

182182
.. code-block:: none
183183
@@ -189,7 +189,7 @@ The attributes that can be set in a configuration file are:
189189
The renaming is always applied first before other transforms and checks. All other field names referenced below are AFTER the renaming have been applied.
190190
For instance with this configuration, the field "Directory/Location" will be renamed to "about_resource" and "foo" to "bar":
191191

192-
- required_fields: An optional list of required field names that must have a value, beyond the standard field names. If a source CSV/JSON/Excel does not have such a field or an entry is missing a value for a required field, an error is reported.
192+
- required_fields: An optional list of required field names that must have a value, beyond the standard field names. If a source CSV/JSON/XLSX does not have such a field or an entry is missing a value for a required field, an error is reported.
193193

194194
For instance with this configuration, an error will be reported if the fields "name" and "version" are missing, or if any entry does not have a value set for these fields:
195195

docs/source/reference.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Commands
2727

2828
.. code-block:: none
2929
30-
attrib Generate an attribution document from JSON/CSV/Excel/.ABOUT files.
30+
attrib Generate an attribution document from JSON/CSV/XLSX/.ABOUT files.
3131
check Validate that the format of .ABOUT files is correct and
3232
report errors and warnings.
3333
collect-redist-src Collect redistributable sources.
34-
gen Generate .ABOUT files from an inventory as CSV/JSON/Excel.
35-
inventory Collect the inventory of .ABOUT files to a CSV/JSON/Excel file.
36-
transform Transform a CSV/JSON/Excel by applying renamings, filters and checks.
34+
gen Generate .ABOUT files from an inventory as CSV/JSON/XLSX.
35+
inventory Collect the inventory of .ABOUT files to a CSV/JSON/XLSX file.
36+
transform Transform a CSV/JSON/XLSX by applying renamings, filters and checks.
3737
3838
attrib
3939
======
@@ -300,7 +300,7 @@ Syntax
300300
301301
about gen [OPTIONS] LOCATION OUTPUT
302302
303-
LOCATION: Path to a JSON/CSV/Excel inventory file.
303+
LOCATION: Path to a JSON/CSV/XLSX inventory file.
304304
OUTPUT: Path to a directory where ABOUT files are generated.
305305
306306
Options
@@ -334,7 +334,7 @@ Options
334334
Purpose
335335
-------
336336

337-
Given a CSV/JSON/Excel inventory, generate ABOUT files in the output location.
337+
Given a CSV/JSON/XLSX inventory, generate ABOUT files in the output location.
338338

339339
Details
340340
^^^^^^^
@@ -402,7 +402,7 @@ Syntax
402402
403403
about gen_license [OPTIONS] LOCATION OUTPUT
404404
405-
LOCATION: Path to a JSON/CSV/Excel/.ABOUT file(s)
405+
LOCATION: Path to a JSON/CSV/XLSX/.ABOUT file(s)
406406
OUTPUT: Path to a directory where license files are saved.
407407
408408
Options
@@ -468,7 +468,7 @@ Syntax
468468
about inventory [OPTIONS] LOCATION OUTPUT
469469
470470
LOCATION: Path to an ABOUT file or a directory with ABOUT files.
471-
OUTPUT: Path to the CSV/JSON/Excel inventory file to create.
471+
OUTPUT: Path to the CSV/JSON/XLSX inventory file to create.
472472
473473
Options
474474
-------
@@ -483,7 +483,7 @@ Options
483483
Purpose
484484
-------
485485

486-
Create a JSON/CSV/Excel inventory of components from ABOUT files.
486+
Create a JSON/CSV/XLSX inventory of components from ABOUT files.
487487

488488
Details
489489
^^^^^^^
@@ -566,8 +566,8 @@ Syntax
566566
567567
about transform [OPTIONS] LOCATION OUTPUT
568568
569-
LOCATION: Path to a CSV/JSON/Excel file.
570-
OUTPUT: Path to CSV/JSON/Excel inventory file to create.
569+
LOCATION: Path to a CSV/JSON/XLSX file.
570+
OUTPUT: Path to CSV/JSON/XLSX inventory file to create.
571571
572572
Options
573573
-------
@@ -584,7 +584,7 @@ Options
584584
Purpose
585585
-------
586586

587-
Transform the CSV/JSON/Excel file at LOCATION by applying renamings, filters and checks and then write a new CSV/JSON/Excel to OUTPUT (Format for input and output need to be the same).
587+
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings, filters and checks and then write a new CSV/JSON/Excel to OUTPUT (Format for input and output need to be the same).
588588

589589
Details
590590
^^^^^^^

docs/source/specification.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Fields order and multiple occurrences
119119

120120
The field order does not matter. Multiple occurrences of a field name is not supported.
121121

122-
The tool processing an ABOUT file or CSV/JSON/Excel input will issue an error when a field name occurs more than once in the input file.
122+
The tool processing an ABOUT file or CSV/JSON/XLSX input will issue an error when a field name occurs more than once in the input file.
123123

124124
Field referencing a file
125125
------------------------

src/attributecode/cmd.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def validate_extensions(ctx, param, value, extensions=tuple(('.csv', '.json',)))
141141

142142

143143
@about.command(cls=AboutCommand,
144-
short_help='Collect the inventory of .ABOUT files to a CSV/JSON/Excel file.')
144+
short_help='Collect the inventory of .ABOUT files to a CSV/JSON/XLSX file.')
145145

146146
@click.argument('location',
147147
required=True,
@@ -172,11 +172,11 @@ def validate_extensions(ctx, param, value, extensions=tuple(('.csv', '.json',)))
172172
@click.help_option('-h', '--help')
173173
def inventory(location, output, format, quiet, verbose): # NOQA
174174
"""
175-
Collect the inventory of .ABOUT files to a CSV/JSON/Excel file.
175+
Collect the inventory of .ABOUT files to a CSV/JSON/XLSX file.
176176
177177
LOCATION: Path to an ABOUT file or a directory with ABOUT files.
178178
179-
OUTPUT: Path to the CSV/JSON/Excel inventory file to create.
179+
OUTPUT: Path to the CSV/JSON/XLSX inventory file to create.
180180
"""
181181
if not quiet:
182182
print_version()
@@ -200,7 +200,7 @@ def inventory(location, output, format, quiet, verbose): # NOQA
200200

201201

202202
@about.command(cls=AboutCommand,
203-
short_help='Generate .ABOUT files from an inventory as CSV/JSON/Excel.')
203+
short_help='Generate .ABOUT files from an inventory as CSV/JSON/XLSX.')
204204

205205
@click.argument('location',
206206
required=True,
@@ -246,9 +246,9 @@ def inventory(location, output, format, quiet, verbose): # NOQA
246246
@click.help_option('-h', '--help')
247247
def gen(location, output, android, fetch_license, fetch_license_djc, reference, quiet, verbose):
248248
"""
249-
Given a CSV/JSON/Excel inventory, generate ABOUT files in the output location.
249+
Given a CSV/JSON/XLSX inventory, generate ABOUT files in the output location.
250250
251-
LOCATION: Path to a JSON/CSV/Excel inventory file.
251+
LOCATION: Path to a JSON/CSV/XLSX inventory file.
252252
253253
OUTPUT: Path to a directory where ABOUT files are generated.
254254
"""
@@ -314,7 +314,7 @@ def gen_license(location, output, djc, scancode, verbose):
314314
"""
315315
Fetch licenses (Default: ScanCode LicenseDB) in the license_expression field and save to the output location.
316316
317-
LOCATION: Path to a JSON/CSV/Excel/.ABOUT file(s)
317+
LOCATION: Path to a JSON/CSV/XLSX/.ABOUT file(s)
318318
319319
OUTPUT: Path to a directory where license files are saved.
320320
"""
@@ -378,7 +378,7 @@ def validate_template(ctx, param, value):
378378

379379

380380
@about.command(cls=AboutCommand,
381-
short_help='Generate an attribution document from JSON/CSV/Excel/.ABOUT files.')
381+
short_help='Generate an attribution document from JSON/CSV/XLSX/.ABOUT files.')
382382

383383
@click.argument('input',
384384
required=True,
@@ -442,7 +442,7 @@ def validate_template(ctx, param, value):
442442
@click.help_option('-h', '--help')
443443
def attrib(input, output, api_url, api_key, scancode, min_license_score, reference, template, vartext, quiet, verbose):
444444
"""
445-
Generate an attribution document at OUTPUT using JSON, CSV or Excel or .ABOUT files at INPUT.
445+
Generate an attribution document at OUTPUT using JSON, CSV or XLSX or .ABOUT files at INPUT.
446446
447447
INPUT: Path to a file (.ABOUT/.csv/.json/.xlsx), directory or .zip archive containing .ABOUT files.
448448
@@ -726,7 +726,7 @@ def print_config_help(ctx, param, value):
726726

727727

728728
@about.command(cls=AboutCommand,
729-
short_help='Transform a CSV/JSON/Excel by applying renamings, filters and checks.')
729+
short_help='Transform a CSV/JSON/XLSX by applying renamings, filters and checks.')
730730

731731
@click.argument('location',
732732
required=True,
@@ -762,13 +762,13 @@ def print_config_help(ctx, param, value):
762762
@click.help_option('-h', '--help')
763763
def transform(location, output, configuration, quiet, verbose): # NOQA
764764
"""
765-
Transform the CSV/JSON/Excel file at LOCATION by applying renamings, filters and checks
766-
and then write a new CSV/JSON/Excel to OUTPUT (Format for input and output need to be
765+
Transform the CSV/JSON/XLSX file at LOCATION by applying renamings, filters and checks
766+
and then write a new CSV/JSON/XLSX to OUTPUT (Format for input and output need to be
767767
the same).
768768
769-
LOCATION: Path to a CSV/JSON/Excel file.
769+
LOCATION: Path to a CSV/JSON/XLSX file.
770770
771-
OUTPUT: Path to CSV/JSON/Excel inventory file to create.
771+
OUTPUT: Path to CSV/JSON/XLSX inventory file to create.
772772
"""
773773
if not configuration:
774774
transformer = Transformer.default()

src/attributecode/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def transform_json_to_json(location, output, transformer):
8888

8989
def transform_excel_to_excel(location, output, transformer):
9090
"""
91-
Read a Excel file at `location` and write a new Excel file at `output`. Apply
91+
Read a XLSX file at `location` and write a new Excel file at `output`. Apply
9292
transformations using the `transformer` Transformer.
9393
Return a list of Error objects.
9494
"""
@@ -415,7 +415,7 @@ def write_json(location, data):
415415

416416
def read_excel(location):
417417
"""
418-
Read Excel at `location`, return a list of ordered dictionaries, one
418+
Read XLSX at `location`, return a list of ordered dictionaries, one
419419
for each row.
420420
"""
421421
results = []

src/attributecode/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def load_scancode_json(location):
670670

671671
def load_excel(location):
672672
"""
673-
Read Excel at `location`, return a list of ordered dictionaries, one
673+
Read XLSX at `location`, return a list of ordered dictionaries, one
674674
for each row.
675675
"""
676676
results = []

tests/test_cmd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ def check_about_stdout(options, expected_loc, regen=False):
334334
with open(expected_file, 'r') as ef:
335335
expected = ef.read()
336336

337+
print("!!!!!!!!!!!!!!!!!!!!")
338+
print(expected.splitlines(False))
339+
print("#####################")
340+
print(result.output.splitlines(False))
337341
assert expected.splitlines(False) == result.output.splitlines(False)
338342

339343

tests/testdata/test_cmd/help/about_attrib_help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Usage: about attrib [OPTIONS] INPUT OUTPUT
22

3-
Generate an attribution document at OUTPUT using JSON, CSV or Excel or .ABOUT
3+
Generate an attribution document at OUTPUT using JSON, CSV or XLSX or .ABOUT
44
files at INPUT.
55

66
INPUT: Path to a file (.ABOUT/.csv/.json/.xlsx), directory or .zip archive

tests/testdata/test_cmd/help/about_gen_help.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Usage: about gen [OPTIONS] LOCATION OUTPUT
22

3-
Given a CSV/JSON/Excel inventory, generate ABOUT files in the output location.
3+
Given a CSV/JSON/XLSX inventory, generate ABOUT files in the output location.
44

5-
LOCATION: Path to a JSON/CSV/Excel inventory file.
5+
LOCATION: Path to a JSON/CSV/XLSX inventory file.
66

77
OUTPUT: Path to a directory where ABOUT files are generated.
88

0 commit comments

Comments
 (0)