Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New plugin architecture #885

Merged
merged 122 commits into from
Feb 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
065d0a3
Support multiple options for pre-scan plugins #787
yashdsaraf Nov 16, 2017
6095fb1
Added MakeHuman Exception License
SaravananOffl Nov 14, 2017
4f0475c
formatted LICENSE file and removed rules
SaravananOffl Nov 14, 2017
5a304fd
Refactor post scan plugins so they can have command line options
Nov 23, 2017
f41bca6
Improve documentation of PostScanPlugin.process_results()
Nov 24, 2017
403b1b2
Rename get_click_options() to get_options()
Nov 24, 2017
5f4c626
Allow post-scan plugins to take options other than boolean flags
Nov 24, 2017
612cf68
Use a common BasePlugin class for all plugins #787
pombredanne Dec 10, 2017
b765432
Inline fileutils imports #787
pombredanne Jan 2, 2018
7f9b74c
Use proper import in prep for Python 3 #787
pombredanne Jan 2, 2018
cff89ad
Update help text test to match latest code #787
pombredanne Jan 2, 2018
75908e7
Use class method for get_plugin_options #787
pombredanne Jan 2, 2018
586d392
Use scans_cache_class not scan_cache_class #787
pombredanne Jan 2, 2018
66ec6dc
Extract function to get_cache_dir #787
pombredanne Jan 2, 2018
81780ea
Ensure all tests pass #787
pombredanne Jan 2, 2018
d9f8ec1
Remove junk print statements
pombredanne Jan 3, 2018
4f143b7
Streamline core CLI and plugins processing
pombredanne Jan 3, 2018
7ef1cba
Use resource_iter everywhere #787
pombredanne Jan 5, 2018
a6446c9
Do not use on-disk file log. Improve pre-scan plugins #787
pombredanne Jan 5, 2018
0c3625b
Add new extract_zip_raw test function
pombredanne Jan 5, 2018
9884c9f
Bump attrs and add typing library #787
pombredanne Jan 5, 2018
f8eabb3
Make info a regular scan and other CLI loop reorg #787
pombredanne Jan 6, 2018
40835fd
Remove diag arg from get_resources() #787
pombredanne Jan 6, 2018
3be4577
Add function to skip first or last iterable item #787
pombredanne Jan 10, 2018
b5e627c
Change interruptible returned values #787
pombredanne Jan 11, 2018
e9cd4e5
Ensure api function return a list #787
pombredanne Jan 11, 2018
59bef89
Use latest attrs and typing #787
pombredanne Jan 11, 2018
683ca26
Add file base_name to info scans #787
pombredanne Jan 12, 2018
0279764
Replace path_to_bytes/unicode by fsen/decode #787
pombredanne Jan 12, 2018
4ba3b77
Improve base plugins design #787
pombredanne Jan 12, 2018
9613d65
Refine scan utilities
pombredanne Jan 12, 2018
e891d07
Use fsencode/fsdecode throughout #787
pombredanne Jan 12, 2018
261fcb9
Improve Codebase and Resource implementation #787
pombredanne Jan 12, 2018
45cf069
Use a Codebase in pre-scan and post-scan plugins #787
pombredanne Jan 12, 2018
b1949e9
Resources are now topdown and sorted by name in outputs #787
pombredanne Jan 12, 2018
da79dc2
Improve plugins and codebase handling in cli #787
pombredanne Jan 12, 2018
024072c
Ensure SPDX RDF tests are always sorted #787
pombredanne Jan 12, 2018
c5014c7
Simplify Plugin init arguments
pombredanne Jan 12, 2018
1095bf3
Update test data #787
pombredanne Jan 16, 2018
60dc3fd
Update test to use new format options #787
pombredanne Jan 16, 2018
4d0d7e3
Update functions doc #787
pombredanne Jan 16, 2018
7428299
Add new timed function decorator to time execution #787
pombredanne Jan 16, 2018
6f1ddd2
Improve handling of re._MAXCACHE
pombredanne Jan 17, 2018
c6a0317
Restore correct SPDX output tests results #787
pombredanne Jan 17, 2018
f5c7a97
Add new plugin system for output #787 #789
pombredanne Jan 17, 2018
b160cd7
Add new output_filter stage and plugins #787
pombredanne Jan 17, 2018
a19d625
Add new housekeeping stage and plugins #787
pombredanne Jan 17, 2018
861e9a1
Add new scan stage and plugins #787 #552 #698
pombredanne Jan 17, 2018
5b5c85c
Add new output_filter stage and plugins #787
pombredanne Jan 17, 2018
c7ec297
Update pre and post-scan plugins to new architecture
pombredanne Jan 17, 2018
60bdb24
New plugin and CLi architecture #787 #552
pombredanne Jan 17, 2018
72bfdbd
Fix typo in configure message
pombredanne Jan 18, 2018
f66f13d
Update release script output options #787
pombredanne Jan 18, 2018
d69e959
Improve CLI options handling #787
pombredanne Jan 18, 2018
43cd8cb
Rename Pluggy impl spec from output to output_impl #787
pombredanne Jan 19, 2018
d7fb3ed
Fix spacing #787
pombredanne Jan 19, 2018
04159b9
Catch errors in the execution of scan stages #787
pombredanne Jan 19, 2018
a1c7053
Refine comment on temp file usage
pombredanne Jan 19, 2018
ab4a3a0
Remove housekeeping stage which is not needed #787
pombredanne Jan 19, 2018
66047ac
Implement new cache and temp_dir #685 #357
pombredanne Jan 23, 2018
2d4aa6b
Cosmetic
pombredanne Jan 23, 2018
73cea2a
Make license reindex use default cache for now #685 #357
pombredanne Jan 23, 2018
6285f0e
Add test for compute_counts
pombredanne Jan 23, 2018
533ff36
Use correct location for version file #685 #357
pombredanne Jan 23, 2018
43ba290
Use proper plugin name for only-findings
pombredanne Jan 23, 2018
f2fe20f
Use proper name for setup stage #787
pombredanne Jan 23, 2018
cefb0f6
Use proper name for setup stage #787
pombredanne Jan 23, 2018
92de6c6
Simplify only-findings codebase.walk #685 #357
pombredanne Jan 23, 2018
0b30649
Correct codebase.compute_counts #685 #357
pombredanne Jan 23, 2018
fae1e76
Do not reindex licenses during configure #685 #357
pombredanne Jan 24, 2018
01a87b6
Prefix all temp dirs with "scancode-" configure #685 #357
pombredanne Jan 24, 2018
45a080a
Use cache_dir and SCANCODE_DEV_MODE correctly #685 #357
pombredanne Jan 24, 2018
2c94a70
Add setup() to plugin_license #685 #357
pombredanne Jan 24, 2018
aeef8f9
Remove SCANCODE_DEBUG_LICENSE env var. Not used
pombredanne Jan 24, 2018
cdd4179
Use cache_dir and SCANCODE_DEV_MODE correctly #685 #357
pombredanne Jan 24, 2018
d00b75d
Improve license matching thresholds #889
pombredanne Jan 24, 2018
b34989c
Fix scan logging #787
pombredanne Jan 24, 2018
622c5a0
Compute stage and scan timing correctly #787
pombredanne Jan 24, 2018
69d2bc6
Ensure that the new --timing CLI options works #787
pombredanne Jan 24, 2018
ac28e69
Use posix paths for tests on all OSes #787
pombredanne Jan 24, 2018
9230d81
Make scancode_config._create_dir work on Win #685 #357
pombredanne Jan 24, 2018
017bc81
Add extra timeout for failing windows tests #685 #357
pombredanne Jan 24, 2018
0efe66c
Add extra timeout for failing windows tests #685 #357
pombredanne Jan 24, 2018
911e8cb
Add extra debug infor for failing windows tests #685 #357
pombredanne Jan 24, 2018
2efcd99
Ensure that to_dict works with not-set values #787
pombredanne Jan 25, 2018
ca2621f
Use less deep path on Windows
pombredanne Jan 25, 2018
8d77d0a
Shorten cpoyright test file names for Windows #787
pombredanne Jan 25, 2018
3639ac9
Correct test failures #787 #685 #357
pombredanne Jan 26, 2018
1d8a43d
Make multiprocessing working on Windows #787 #685 #357
pombredanne Jan 26, 2018
e7aabf1
Use NOQA tags consistently. Cleanup up dead code
pombredanne Jan 26, 2018
481f9e1
Improve CLI help text
pombredanne Jan 26, 2018
5c6eae5
Improve scan test run calls. Cleanup and format code
pombredanne Jan 26, 2018
e8d0df7
Rename test files to work on Windows
pombredanne Jan 26, 2018
9981c63
Do not use expectedFailure on XPASS tests
pombredanne Jan 26, 2018
352507b
Remove Windows-specific test timeouts #787
pombredanne Jan 26, 2018
228143a
Bump help for Windows Python version
pombredanne Jan 26, 2018
93ee491
Reset expectedFailure for Windows tests
pombredanne Jan 26, 2018
21f86a6
Add debug print for Windows test failure
pombredanne Jan 26, 2018
2938852
Avoid using multiple processes in tests #787
pombredanne Jan 26, 2018
715e39d
Update Windows test expectations for failures
pombredanne Jan 26, 2018
cf278a8
Fix typoe in docstring
pombredanne Jan 26, 2018
f66a1fd
Ensure some failing tests run verbosely
pombredanne Jan 26, 2018
74797bc
Fix Windows unicode path test expectations
pombredanne Jan 26, 2018
1a4284b
Fix tracing output
pombredanne Jan 26, 2018
0ad11fe
Re-enable license cache warmup
pombredanne Jan 26, 2018
403e80c
Remove unused plugin test mode code
pombredanne Jan 26, 2018
877c03e
Correct bug in display of non-ascii progressbar
pombredanne Jan 26, 2018
cec427d
Allow scan attributes to be direct Resource attributes #787
pombredanne Feb 1, 2018
29d289b
Correct formatting of CSV outputs
pombredanne Feb 1, 2018
01c635f
Do not regen in tests
pombredanne Feb 1, 2018
cfa3f56
Correct API tests
pombredanne Feb 1, 2018
37fc25d
Fix comment grammar
pombredanne Feb 1, 2018
dc1c997
Add new simple splitext function working from a name
pombredanne Feb 1, 2018
fc2176a
Correct splitext_name function name in doctests
pombredanne Feb 2, 2018
8b4e46d
Remove obsolete TODO
pombredanne Feb 5, 2018
b8faffd
Correct codebasse cache handling at boundaries
pombredanne Feb 6, 2018
e7a06ee
Add convenience methods to Resource
pombredanne Feb 6, 2018
5c9f963
Do not trace copyrights with nltk by default
pombredanne Feb 6, 2018
439ad76
Correct brokrn archives error reporting
pombredanne Feb 6, 2018
141f445
Improve user feedback for missing plugins #787
pombredanne Feb 6, 2018
cf31564
Update test expectation for Windows
pombredanne Feb 6, 2018
5784b20
Update test expectation for macOS
pombredanne Feb 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
current_version = 2.2.1
files = setup.py src/scancode/__init__.py
files = setup.py src/scancode_config.py
commit = False
tag = False

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ docs/_build

