Skip to content

Commit

Permalink
Merge pull request #16 from fosslight/temp
Browse files Browse the repository at this point in the history
Add a FOSSLight Reuse
  • Loading branch information
soimkim authored Feb 9, 2022
2 parents 8f0b52c + 1e62299 commit c8957c3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ pyyaml
fosslight_util>=1.3.8
fosslight_dependency>=3.7.4
fosslight_binary
fosslight_reuse
1 change: 0 additions & 1 deletion src/fosslight_scanner/_get_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def get_input_mode():
url_to_analyze = get_input("Enter the link to analyze:", "")
else:
src_path = get_input("Please enter the path to analyze:", "")
dep_path = src_path

dep_arguments = get_input(
"Please enter arguments for dependency analysis:", "")
Expand Down
19 changes: 19 additions & 0 deletions src/fosslight_scanner/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# FOSSLight Scanner
# Copyright (c) 2020 LG Electronics Inc.
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import logging
from shutil import copy
import fosslight_util.constant as constant

logger = logging.getLogger(constant.LOGGER_NAME)


def copy_file(source, destination):
try:
dest = copy(source, destination)
except Exception as ex:
logger.debug(f"Failed to copy {source} to {destination}: {ex}")
9 changes: 9 additions & 0 deletions src/fosslight_scanner/fosslight_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from fosslight_util.timer_thread import TimerThread
import fosslight_util.constant as constant
from fosslight_util.output_format import write_output_file, check_output_format
from fosslight_reuse._fosslight_reuse import run_lint as reuse_lint
from .common import copy_file

OUTPUT_EXCEL_PREFIX = "FOSSLight-Report_"
OUTPUT_JSON_PREFIX = "Opossum_input_"
Expand Down Expand Up @@ -159,6 +161,13 @@ def run(src_path, dep_arguments, output_path, remove_raw_data=True,
"DEP": "FL_Dependency.xlsx",
"REUSE": "reuse.xml"}

output_reuse = os.path.join(_output_dir, output_files["REUSE"])
success, result = call_analysis_api(src_path, "Reuse Lint",
-1, reuse_lint,
abs_path, "", False,
output_reuse)
copy_file(output_reuse, output_path)

success, result = call_analysis_api(src_path, "Source Analysis",
2, run_scancode.run_scan,
abs_path,
Expand Down

0 comments on commit c8957c3

Please sign in to comment.