Skip to content

Commit f5a0e85

Browse files
committed
Merge branch '108_options_to_include_non_supported_keys' into develop
Conflicts: about_code_tool/tests/test_about.py about_code_tool/tests/test_genabout.py Fixed all the test cases conflicts
2 parents 82bdb8d + a31ac83 commit f5a0e85

File tree

15 files changed

+162
-26
lines changed

15 files changed

+162
-26
lines changed

about_code_tool.egg-info/PKG-INFO

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Metadata-Version: 1.1
2+
Name: about-code-tool
3+
Version: 0.9.0
4+
Summary: Document the provenance (origin and license) of third-party software. Collect inventories, generate attribution docs.
5+
Home-page: http://dejacode.org
6+
Author: Jillian Daguil, Thomas Druez, Chin-Yeung Li, Philippe Ombredanne and others.
7+
Author-email: [email protected]
8+
License: Apache License 2.0
9+
Description: AboutCode provides a simple way to document theprovenance (i.e. origin and license) and other important orinteresting information about third-party software components thatyou use in your project. This documentation is stored in *.ABOUTfiles, side-by-side with the code they document.
10+
Platform: any
11+
Classifier: Development Status :: 4 - Beta
12+
Classifier: Programming Language :: Python
13+
Classifier: License :: OSI Approved :: Apache Software License
14+
Classifier: Operating System :: OS Independent
15+
Classifier: Natural Language :: English
16+
Classifier: Intended Audience :: Developers
17+
Classifier: Intended Audience :: Information Technology
18+
Classifier: Topic :: Software Development
19+
Classifier: Topic :: Software Development :: Documentation
20+
Classifier: Topic :: Software Development :: Quality Assurance
21+
Classifier: Topic :: System :: Software Distribution
22+
Classifier: Topic :: Utilities
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
README.rst
2+
setup.py
3+
about_code_tool/__init__.py
4+
about_code_tool/about.py
5+
about_code_tool/genabout.py
6+
about_code_tool/genattrib.py
7+
about_code_tool.egg-info/PKG-INFO
8+
about_code_tool.egg-info/SOURCES.txt
9+
about_code_tool.egg-info/dependency_links.txt
10+
about_code_tool.egg-info/not-zip-safe
11+
about_code_tool.egg-info/top_level.txt
12+
about_code_tool/tests/__init__.py
13+
about_code_tool/tests/test_about.py
14+
about_code_tool/tests/test_genabout.py
15+
about_code_tool/tests/test_genattrib.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
about_code_tool

about_code_tool/MAPPING.CONFIG

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66
# i.e.
77
# python genabout.py --mapping [Input File] [Generated Location]
88
#
9-
#
10-
# The current convention is to append the '.ABOUT' after the filename, OR
11-
# replace the last '/' with the '.ABOUT' for directories.
12-
#
13-
#
149
# Below are the fields that are needed in the genabout.py
15-
# - Essential Fields: Fields that are essential for the genabout.py to execute.
10+
# - Essential Fields: Fields that are essential for the ABOUT Code.
1611
# - Mandatory Fields: These are the mandatory fields for the ABOUT specification.
17-
# Although the genabout.py will still be able to generate ABOUT files if these fields are blank,
12+
# Although ABOUT Code will still be able to generate ABOUT files if these fields are blank,
1813
# it's highly recommend to have these fields filled in.
1914
#
2015
# How to example:
@@ -25,7 +20,15 @@
2520
# name: Component
2621
# version: file_version
2722
#
23+
# In addition, if there are fields that you want to put in the ABOUT
24+
# files, please use the 'Custom Fields' to include these fields.
25+
#
26+
# Note: All the Custom Field's keys will be converted to lower case and
27+
# all the spaces will be replaced by '_'
28+
#
29+
#
2830
# See http://www.dejacode.org/about_spec_v0.8.1.html for more information
31+
#
2932

3033
# Essential Fields
3134
about_file: Directory/Filename
@@ -35,4 +38,8 @@ name: Component
3538
version: Confirmed Version
3639

3740
# Optional Fields
38-
copyright: Confirmed Copyright
41+
copyright: Confirmed Copyright
42+
43+
44+
# Custom Fields
45+
confirmed_license: Confirmed License

about_code_tool/about.py

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,7 @@ def repr_problem(obj):
223223

224224
HEADER_ROW_FIELDS = (('about_file',)
225225
+ MANDATORY_FIELDS
226-
+ OPTIONAL_FIELDS
227-
+ ERROR_WARN_FIELDS)
226+
+ OPTIONAL_FIELDS)
228227