# pyenv
/.python-version
/man/
4 changes: 2 additions & 2 deletions configure.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo OFF

@rem Copyright (c) 2015 nexB Inc. http://www.nexb.com/ - All rights reserved.
@rem Copyright (c) 2018 nexB Inc. http://www.nexb.com/ - All rights reserved.

@rem ################################
@rem # change these variables to customize this script locally
Expand Down Expand Up @@ -44,7 +44,7 @@ if not exist "c:\python27\python.exe" (
echo Do NOT install Python v3 or any 64 bits edition.
echo Instead download Python from this url and see the README.rst file for more details:
echo(
echo https://www.python.org/ftp/python/2.7.10/python-2.7.10.msi
echo https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi
echo(
exit /b 1
)
Expand Down
24 changes: 4 additions & 20 deletions etc/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@

import sys


"""
Check that we run a supported OS and architecture.
"""


def unsupported(platform):
print('Unsupported OS/platform %r.' % platform)
print('See https://github.com/nexB/scancode-toolkit/ for supported OS/platforms.')
print('Enter a ticket https://github.com/nexB/scancode-toolkit/issues asking for support of your OS/platform combo.')
sys.exit(1)


if sys.maxsize > 2 ** 32:
arch = '64'
else:
Expand All @@ -31,29 +32,12 @@ def unsupported(platform):
else:
unsupported(sys_platform)


supported_combos = {
'linux': ['32', '64'],
'win': ['32',],
'mac': ['64',],
'win': ['32', ],
'mac': ['64', ],
}

arches = supported_combos[os]
if arch not in arches:
unsupported(os + arch)


"""
Re/build the license cache on every configure run.
"""

def build_license_cache():
"""
Force a rebuild of the license cache on configure.
"""
from licensedcode import cache
print('* Building license index...')
cache.reindex()


build_license_cache()
10 changes: 5 additions & 5 deletions etc/conf/dev/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ def setup_dev_mode():
not rely on license data to remain untouched and will always check the
license index cache for consistency, rebuilding it if necessary.
"""
from scancode import root_dir
with open(os.path.join(root_dir, 'SCANCODE_DEV_MODE'), 'wb') as sdm:
from scancode_config import scancode_root_dir
with open(os.path.join(scancode_root_dir, 'SCANCODE_DEV_MODE'), 'wb') as sdm:
sdm.write('This is a tag file to notify that ScanCode is used in development mode.')


def setup_vscode():
"""
Add base settings for .vscode
"""
from scancode import root_dir
from scancode_config import scancode_root_dir
from commoncode.fileutils import create_dir
from commoncode.fileutils import copyfile

settings = os.path.join(root_dir, 'etc', 'vscode', 'settings.json')
settings = os.path.join(scancode_root_dir, 'etc', 'vscode', 'settings.json')

if os.path.exists(settings):
vscode = os.path.join(root_dir, '.vscode')
vscode = os.path.join(scancode_root_dir, '.vscode')
create_dir(vscode)
copyfile(settings, vscode)

Expand Down
4 changes: 1 addition & 3 deletions etc/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import shutil
import subprocess


# platform-specific file base names
sys_platform = str(sys.platform).lower()
on_win = False
Expand All @@ -79,7 +78,6 @@
raise Exception('Unsupported OS/platform %r' % sys_platform)
platform_names = tuple()


# common file basenames for requirements and scripts
base = ('base',)

Expand Down Expand Up @@ -213,7 +211,7 @@ def create_virtualenv(std_python, root_dir, tpp_dirs, quiet=False):

def activate(root_dir):
""" Activate a virtualenv in the current process."""
print("* Activating ...")
# print("* Activating...")
bin_dir = os.path.join(root_dir, 'bin')
activate_this = os.path.join(bin_dir, 'activate_this.py')
with open(activate_this) as f:
Expand Down
43 changes: 31 additions & 12 deletions etc/release/release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2017 nexB Inc. http://www.nexb.com/ - All rights reserved.
# Copyright (c) 2018 nexB Inc. http://www.nexb.com/ - All rights reserved.
#

# ScanCode release script
Expand Down Expand Up @@ -52,17 +52,36 @@ function test_scan {
# this is needed for the zip
chmod o+x scancode extractcode

# minimal test: update when new scans are available
./scancode --quiet -lcip apache-2.0.LICENSE test_scan.json
echo "TEST JSON passed: ./scancode --quiet -lcip apache-2.0.LICENSE test_scan.json"
./scancode --quiet -lcip --format json-pp apache-2.0.LICENSE test_scan.json
echo "TEST JSON-PP passed: ./scancode --quiet -lcip --format json-pp apache-2.0.LICENSE test_scan.json"
./scancode --quiet -lcip --format html apache-2.0.LICENSE test_scan.html
echo "TEST HTML passed: ./scancode --quiet -lcip --format html apache-2.0.LICENSE test_scan.html"
./scancode --quiet -lcip --format html-app apache-2.0.LICENSE test_scan_app.html
echo "TEST HTML-APP passed: ./scancode --quiet -lcip --format html-app apache-2.0.LICENSE test_scan_app.html"
./extractcode --quiet samples/arch
echo "TEST EXTRACTCODE passed: ./extractcode --quiet samples/arch"
# minimal tests: update when new scans are available
cmd="./scancode --quiet -lcip apache-2.0.LICENSE --json test_scan.json"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

cmd="./scancode --quiet -lcip apache-2.0.LICENSE --json-pp test_scan.json"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

cmd="./scancode --quiet -lcip apache-2.0.LICENSE --output-html test_scan.html"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

cmd="./scancode --quiet -lcip apache-2.0.LICENSE --output-html-app test_scan_app.html"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

cmd="./scancode --quiet -lcip apache-2.0.LICENSE --output-spdx-tv test_scan.spdx"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

cmd="./extractcode --quiet samples/arch"
echo "RUNNING TEST: $cmd"
$cmd
echo "TEST PASSED"

# cleanup
cd ..
Expand Down
2 changes: 0 additions & 2 deletions etc/scripts/sch2js/sch2js.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@
from schematics.types.compound import ListType
from schematics.types.compound import ModelType


__version__ = '1.0.1.patch'


SCHEMATIC_TYPE_TO_JSON_TYPE = {
'NumberType': 'number',
'IntType': 'integer',
Expand Down
43 changes: 25 additions & 18 deletions etc/scripts/synclic.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,25 @@
from collections import OrderedDict
import json
import os
from os import mkdir
from os.path import exists
from os.path import join
import zipfile

import click
from os.path import realpath
click.disable_unicode_literals_warning = True
import requests

from commoncode import fileutils
from commoncode import fetch
from commoncode import fileutils

import licensedcode
from licensedcode.cache import get_licenses_db
from licensedcode.cache import get_index
from licensedcode.cache import get_licenses_db
from licensedcode.models import load_licenses
from licensedcode.models import License


"""
Sync and update the ScanCode licenses against:
- the SPDX license list
Expand All @@ -59,6 +62,7 @@
TRACE_DEEP = False
TRACE_FETCH = False


class ExternalLicensesSource(object):
"""
Base class to provide (including possibly fetch) licenses from an
Expand All @@ -80,44 +84,46 @@ def __init__(self, src_dir, match_text=False, match_approx=False):
"""
`src_dir` is where the License objects are dumped.
"""
src_dir = os.path.realpath(src_dir)
src_dir = realpath(src_dir)
self.src_dir = src_dir

self.match_text = match_text
self.match_approx = match_approx

self.fetched = False
if os.path.exists(src_dir):
if exists(src_dir):
# fetch ONLY if the directory is empty
self.fetched = True
else:
os.mkdir(src_dir)
mkdir(src_dir)

self.update_dir = self.src_dir.rstrip('\\/') + '-update'
if not os.path.exists(self.update_dir):
os.mkdir(self.update_dir)
if not exists(self.update_dir):
mkdir(self.update_dir)

self.new_dir = self.src_dir.rstrip('\\/') + '-new'
if not os.path.exists(self.new_dir):
os.mkdir(self.new_dir)
if not exists(self.new_dir):
mkdir(self.new_dir)

self.del_dir = self.src_dir.rstrip('\\/') + '-del'
if not os.path.exists(self.del_dir):
os.mkdir(self.del_dir)
if not exists(self.del_dir):
mkdir(self.del_dir)

self.scancodes_by_key = get_licenses_db()

self.scancodes_by_spdx_key = {l.spdx_license_key.lower(): l
for l in self.scancodes_by_key.values()
if l.spdx_license_key}

composites_dir = os.path.join(licensedcode.data_dir, 'composites', 'licenses')
composites_dir = join(
licensedcode.models.data_dir, 'composites', 'licenses')
self.composites_by_key = load_licenses(composites_dir, with_deprecated=True)
self.composites_by_spdx_key = {l.spdx_license_key.lower(): l
for l in self.composites_by_key.values()
if l.spdx_license_key}

foreign_dir = os.path.join(licensedcode.data_dir, 'non-english', 'licenses')
foreign_dir = join(
licensedcode.models.data_dir, 'non-english', 'licenses')
self.non_english_by_key = load_licenses(foreign_dir, with_deprecated=True)
self.non_english_by_spdx_key = {l.spdx_license_key.lower(): l
for l in self.non_english_by_key.values()
Expand Down Expand Up @@ -449,8 +455,8 @@ def __init__(self, src_dir, match_text=False, match_approx=False,
api_base_url=None, api_key=None):
super(DejaSource, self).__init__(src_dir, match_text, match_approx)

self.api_base_url = api_base_url or os.environ.get('DEJACODE_API_URL', None)
self.api_key = api_key or os.environ.get('DEJACODE_API_KEY', None)
self.api_base_url = api_base_url or os.getenv('DEJACODE_API_URL')
self.api_key = api_key or os.getenv('DEJACODE_API_KEY')

assert (self.api_key and self.api_base_url), (
'You must set the DEJACODE_API_URL and DEJACODE_API_KEY ' +
Expand Down Expand Up @@ -608,11 +614,13 @@ def merge_licenses(scancode_license, other_license, updatable_attributes):
(attribute name, value before, value after)
"""
scancode_updated = []

def update_sc(_attrib, _sc_val, _o_val):
setattr(scancode_license, _attrib, _o_val)
scancode_updated.append((_attrib, _sc_val, _o_val))

other_updated = []

def update_ot(_attrib, _sc_val, _o_val):
setattr(other_license, _attrib, _sc_val)
other_updated.append((_attrib, _o_val, _sc_val))
Expand Down Expand Up @@ -781,7 +789,7 @@ def synchronize_licenses(external_source):
if not TRACE:print('.', end='')

# Create a new ScanCode license
sc_license = ot_license.relocate(licensedcode.licenses_data_dir, o_key)
sc_license = ot_license.relocate(licensedcode.models.data_dir, o_key)
scancodes_added.add(sc_license.key)
scancodes_by_key[sc_license.key] = sc_license
if TRACE: print('Other license key not in ScanCode:', ot_license.key, 'created in ScanCode.')
Expand All @@ -793,7 +801,6 @@ def synchronize_licenses(external_source):
for k in others_changed | others_added:
others_by_key[k].dump()


# TODO: at last: print report of incorrect OTHER licenses to submit
# updates eg. make API calls to DejaCode to create or update
# licenses and submit review request e.g. submit requests to SPDX
Expand Down
9 changes: 5 additions & 4 deletions etc/scripts/test_json2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,17 @@ class TestJson2CSVWithLiveScans(FileBasedTesting):
test_data_dir = os.path.join(os.path.dirname(__file__), 'testdata')

def test_can_process_scan_from_json_scan(self):
import scancode
from scancode_config import scancode_root_dir
from commoncode.command import execute
test_dir = self.get_test_loc('livescan/scan')
json_file = self.get_temp_file('json')
scan_cmd = os.path.join(scancode.root_dir, 'scancode')
scan_cmd = os.path.join(scancode_root_dir, 'scancode')
rc, _stdout, _stderr = execute(scan_cmd,
['-clip', '--email', '--url', '--strip-root', '--format', 'json', test_dir, json_file])
assert rc == 0
['-clip', '--email', '--url', '--strip-root', test_dir,
'--json', json_file])
result_file = self.get_temp_file('.csv')
with open(result_file, 'wb') as rf:
json2csv.json_scan_to_csv(json_file, rf)
expected_file = self.get_test_loc('livescan/expected.csv')
check_csvs(result_file, expected_file, regen=False)
assert rc == 0
Loading