|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | # |
3 | | -# Copyright (c) 2017 nexB Inc. and others. All rights reserved. |
| 3 | +# Copyright (c) 2019 nexB Inc. and others. All rights reserved. |
4 | 4 | # http://nexb.com and https://github.com/nexB/scancode-toolkit/ |
5 | 5 | # The ScanCode software is licensed under the Apache License version 2.0. |
6 | 6 | # Data generated with ScanCode require an acknowledgment. |
|
56 | 56 | - the DejaCode licenses |
57 | 57 |
|
58 | 58 | Run python synclic.py -h for help. |
59 | | -
|
60 | 59 | """ |
61 | 60 |
|
| 61 | + |
62 | 62 | TRACE = True |
63 | 63 | TRACE_ADD = True |
64 | 64 | TRACE_FETCH = True |
@@ -434,10 +434,6 @@ def build_license(self, mapping, scancode_licenses): |
434 | 434 |
|
435 | 435 | other_urls = list(other_urls) |
436 | 436 |
|
437 | | -# notes = mapping.get('licenseComments') |
438 | | -# if notes and notes.strip(): |
439 | | -# notes = 'Per SPDX.org, ' + ' '.join(notes.split()) |
440 | | - |
441 | 437 | standard_notice = mapping.get('standardLicenseHeader') or '' |
442 | 438 | if standard_notice: |
443 | 439 | standard_notice = clean_text(standard_notice) |
@@ -545,11 +541,7 @@ def build_license(self, mapping, scancode_licenses): |
545 | 541 | # these licenses are combos of many others and are ignored: we detect |
546 | 542 | # instead each part of the combo |
547 | 543 | dejacode_special_composites = set([ |
548 | | - 'lzma-sdk-2006', |
549 | | - 'intel-bsd-special', |
550 | | - 'openssh', |
551 | | - 'aes-128-3.0', |
552 | | - 'stlport-2000', |
| 544 | + 'intel-bsd-special', |
553 | 545 | ]) |
554 | 546 | is_combo = key in dejacode_special_composites |
555 | 547 | if is_combo: |
@@ -772,27 +764,35 @@ def license_to_dict(lico): |
772 | 764 | Return an OrderedDict of license data with texts for API calls. |
773 | 765 | Fields with empty values are not included. |
774 | 766 | """ |
775 | | - return dict( |
| 767 | + licm = dict( |
776 | 768 | is_active=False, |
777 | 769 | reviewed=False, |
778 | 770 | license_status='NotReviewed', |
779 | 771 | is_component_license=False, |
780 | | - |
781 | 772 | key=lico.key, |
782 | 773 | short_name=lico.short_name, |
783 | 774 | name=lico.name, |
784 | 775 | category=lico.category, |
785 | 776 | owner=lico.owner, |
786 | | - homepage_url=lico.homepage_url, |
787 | | - reference_notes=lico.notes, |
788 | | - full_text=lico.text, |
789 | | - is_exception=lico.is_exception, |
790 | | - spdx_license_key=lico.spdx_license_key, |
791 | | - text_urls='\n'.join(lico.text_urls), |
792 | | - osi_url=lico.osi_url, |
793 | | - faq_url=lico.faq_url, |
794 | | - other_urls='\n'.join(lico.other_urls), |
| 777 | + is_exception=lico.is_exception |
795 | 778 | ) |
| 779 | + if lico.text: |
| 780 | + licm.update(full_text=lico.text) |
| 781 | + if lico.homepage_url: |
| 782 | + licm.update(homepage_url=lico.homepage_url) |
| 783 | + if lico.spdx_license_key: |
| 784 | + licm.update(spdx_license_key=lico.spdx_license_key) |
| 785 | + if lico.notes: |
| 786 | + licm.update(reference_notes=lico.notes) |
| 787 | + if lico.text_urls: |
| 788 | + licm.update(text_urls='\n'.join(lico.text_urls)) |
| 789 | + if lico.osi_url: |
| 790 | + licm.update(osi_url=lico.osi_url) |
| 791 | + if lico.faq_url: |
| 792 | + licm.update(faq_url=lico.faq_url) |
| 793 | + if lico.other_urls: |
| 794 | + licm.update(other_urls='\n'.join(lico.other_urls)) |
| 795 | + return licm |
796 | 796 |
|
797 | 797 |
|
798 | 798 | EXTERNAL_LICENSE_SYNCHRONIZATION_SOURCES = { |
@@ -863,12 +863,15 @@ def update_external(_attrib, _sc_val, _ext_val): |
863 | 863 | # special case for URL lists, we consider all URL fields to |
864 | 864 | # update |
865 | 865 | if attrib.endswith('_urls',): |
866 | | - all_sc_urls = set(list(normalized_scancode_value) |
867 | | - +scancode_license.text_urls |
868 | | - +scancode_license.other_urls |
869 | | - +[scancode_license.homepage_url, |
870 | | - scancode_license.osi_url, |
871 | | - scancode_license.faq_url]) |
| 866 | + all_sc_urls = set( |
| 867 | + list(normalized_scancode_value) + |
| 868 | + scancode_license.text_urls + |
| 869 | + scancode_license.other_urls + |
| 870 | + [scancode_license.homepage_url, |
| 871 | + scancode_license.osi_url, |
| 872 | + scancode_license.faq_url |
| 873 | + ] |
| 874 | + ) |
872 | 875 | all_sc_urls = set(u for u in all_sc_urls if u) |
873 | 876 | new_other_urls = normalize_external_value.difference(all_sc_urls) |
874 | 877 | # add other urls to ScanCode |
|
0 commit comments