Skip to content

Commit c6deda7

Browse files
sschuberthpombredanne
authored andcommitted
Load notice text from NOTICE file
1 parent 0440d60 commit c6deda7

File tree

1 file changed

+10
-60
lines changed

1 file changed

+10
-60
lines changed

src/scancode/cli.py

Lines changed: 10 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -98,71 +98,21 @@ def wrap(self, timeout=None):
9898
info_text = '''
9999
ScanCode scans code and other files for origin and license.
100100
Visit https://github.com/nexB/scancode-toolkit/ for support and download.
101-
'''
102101
103-
# FIXME: we should load NOTICE instead
104-
notice_text = '''
105-
Software license
106-
================
107-
108-
Copyright (c) 2016 nexB Inc. and others. All rights reserved.
109-
http://nexb.com and https://github.com/nexB/scancode-toolkit/
110-
The ScanCode software is licensed under the Apache License version 2.0.
111-
Data generated with ScanCode require an acknowledgment.
112-
ScanCode is a trademark of nexB Inc.
113-
114-
You may not use this software except in compliance with the License.
115-
You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
116-
Unless required by applicable law or agreed to in writing, software distributed
117-
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
118-
CONDITIONS OF ANY KIND, either express or implied. See the License for the
119-
specific language governing permissions and limitations under the License.
120-
121-
When you publish or redistribute any data created with ScanCode or any ScanCode
122-
derivative work, you must accompany this data with the following acknowledgment:
123102
'''
124103

104+
with open(os.path.join(os.path.dirname(__file__), '..', '..', 'NOTICE'), 'r') as notice_file:
105+
notice_text = notice_file.read()
125106

126-
acknowledgment_text = '''
127-
Generated with ScanCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
128-
OR CONDITIONS OF ANY KIND, either express or implied. No content created from
129-
ScanCode should be considered or used as legal advice. Consult an Attorney
130-
for any legal advice.
131-
ScanCode is a free software code scanning tool from nexB Inc. and others.
132-
Visit https://github.com/nexB/scancode-toolkit/ for support and download.
133-
'''
134-
135-
136-
extra_notice_text = '''
137-
138-
Third-party software licenses
139-
=============================
107+
delimiter = '\n\n\n'
108+
[notice_text, extra_notice_text] = notice_text.split(delimiter, 1)
109+
extra_notice_text = delimiter + extra_notice_text
140110

141-
ScanCode embeds third-party free and open source software packages under various
142-
licenses including copyleft licenses. Some of the third-party software packages
143-
are delivered as pre-built binaries. The origin and license of these packages is
144-
documented by .ABOUT files.
111+
delimiter = '\n\n '
112+
[notice_text, acknowledgment_text] = notice_text.split(delimiter, 1)
113+
acknowledgment_text = delimiter + acknowledgment_text
145114

146-
The corresponding source code for pre-compiled third-party software is available
147-
for immediate download from the same release page where you obtained ScanCode at:
148-
https://github.com/nexB/scancode-toolkit/
149-
or https://github.com/nexB/scancode-thirdparty-src/
150-
151-
You may also contact us to request the source code by email at [email protected] or
152-
by postal mail at:
153-
nexB Inc., ScanCode open source code request
154-
735 Industrial Road, Suite #101, 94070 San Carlos, CA, USA
155-
Please indicate in your communication the ScanCode version for which you are
156-
requesting source code.
157-
158-
159-
License for ScanCode datasets
160-
=============================
161-
162-
ScanCode includes datasets (e.g. for license detection) that are dedicated
163-
to the Public Domain using the Creative Commons CC0 1.0 Universal (CC0 1.0)
164-
Public Domain Dedication: http://creativecommons.org/publicdomain/zero/1.0/
165-
'''
115+
acknowledgment_text_json = acknowledgment_text.strip().replace(' ', '')
166116

167117

168118
def print_about(ctx, param, value):
@@ -667,7 +617,7 @@ def save_results(files_count, scanned_files, format, input, output_file):
667617
import simplejson as json
668618

669619
meta = OrderedDict()
670-
meta['scancode_notice'] = acknowledgment_text.strip().replace(' ', '')
620+
meta['scancode_notice'] = acknowledgment_text_json
671621
meta['scancode_version'] = version
672622
meta['files_count'] = files_count
673623
# TODO: add scanning options to meta

0 commit comments

Comments
 (0)