Skip to content

Commit d1b45eb

Browse files
committed
#331 Change the 'license' to 'license_key'
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 3f2938c commit d1b45eb

File tree

13 files changed

+24
-23
lines changed

13 files changed

+24
-23
lines changed

src/attributecode/attrib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def generate_and_save(abouts, output_location, use_mapping=False, mapping_file=N
238238
str(special_char_in_expression))
239239
errors.append(Error(ERROR, msg))
240240
else:
241-
about.license.value = lic_list
241+
about.license_key.value = lic_list
242242

243243
# Parse the vartext and save to the vartext dictionary
244244
if vartext:

src/attributecode/model.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ def create_fields(self):
677677
('homepage_url', UrlField()),
678678
('notes', StringField()),
679679

680-
('license', ListField()),
681680
('license_expression', StringField()),
681+
('license_key', ListField()),
682682
('license_name', ListField()),
683683
('license_file', FileTextField()),
684684
('license_url', UrlField()),
@@ -752,7 +752,7 @@ def attribution_fields(fields):
752752
"""
753753
attrib_fields = ['name',
754754
'version',
755-
'license',
755+
'license_key',
756756
'license_name',
757757
'license_file',
758758
'license_url',
@@ -1099,7 +1099,8 @@ def dump_lic(self, location, license_dict):
10991099

11001100
if self.license_expression.present and not self.license_file.present:
11011101
special_char_in_expression, lic_list = parse_license_expression(self.license_expression.value)
1102-
self.license = lic_list
1102+
self.license_key.value = lic_list
1103+
self.license_key.present = True
11031104
if not special_char_in_expression:
11041105
for lic_key in lic_list:
11051106
try:
@@ -1394,8 +1395,8 @@ def by_license_content(abouts):
13941395
grouped[''] = []
13951396
no_license = grouped['']
13961397
for about in abouts:
1397-
if about.license.value:
1398-
special_char_in_expression, lic_list = parse_license_expression(about.license.value)
1398+
if about.license_key.value:
1399+
special_char_in_expression, lic_list = parse_license_expression(about.license_key.value)
13991400
if not special_char_in_expression:
14001401
for lic in lic_list:
14011402
if lic in grouped:

src/attributecode/templates/default_html.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
<pre class="component-notice">{{ about_object.notice_file.value[notice] }}</pre>
4343
{% endfor %}
4444
{% endif %}
45-
{% if about_object.license.value %}
46-
{% for license_key in about_object.license.value %}
45+
{% if about_object.license_key.value %}
46+
{% for license_key in about_object.license_key.value %}
4747
{% if license_key in common_licenses %}
4848
<p>Full text of
4949
<a class="{{ license_key }}" href="#component-license-{{ license_key }}">

tests/test_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ def test_About_dumps_does_not_transform_strings_in_lists(self):
597597
description: AboutCode is a tool to process ABOUT files. An ABOUT file is a file.
598598
homepage_url: http://dejacode.org
599599
notes:
600-
license: apache-2.0
601600
license_expression: apache-2.0
601+
license_key: apache-2.0
602602
license_name:
603603
license_file: apache-2.0.LICENSE
604604
license_url:
@@ -674,8 +674,8 @@ def test_field_names(self):
674674
'description',
675675
'homepage_url',
676676
'notes',
677-
'license',
678677
'license_expression',
678+
'license_key',
679679
'license_name',
680680
'license_file',
681681
'license_url',
@@ -748,8 +748,8 @@ def test_About_dumps(self):
748748
to process ABOUT files.
749749
An ABOUT file is a file.
750750
homepage_url: http://dejacode.org
751-
license: apache-2.0
752751
license_expression: apache-2.0
752+
license_key: apache-2.0
753753
license_file: apache-2.0.LICENSE
754754
copyright: Copyright (c) 2013-2014 nexB Inc.
755755
notice_file: NOTICE
@@ -859,7 +859,7 @@ def test_About_as_dict_with_empty(self):
859859
'author': u'',
860860
'copyright': u'Copyright (c) 2013-2014 nexB Inc.',
861861
'description': u'AboutCode is a tool\nfor files.',
862-
'license': u'apache-2.0',
862+
'license_key': u'apache-2.0',
863863
'license_expression': u'apache-2.0',
864864
'name': u'AboutCode',
865865
'owner': u'nexB Inc.'}
@@ -891,7 +891,7 @@ def test_About_as_dict_with_present(self):
891891
'description': u'AboutCode is a tool\nfor files.',
892892
'download_url': u'',
893893
'homepage_url': u'',
894-
'license': u'apache-2.0',
894+
'license_key': u'apache-2.0',
895895
'license_expression': u'apache-2.0',
896896
'license_file': u'',
897897
'license_name': u'',
@@ -930,7 +930,7 @@ def test_About_as_dict_with_nothing(self):
930930
expected = {'about_resource': u'.',
931931
'copyright': u'Copyright (c) 2013-2014 nexB Inc.',
932932
'description': u'AboutCode is a tool\nfor files.',
933-
'license': u'apache-2.0',
933+
'license_key': u'apache-2.0',
934934
'license_expression': u'apache-2.0',
935935
'name': u'AboutCode',
936936
'owner': u'nexB Inc.'}

tests/testdata/as_dict/about.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author:
66
description: |
77
AboutCode is a tool
88
for files.
9-
license: apache-2.0
9+
license_key: apache-2.0
1010
license_expression: apache-2.0
1111
copyright: Copyright (c) 2013-2014 nexB Inc.
1212
custom1: some custom

tests/testdata/dumps/complete2/about.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ vcs_repository: https://github.com/dejacode/about-code-tool.git
1717
description: AboutCode is a tool to process ABOUT files.
1818
An ABOUT file is a file.
1919

20-
license: apache-2.0
20+
license_key: apache-2.0
2121
license_expression: apache-2.0
2222
license_file: apache-2.0.LICENSE
2323
copyright: Copyright (c) 2013-2014 nexB Inc.

tests/testdata/inventory/basic/about/about.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ description: AboutCode is a tool
1515
to process ABOUT files.
1616
An ABOUT file is a file.
1717

18-
license: apache-2.0
18+
license_key: apache-2.0
1919
license_expression: apache-2.0
2020
license_file: apache-2.0.LICENSE
2121
copyright: Copyright (c) 2013-2014 nexB Inc.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,author_file,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,checksum_sha256,spec_version
1+
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license_key,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,author_file,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,checksum_sha256,spec_version
22
/about/about.ABOUT,.,.,AboutCode,0.11.0,,AboutCode is a tool to process ABOUT files. An ABOUT file is a file.,http://dejacode.org,,apache-2.0,apache-2.0,,apache-2.0.LICENSE,,Copyright (c) 2013-2014 nexB Inc.,NOTICE,,,,,,,nexB Inc.,,,"Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez",,git,https://github.com/dejacode/about-code-tool.git,,,,,,,,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,author_file,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,checksum_sha256,spec_version
1+
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license_key,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,author_file,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,checksum_sha256,spec_version
22
/about/about_with_about_resource_path.ABOUT,"./apache-2.0.LICENSE
33
../../complex/about/apache-2.0.LICENSE",apache-2.0.LICENSE,Apache License 2.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

tests/testdata/inventory/complex/expected.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,spec_version,author_file,dje_license,keywords,license_text_file
1+
about_file_path,about_resource_path,about_resource,name,version,download_url,description,homepage_url,notes,license_key,license_expression,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_changes,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,spec_version,author_file,dje_license,keywords,license_text_file
22
/about/about.ABOUT,/about/,.,AboutCode,0.11.0,,"AboutCode is a tool
33
to process ABOUT files.
44
An ABOUT file is a file.",http://dejacode.org,,apache-2.0,apache-2.0,,apache-2.0.LICENSE,,Copyright (c) 2013-2014 nexB Inc.,NOTICE,,,,,,,nexB Inc.,,,"Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez",git,https://github.com/dejacode/about-code-tool.git,,,,,,,,,,,

0 commit comments

Comments
 (0)