Skip to content

Commit f6580e3

Browse files
committed
Update doc and code for shutil.make_archive
1 parent 7a278ac commit f6580e3

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/attributecode/cmd.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ def validate_extensions(ctx, param, value, extensions=tuple(('.csv', '.json',)))
171171

172172
def inventory(location, output, format, quiet, verbose): # NOQA
173173
"""
174-
Collect the inventory of .ABOUT file data as CSV or JSON.
174+
Collect the inventory of ABOUT file data as CSV or JSON.
175175
176-
LOCATION: Path to an .ABOUT file or a directory with .ABOUT files.
176+
LOCATION: Path to an ABOUT file or a directory with ABOUT files.
177177
178178
OUTPUT: Path to the JSON or CSV inventory file to create.
179179
"""
@@ -243,7 +243,7 @@ def inventory(location, output, format, quiet, verbose): # NOQA
243243

244244
def gen(location, output, android, fetch_license, reference, quiet, verbose):
245245
"""
246-
Generate .ABOUT files in OUTPUT from an inventory of .ABOUT files at LOCATION.
246+
Given a CSV/JSON inventory, generate ABOUT files in the output location.
247247
248248
LOCATION: Path to a JSON or CSV inventory file.
249249
@@ -415,7 +415,7 @@ def attrib(location, output, template, vartext, quiet, verbose):
415415

416416
def collect_redist_src(location, output, from_inventory, with_structures, zip, quiet, verbose):
417417
"""
418-
Collect sources that have 'redistribute' flagged in .ABOUT files or inventory
418+
Collect sources that have 'redistribute' flagged as 'True' in .ABOUT files or inventory
419419
to the output location.
420420
421421
LOCATION: Path to a directory containing sources that need to be copied
@@ -442,7 +442,7 @@ def collect_redist_src(location, output, from_inventory, with_structures, zip, q
442442
errors, abouts = collect_inventory(location)
443443

444444
if zip:
445-
# Copy to a temp location and the zip to the ouput location
445+
# Copy to a temp location and the zip to the output location
446446
output_location = get_temp_dir()
447447
else:
448448
output_location = output
@@ -452,7 +452,10 @@ def collect_redist_src(location, output, from_inventory, with_structures, zip, q
452452

453453
if zip:
454454
import shutil
455-
shutil.make_archive(output, 'zip', output_location)
455+
# Stripped the .zip extension as the `shutil.make_archive` will
456+
# append the .zip extension
457+
output_no_extension = output.rsplit('.', 1)[0]
458+
shutil.make_archive(output_no_extension, 'zip', output_location)
456459

457460
errors.extend(copy_list_errors)
458461
errors.extend(copy_errors)
@@ -489,7 +492,7 @@ def check(location, verbose):
489492
"""
490493
Check .ABOUT file(s) at LOCATION for validity and print error messages.
491494
492-
LOCATION: Path to a file or directory containing .ABOUT files.
495+
LOCATION: Path to an ABOUT file or a directory with ABOUT files.
493496
"""
494497
print_version()
495498
click.echo('Checking ABOUT files...')
@@ -550,7 +553,8 @@ def print_config_help(ctx, param, value):
550553
def transform(location, output, configuration, quiet, verbose): # NOQA
551554
"""
552555
Transform the CSV/JSON file at LOCATION by applying renamings, filters and checks
553-
and write a new CSV/JSON to OUTPUT.
556+
and then write a new CSV/JSON to OUTPUT (Format for input and output need to be
557+
the same).
554558
555559
LOCATION: Path to a CSV/JSON file.
556560

0 commit comments

Comments
 (0)