1- ========
21about.py
32========
43
5- ------
6- Syntax
7- ------
4+ **Syntax **
5+
6+ ::
7+
8+ about.py [options] input_path output_path
89
9- Usage: about.py [options] input_path output_path
10+ - Input can be a file or directory.
11+ - Output must be a file with a .csv extension.
1012
11- Input can be a file or directory.
12- Output must be a file with a .csv extension.
13+ **Options: **
14+
15+ ::
1316
14- Options:
1517 -h, --help Display help
1618 --version Display current version, license notice, and copyright notice
1719 --overwrite Overwrites the output file if it exists
@@ -21,38 +23,38 @@ Syntax
2123 1 - Print error messages
2224 2 - Print error and warning messages
2325
24- -------
2526Purpose
2627-------
28+ Extract information from the .ABOUT files and save it to the CSV file.
2729
28- Extract information from the .ABOUT files and save it to the CSV file.
29-
30- -------
3130Options
3231-------
3332
33+ ::
34+
3435 --overwrite
3536
3637 Overwrite the extracted data from .ABOUT files to the output location
3738
38- $ python about.py --overwrite <input path> <output path>
39+ $ python about.py --overwrite <input path> <output path>
3940
4041
41- ===========
4242genabout.py
4343===========
4444
45- ------
46- Syntax
47- ------
45+ **Syntax **
46+
47+ ::
48+
49+ genabout.py [options] input_path output_path
4850
49- Usage: genabout.py [options] input_path output_path
51+ - Input must be a CSV file
52+ - Output must be a directory location where the ABOUT files should be generated
5053
51- Input must be a CSV file
52- Output must be a directory location where the ABOUT files should be generated
54+ **Options: **
5355
56+ ::
5457
55- Options:
5658 -h, --help Display help
5759 --version Display current version, license notice, and copyright notice
5860 --verbosity=VERBOSITY
6769 2 - Keep the current field value and only add the "new" field and field value
6870 3 - Replace the ABOUT file with the current generation
6971
70- --all_in_one Generate all the ABOUT files in the [output_path] without
71- any project structure
72-
7372 --copy_files=COPY_FILES
7473 Copy the '*_file' from the project to the generated location
7574 Project path - Project path
@@ -91,28 +90,21 @@ Syntax
9190 Example syntax:
9291 genabout.py --extract_license --api_url='api_url' --api_username='api_username' --api_key='api_key'
9392
94- -------
9593Purpose
9694-------
95+ Generate ABOUT files from the input CSV file to output location.
9796
98- Generate ABOUT files from the input CSV file to output location
99-
100- -------
10197Options
10298-------
10399
100+ ::
101+
104102 --action=ACTION
105103
106104 Handle different behaviors if ABOUT files already existed.
107105 For instance, replace the ABOUT files with the current generation
108106
109- $ python genabout.py --action=3 <input path> <output path>
110-
111- --all_in_one
112-
113- Generate all the ABOUT files to the output location without any project structure
114-
115- $ python genabout.py --all_in_one <input path> <output path>
107+ $ python genabout.py --action=3 <input path> <output path>
116108
117109 --copy_files
118110
@@ -127,7 +119,7 @@ Options
127119 'license_text_file' and 'notice_text_file' from
128120 /home/project/ to /home/about/
129121
130- $ python genabout.py --copy_files=/home/project/ <input path> /home/about/
122+ $ python genabout.py --copy_files=/home/project/ <input path> /home/about/
131123
132124 --license_text_location
133125
@@ -139,34 +131,43 @@ Options
139131 /home/license/apache2.LICENSE
140132 /home/license/jquery.js.LICENSE
141133
142- $ python genabout.py --license_text_location=/home/licenses/ <input path> <output path>
134+ $ python genabout.py --license_text_location=/home/licenses/ <input path> <output path>
143135
144136 --mapping
145137
146138 This tool needs the input CSV to have the required and/or optional keys to work.
147- By understanding the user's input may not have the same keys name as the tool use,
148- there are two ways the users can do.
149- 1. Change the keys name directly in the input manually.
150- 2. Use the '--mapping' option to configure the keys mapping.
151-
152- When the '--mapping' is set, this tool will look into the 'MAPPING.CONFIG'
153- and do the keys mapping.
154-
155- For instance, assuming the context of the MAPPING.CONFIG is the following:
139+ Since the user input may not have the same column key names used by the tool,
140+ there are two ways to reconcile that:
141+ 1. Change the key names directly in the input manually to match the field names
142+ supported by the AboutCode specification.
143+ Note: genabout.py looks for an about_file field and uses it to derive the mandatory
144+ output field about_resource.
145+ 2. Use the '--mapping' option to configure the key mapping. This method provides the
146+ most flexiblity and control.
147+ When the '--mapping' option is set, the tool will look into the 'MAPPING.CONFIG'
148+ file to determine key mapping.
149+
150+ The format of each text line in the MAPPING.CONFIG file is as follows:
151+ {{about_file_target_field_name}}: {{input_csv_file_field_name}}
152+
153+ For instance, assume that MAPPING.CONFIG contains the following:
156154 about_resource: file_name
157155 about_file: Resource
158156 name: Component
159157 version: file_version
160158
161- This tool will look into the input CSV and try to find the column key named
162- 'file_name' and configure to map with the 'about_resource' key that this
163- tool use . The 'Resource' will then configure to map with 'about_file' and
159+ The tool will look into the input CSV and try to find the column key named
160+ 'file_name' and configure to map with the 'about_resource' key that the
161+ tool uses . The 'Resource' will then configure to map with 'about_file' and
164162 so on.
165163
166- In another word, users do not need to modify the keys name of the
167- input manually but let the 'MAPPING.CONFIG' to do the keys mapping.
164+ In another word, you do not need to modify the key names of the
165+ input manually, but rather use the MAPPING.CONFIG to do the key mapping.
166+
167+ Another advantage of using the MAPPING.CONFIG is the ability to specify
168+ any field names that are important to you, including custom fields.
168169
169- $ python genabout.py --mapping <input path> <output path>
170+ $ python genabout.py --mapping <input path> <output path>
170171
171172 --extract_license
172173
@@ -181,68 +182,71 @@ Options
181182 yourself in the API.
182183 (Please contact us to get the api_* value to use this feature)
183184
184- genabout.py --extract_license --api_url='api_url' --api_username='api_username' --api_key='api_key' <input path> <output path>
185+ $ python genabout.py --extract_license --api_url='api_url' --api_username='api_username' --api_key='api_key' <input path> <output path>
185186
186187
187- ============
188188genattrib.py
189189============
190190
191- ------
192- Syntax
193- ------
191+ **Syntax **
194192
195- Usage: genattrib.py [options] input_path output_path component_list
196-
197- Input can be a file or directory.
198- Output of rendered template must be a file (e.g. .html).
199- Component List must be a .csv file which has at least an "about_file" column.
200-
201-
202- Options:
203- -h, --help Display help
204- -v, --version Display current version, license notice, and copyright notice
205- --overwrite Overwrites the output file if it exists
206- --verbosity=VERBOSITY
207- Print more or fewer verbose messages while processing ABOUT files
208- 0 - Do not print any warning or error messages, just a total count (default)
209- 1 - Print error messages
210- 2 - Print error and warning messages
193+ ::
211194
212- --template_location=TEMPLATE_LOCATION
213- Use the custom template for the Attribution Generation
195+ genattrib.py [options] input_path output_path component_list
214196
215- --mapping Configure the mapping key from the MAPPING.CONFIG
197+ - Input can be a file or directory.
198+ - Output of rendered template must be a file (e.g. .html).
199+ - Component List must be a .csv file which has at least an "about_file" column.
200+
201+ **Options: **
202+
203+ ::
204+
205+ -h, --help Display help
206+ --version Display current version, license notice, and copyright notice
207+ --overwrite Overwrites the output file if it exists
208+ --verbosity=VERBOSITY
209+ Print more or fewer verbose messages while processing ABOUT files
210+ 0 - Do not print any warning or error messages, just a total count (default)
211+ 1 - Print error messages
212+ 2 - Print error and warning messages
213+ --template_location=TEMPLATE_LOCATION
214+ Use the custom template for the Attribution Generation
215+ --mapping Configure the mapping key from the MAPPING.CONFIG
216216
217- -------
218217Purpose
219218-------
219+ Generate an Attribution HTML file which contains the license information from
220+ the 'component_list' along with the license text.
221+
222+ This tool will look at the components in the 'component_list' and find the
223+ corresponding .ABOUT files in the 'input_path' and generate the output in
224+ the 'output_path'. Therefore, please make sure there are .ABOUT files under
225+ the 'input_path'.
220226
221- Generate an Attribution HTML file which contains the license information from
222- the 'component_list' along with the license text.
227+ Assuming the follow:
223228
224- This tool will look at the components in the 'component_list' and find the
225- corresponding .ABOUT files in the 'input_path' and generate the output in
226- the 'output_path'. Therefore, please make sure there are .ABOUT files under
227- the 'input_path'.
229+ ::
228230
229- Assuming the follow:
230- '/home/about_files/' contains all the ABOUT files from the component_list
231+ '/home/about_files/'** contains all the ABOUT files from the component_list
231232 '/home/attribution/attribution.html' is the user's output path
232233 '/home/project/component_list.csv' is the component list that user want to be generated
233234
234- $ python genattrib.py /home/about_files/ /home/attribution/attribution.html /home/project/component_list.csv
235+ ::
236+
237+ $ python genattrib.py /home/about_files/ /home/attribution/attribution.html /home/project/component_list.csv
235238
236- -------
237239Options
238240-------
239241
240- --template_location
242+ ::
241243
244+ --template_location
245+
242246 This option allows you to use your own template for Attribution Generation.
243247 For instance, if the custom template you want to use is located at:
244248 /home/custom_template/template.html
245249
246- $ python genattrib.py --template_location=/home/custom_template/template.html input_path output_path component_list
250+ $ python genattrib.py --template_location=/home/custom_template/template.html input_path output_path component_list
247251
248252
0 commit comments