Skip to content

Commit a25edcc

Browse files
committed
Merge branch 'develop'
2 parents ac4d03f + 1ce4046 commit a25edcc

13 files changed

+31
-24
lines changed

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ third-party software components that you use in your project.
1010
You start by storing ABOUT files (a small YAML formatted text file with field/value pairs)
1111
side-by-side with each of the third-party software components you use.
1212
Each ABOUT file documents origin and license for one software.
13-
For more information on the ABOUT file format, visit http://www.dejacode.org
1413
There are many examples of ABOUT files (valid or invalid) in the testdata/
1514
directory of the whole repository.
1615

REFERENCE.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ Options
8383
$ about attrib --vartext "title=Attribution Notice" --vartext "header=Product 101" LOCATION OUTPUT
8484

8585
Users can use the following in the template to get the vartext:
86-
{{ vartext_dict['title'] }}
87-
{{ vartext_dict['header'] }}
86+
{{ variables['title'] }}
87+
{{ variables['header'] }}
8888

8989
--verbose
9090

about.ABOUT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
about_resource: .
22
name: AboutCode-toolkit
3-
version: 4.0.1
3+
version: 4.0.2
44
author: Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez
5-
copyright: Copyright (c) 2013-2019 nexB Inc.
5+
copyright: Copyright (c) 2013-2020 nexB Inc.
66
description: |
77
AboutCode Toolkit is a tool to process ABOUT files. An ABOUT file
88
provides a simple way to document the provenance (origin and license)

docs/CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2020-05-05
2+
Release 4.0.2
3+
4+
* Upgrade license-expression library to v1.2
5+
* Fix the missing `multi_sort` filter for Jinja2
6+
* Update help text for `--vartext`
7+
8+
19
2019-10-17
210
Release 4.0.1
311

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def read(*names, **kwargs):
2424

2525
setup(
2626
name='aboutcode-toolkit',
27-
version='4.0.1',
27+
version='4.0.2',
2828
license='Apache-2.0',
2929
description=(
3030
'AboutCode-toolkit is a tool to document the provenance (origin and license) of '

src/attributecode/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf8 -*-
33

44
# ============================================================================
5-
# Copyright (c) 2013-2019 nexB Inc. http://www.nexb.com/ - All rights reserved.
5+
# Copyright (c) 2013-2020 nexB Inc. http://www.nexb.com/ - All rights reserved.
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
@@ -31,12 +31,12 @@
3131

3232
import saneyaml
3333

34-
__version__ = '4.0.1'
34+
__version__ = '4.0.2'
3535

3636
__about_spec_version__ = '3.1.4'
3737

3838
__copyright__ = """
39-
Copyright (c) 2013-2019 nexB Inc. All rights reserved. http://dejacode.org
39+
Copyright (c) 2013-2020 nexB Inc. All rights reserved. http://dejacode.org
4040
Licensed under the Apache License, Version 2.0 (the "License");
4141
you may not use this file except in compliance with the License.
4242
You may obtain a copy of the License at

src/attributecode/attrib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf8 -*-
33

44
# ============================================================================
5-
# Copyright (c) 2013-2019 nexB Inc. http://www.nexb.com/ - All rights reserved.
5+
# Copyright (c) 2013-2020 nexB Inc. http://www.nexb.com/ - All rights reserved.
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
@@ -32,6 +32,7 @@
3232
from attributecode.licenses import COMMON_LICENSES
3333
from attributecode.model import parse_license_expression
3434
from attributecode.util import add_unc
35+
from attributecode.attrib_util import multi_sort
3536

3637

3738
DEFAULT_TEMPLATE_FILE = os.path.join(
@@ -145,6 +146,7 @@ def check_template(template_string):
145146
message) if the template is invalid or None if it is valid.
146147
"""
147148
try:
149+
jinja2.filters.FILTERS['multi_sort'] = multi_sort
148150
jinja2.Template(template_string)
149151
except (jinja2.TemplateSyntaxError, jinja2.TemplateAssertionError) as e:
150152
return e.lineno, e.message

src/attributecode/cmd.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def about():
107107

108108
def validate_key_values(ctx, param, value):
109109
"""
110-
Return the a dict of {key: [values,...] if valid or raise a UsageError
110+
Return the a dict of {key: value} if valid or raise a UsageError
111111
otherwise.
112112
"""
113113
if not value:
@@ -523,7 +523,7 @@ def get_error_messages(errors, quiet=False, verbose=False):
523523
def parse_key_values(key_values):
524524
"""
525525
Given a list of "key=value" strings, return:
526-
- a dict {key: [value, value, ...]}
526+
- a dict {key: value}
527527
- a sorted list of unique error messages for invalid entries where there is
528528
a missing a key or value.
529529
"""
@@ -545,9 +545,7 @@ def parse_key_values(key_values):
545545
errors.add('missing <value> in "{key_value}".'.format(**locals()))
546546
continue
547547

548-
values = parsed_key_values[key]
549-
if value not in values:
550-
parsed_key_values[key].append(value)
548+
parsed_key_values[key] = value
551549

552550
return dict(parsed_key_values), sorted(errors)
553551

tests/test_cmd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ def test_parse_key_values_simple(self):
307307
'keY=bar',
308308
]
309309
expected = {
310-
'key': ['value', 'bar'],
311-
'this': ['THat']
310+
'key': 'bar',
311+
'this': 'THat'
312312
}
313313
keyvals, errors = cmd.parse_key_values(test)
314314
assert expected == keyvals
@@ -323,7 +323,7 @@ def test_parse_key_values_with_errors(self):
323323
'FOO=bar'
324324
]
325325
expected = {
326-
'foo': ['bar'],
326+
'foo': 'bar',
327327
}
328328
keyvals, errors = cmd.parse_key_values(test)
329329
assert expected == keyvals
-19.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)