Skip to content

Commit 469a061

Browse files
committed
Use OrderedDict when dumping ABOUT files
This ensure that we have a stable order on all OSes Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 82fce52 commit 469a061

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/attributecode/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ def dumps(self, use_mapping=False, mapping_file=False, with_absent=False, with_e
10811081
If with_absent, include absent (not present) fields.
10821082
If with_empty, include empty fields.
10831083
"""
1084-
about_data = {}
1084+
about_data = OrderedDict()
10851085
# Group the same license information (name, url, file) together
10861086
license_key = []
10871087
license_name = []
@@ -1110,7 +1110,7 @@ def dumps(self, use_mapping=False, mapping_file=False, with_absent=False, with_e
11101110
# Group the same license information in a list
11111111
license_group = list(zip_longest(license_key, license_name, license_file, license_url))
11121112
for lic_group in license_group:
1113-
lic_dict = {}
1113+
lic_dict = OrderedDict()
11141114
if lic_group[0]:
11151115
lic_dict['key'] = lic_group[0]
11161116
if lic_group[1]:

tests/test_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ def test_About_dumps(self):
725725
An ABOUT file is a file.
726726
homepage_url: http://dejacode.org
727727
licenses:
728-
- file: apache-2.0.LICENSE
729-
key: apache-2.0
728+
- key: apache-2.0
729+
file: apache-2.0.LICENSE
730730
notice_file: NOTICE
731731
owner: nexB Inc.
732732
vcs_repository: https://github.com/dejacode/about-code-tool.git

0 commit comments

Comments
 (0)