229228

230229
# SPDX License Identifiers from http://spdx.org/licenses/
@@ -720,10 +719,9 @@ def validate(self):
720719

721720
for field_name, value in self.validated_fields.items():
722721
self.check_is_ascii(self.validated_fields.get(field_name))
723-
self.validate_known_optional_fields(field_name)
722+
#self.validate_known_optional_fields(field_name)
724723
self.validate_file_field_exists(field_name, value)
725724
self.validate_url_field(field_name, network_check=False)
726-
727725
self.validate_spdx_license(field_name, value)
728726
self.check_date_format(field_name)
729727

@@ -953,17 +951,32 @@ def check_url_reachable(host, path):
953951
# http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
954952
return conn.getresponse().status
955953

956-
def get_row_data(self, updated_path):
954+
def get_custom_field_keys(self):
955+
custom_key = []
956+
for key in self.validated_fields:
957+
if key not in MANDATORY_FIELDS + OPTIONAL_FIELDS:
958+
custom_key.append(key)
959+
return custom_key
960+
961+
def get_row_data(self, updated_path, custom_keys):
957962
"""
958963
Create a csv compatible row of data for this object.
959964
"""
960965
row = [updated_path]
966+
custom_field = []
961967
for field in MANDATORY_FIELDS + OPTIONAL_FIELDS:
962968
if field in self.validated_fields:
963969
row += [self.validated_fields[field]]
964970
else:
965971
row += ['']
966972

973+
# Add custom field value
974+
for key in custom_keys:
975+
try:
976+
row += [self.validated_fields[key]]
977+
except:
978+
row += ['']
979+
967980
warnings = [repr(w) for w in self.warnings]
968981
errors = [repr(e) for e in self.errors]
969982
row += ['\n'.join(warnings), '\n'.join(errors)]
@@ -1180,18 +1193,33 @@ def get_relative_path2(self, about_object_location):
11801193
else:
11811194
return user_provided_path.replace('\\', '/')
11821195

1196+
def custom_keys(self):
1197+
custom_keys = []
1198+
for about_object in self:
1199+
keys = about_object.get_custom_field_keys()
1200+
for key in keys:
1201+
if key not in custom_keys:
1202+
custom_keys.append(key)
1203+
return custom_keys
1204+
11831205
def write_to_csv(self, output_path):
11841206
"""
11851207
Build a row for each about instance and write results in CSV file
11861208
located at `output_path`.
11871209
"""
1210+
custom_keys = self.custom_keys()
11881211
with open(output_path, 'wb') as output_file:
11891212
csv_writer = csv.writer(output_file)
1190-
csv_writer.writerow(HEADER_ROW_FIELDS)
1213+
header_row = HEADER_ROW_FIELDS
1214+
# Add the non-supported fields if exist
1215+
for key in custom_keys:
1216+
header_row += (key, )
1217+
header_row += ERROR_WARN_FIELDS
1218+
csv_writer.writerow(header_row)
11911219

11921220
for about_object in self:
11931221
relative_path = self.get_relative_path(about_object.location)
1194-
row_data = about_object.get_row_data(relative_path)
1222+
row_data = about_object.get_row_data(relative_path, custom_keys)
11951223
csv_writer.writerow(row_data)
11961224

11971225
def generate_attribution(self,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Metadata-Version: 1.1
2+
Name: about-code-tool
3+
Version: 0.9.0
4+
Summary: Document the origin of third-party software.
5+
Home-page: http://dejacode.org
6+
Author: Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez
7+
Author-email: [email protected]
8+
License: Apache License 2.0
9+
Description: The ABOUT tool and ABOUT files provide a simple way
10+
to document the provenance (origin and license) and other important or
11+
interesting information about third-party software components that you use
12+
in your project.
13+
Platform: any
14+
Classifier: Development Status :: 4 - Beta
15+
Classifier: Programming Language :: Python
16+
Classifier: License :: OSI Approved :: Apache Software License
17+
Classifier: Operating System :: OS Independent
18+
Classifier: Natural Language :: English
19+
Classifier: Intended Audience :: Developers
20+
Classifier: Intended Audience :: Information Technology
21+
Classifier: Topic :: Software Development
22+
Classifier: Topic :: Software Development :: Documentation
23+
Classifier: Topic :: Software Development :: Quality Assurance
24+
Classifier: Topic :: System :: Software Distribution
25+
Classifier: Topic :: Utilities

about_code_tool/about_code_tool.egg-info/SOURCES.txt

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)