@@ -139,7 +139,7 @@ def inventory(location, output, quiet, format):
139139@click .option ('--license-notice-text-location' , nargs = 1 ,
140140 type = click .Path (exists = True , dir_okay = True , readable = True , resolve_path = True ),
141141 help = "Copy the 'license_file' from the directory to the generated location" )
142- @click .option ('--mapping' , is_flag = True , help = 'Use for mapping between the input keys and the ABOUT field names - mapping.config ' )
142+ @click .option ('--mapping' , is_flag = True , help = 'Use file mapping.config with mapping between input keys and ABOUT field names' )
143143@click .option ('-q' , '--quiet' , is_flag = True , help = 'Do not print any error/warning.' )
144144def gen (location , output , mapping , license_notice_text_location , fetch_license , quiet ):
145145 """
@@ -150,13 +150,16 @@ def gen(location, output, mapping, license_notice_text_location, fetch_license,
150150
151151OUTPUT: Path to a directory where ABOUT files are generated.
152152 """
153- click .echo ('Running attributecode version ' + __version__ )
153+ click .echo ('Running aboutcode-toolkit version ' + __version__ )
154154 if not location .endswith ('.csv' ) and not location .endswith ('.json' ):
155155 click .echo ('ERROR: Input file. Only .csv and .json files are supported.' )
156156 return
157157 click .echo ('Generating ABOUT files...' )
158158
159- errors , abouts = attributecode .gen .generate (location , output , mapping , license_notice_text_location , fetch_license )
159+ errors , abouts = attributecode .gen .generate (
160+ location = location , base_dir = output , mapping = mapping ,
161+ license_notice_text_location = license_notice_text_location ,
162+ fetch_license = fetch_license )
160163
161164 number_of_about_file = len (abouts )
162165 number_of_error = 0
@@ -174,7 +177,7 @@ def gen(location, output, mapping, license_notice_text_location, fetch_license,
174177@click .argument ('output' , nargs = 1 , required = True , type = click .Path (exists = False , writable = True , resolve_path = True ))
175178@click .option ('--inventory' , required = False , type = click .Path (exists = True , file_okay = True , resolve_path = True ),
176179 help = 'Path to an inventory file' )
177- @click .option ('--mapping' , is_flag = True , help = 'Use for mapping between the input keys and the ABOUT field names - mapping.config ' )
180+ @click .option ('--mapping' , is_flag = True , help = 'Use file mapping.config with mapping between input keys and ABOUT field names' )
178181@click .option ('--template' , type = click .Path (exists = True ), nargs = 1 ,
179182 help = 'Path to a custom attribution template' )
180183@click .option ('-q' , '--quiet' , is_flag = True , help = 'Do not print any error/warning.' )
@@ -196,12 +199,11 @@ def attrib(location, output, template, mapping, inventory, quiet):
196199 # accept zipped ABOUT files as input
197200 location = extract_zip (location )
198201
199- if mapping :
200- attributecode .util .have_mapping = True
201-
202202 errors , abouts = model .collect_inventory (location )
203203 no_match_errors = attributecode .attrib .generate_and_save (
204- abouts , output , mapping , template_loc = template , inventory_location = inventory )
204+ abouts = abouts , output_location = output ,
205+ use_mapping = mapping , template_loc = template ,
206+ inventory_location = inventory )
205207
206208 for no_match_error in no_match_errors :
207209 errors .append (no_match_error )
@@ -218,7 +220,7 @@ def check(location):
218220
219221LOCATION: Path to an ABOUT file or a directory containing ABOUT files.
220222 """
221- click .echo ('Running attributecode version ' + __version__ )
223+ click .echo ('Running aboutcode-toolkit version ' + __version__ )
222224 click .echo ('Checking ABOUT files...' )
223225
224226 errors , abouts = attributecode .model .collect_inventory (location )
@@ -241,6 +243,7 @@ def check(location):
241243 else :
242244 click .echo ('No error is found.' )
243245
246+
244247def log_errors (errors , quiet , base_dir = False ):
245248 """
246249 Iterate of sequence of Error objects and print and log errors with a severity
0 commit comments