Skip to content

Commit be4e1eb

Browse files
committed
cli: Only create JSON acknowledgment if needed
This helps to keep the code for the individual output formats a bit more separate.
1 parent 31b1b0b commit be4e1eb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/scancode/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def wrap(self, timeout=None):
6262

6363
import click
6464
from click.termui import style
65-
import simplejson as json
6665

6766
from commoncode import filetype
6867
from commoncode import fileutils
@@ -132,8 +131,6 @@ def wrap(self, timeout=None):
132131
Visit https://github.com/nexB/scancode-toolkit/ for support and download.
133132
'''
134133

135-
acknowledgment_text_json = acknowledgment_text.strip().replace(' ', '')
136-
137134

138135
extra_notice_text = '''
139136
@@ -640,8 +637,10 @@ def save_results(files_count, scanned_files, format, input, output_file):
640637
echo_stderr('\nFailed to create HTML app.', fg='red')
641638

642639
elif format == 'json':
640+
import simplejson as json
641+
643642
meta = OrderedDict()
644-
meta['scancode_notice'] = acknowledgment_text_json
643+
meta['scancode_notice'] = acknowledgment_text.strip().replace(' ', '')
645644
meta['scancode_version'] = version
646645
meta['files_count'] = files_count
647646
# TODO: add scanning options to meta

0 commit comments

Comments
 (0)