Skip to content

Commit 63fdeeb

Browse files
committed
Update lic_ref template file, some code enhancement and add @ in the
supported character list Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 8e7b7f5 commit 63fdeeb

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
2021-xx-xx
1+
2022-xx-xx
22
Release 7.0.0
33

4-
* Add '@' as a support character for filename #451
4+
* Add '@' as a supported character for filename #451
55
* Add support to collect redistributable sources #22
66
* Handle trailing spaces in field names during `transform` #456
77
* Remove restriction of python27 only on windows #453
@@ -18,6 +18,8 @@
1818
* Add option to save error log in `check` command
1919
* New `gen_license` option
2020
* Bump PyYAML to 6.0
21+
* Add '%" as a supported character
22+
* Update default template
2123

2224
2021-04-02
2325
Release 6.0.0

src/attributecode/attrib.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def generate(abouts, is_about_input, license_dict, scancode, min_license_score,
8888
url = ''
8989
text = list(about.license_file.value.values())[index]
9090
license_object = License(key, name, filename, url, text)
91-
licenses_list.append(license_object)
91+
licenses_list.append(license_object)
9292
index = index + 1
9393
else:
9494
for key in license_dict:
@@ -163,9 +163,10 @@ def generate(abouts, is_about_input, license_dict, scancode, min_license_score,
163163
lic_name_expression_list.append(segment)
164164
# Join the license name expression into a single string
165165
lic_name_expression = ' '.join(lic_name_expression_list)
166-
166+
167167
# Add the license name expression string into the about object as a list
168-
about.license_name_expression = lic_name_expression
168+
about.license_name_expression.value = lic_name_expression
169+
about.license_name_expression.present = True
169170

170171
# Sort the about objects by name
171172
abouts = sorted(abouts, key=lambda x: x.name.value.lower())

src/attributecode/model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ def set_standard_fields(self):
774774
('notes', StringField()),
775775

776776
('license_expression', StringField()),
777+
('license_name_expression', StringField()),
777778
('license_key', ListField()),
778779
('license_name', ListField()),
779780
('license_file', FileTextField()),

src/attributecode/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def to_posix(path):
5555
UNC_PREFIX_POSIX = to_posix(UNC_PREFIX)
5656
UNC_PREFIXES = (UNC_PREFIX_POSIX, UNC_PREFIX,)
5757

58-
valid_file_chars = string.digits + string.ascii_letters + '_-.+()~[]{}|@' + ' '
58+
valid_file_chars = string.digits + string.ascii_letters + '_-.+()~[]{}|@%' + ' '
5959

6060

6161
def invalid_chars(path):

templates/license_ref.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This document lists the open source and third-party components of a {{ vartext['
4242
<p>License Gallery URL: <a href="{{ license.url }}">{{license.url}}</a> </p>
4343
{% endif %}
4444
{% endif %}
45-
{% if license.key in about_object.license_key.value %}
45+
{% if license.key in about_object.license_key.value %}
4646
<li>{{ about_object.name.value }}{% if about_object.version.value %} - Version {{ about_object.version.value }}{% endif %}</li>
4747
{% if about_object.copyright.value %}
4848
<pre>Copyright: {{about_object.copyright.value}}</pre>

0 commit comments

Comments
 (0)