Skip to content

Commit

Permalink
Merge pull request #61 from fosslight/temp_ci
Browse files Browse the repository at this point in the history
Check compliant except for files for which Exclude is True
  • Loading branch information
soimkim authored Jun 14, 2022
2 parents d61eee8 + e59b326 commit 56c9d56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
9 changes: 9 additions & 0 deletions src/fosslight_reuse/_constant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2022 LG Electronics Inc.
# SPDX-License-Identifier: GPL-3.0-only

DEFAULT_EXCLUDE_EXTENSION = ["jar", "png", "exe", "so", "a", "dll", "jpeg", "jpg", "ttf", "lib", "ttc", "pfb",
"pfm", "otf", "afm", "dfont", "json"]
OSS_PKG_INFO_FILES = ["oss-pkg-info.yaml", "oss-pkg-info.yml", "oss-package.info", "requirement.txt",
"requirements.txt", "package.json", "pom.xml", "build.gradle","podfile.lock", "cartfile.resolved"]
9 changes: 2 additions & 7 deletions src/fosslight_reuse/_fosslight_reuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
from reuse.project import Project
from reuse.report import ProjectReport
from fosslight_reuse._result import write_result_file, create_result_file, result_for_summary, ResultItem
from fosslight_reuse._constant import DEFAULT_EXCLUDE_EXTENSION, OSS_PKG_INFO_FILES

PKG_NAME = "fosslight_reuse"
REUSE_CONFIG_FILE = ".reuse/dep5"
DEFAULT_EXCLUDE_EXTENSION_FILES = [] # Exclude files from reuse
DEFAULT_EXCLUDE_EXTENSION = ["jar", "png", "exe", "so", "a", "dll", "jpeg", "jpg", "ttf", "lib", "ttc", "pfb",
"pfm", "otf", "afm", "dfont", "json"]
_turn_on_default_reuse_config = True
_check_only_file_mode = False
error_items = []
Expand All @@ -34,10 +33,6 @@

def find_oss_pkg_info(path):
global DEFAULT_EXCLUDE_EXTENSION_FILES
_OSS_PKG_INFO_FILES = ["oss-pkg-info.yaml", "oss-pkg-info.yml", "oss-package.info", "requirement.txt",
"requirements.txt", "package.json", "pom.xml",
"build.gradle",
"podfile.lock", "cartfile.resolved"]
oss_pkg_info = []

try:
Expand All @@ -47,7 +42,7 @@ def find_oss_pkg_info(path):
file_abs_path = os.path.join(root, file)
file_rel_path = os.path.relpath(file_abs_path, path)

if file_lower_case in _OSS_PKG_INFO_FILES or file_lower_case.startswith("module_license_"):
if file_lower_case in OSS_PKG_INFO_FILES or file_lower_case.startswith("module_license_"):
oss_pkg_info.append(file_rel_path)
elif is_binary(file_abs_path):
DEFAULT_EXCLUDE_EXTENSION_FILES.append(file_rel_path)
Expand Down
10 changes: 3 additions & 7 deletions src/fosslight_reuse/_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,13 @@ def result_for_summary(oss_pkg_info_files, license_missing_files, copyright_miss
for i, lic in enumerate(sorted(report.used_licenses)):
detected_lic.append(lic)

# Subtract license or copyright presenting file
license_missing_files = list(set(license_missing_files) - set(lic_present_files_in_yaml))
copyright_missing_files = list(set(copyright_missing_files) - set(cop_present_files_in_yaml))
# Subtract license or copyright presenting file and excluded file
license_missing_files = list(set(license_missing_files) - set(lic_present_files_in_yaml) - set(excluded_files))
copyright_missing_files = list(set(copyright_missing_files) - set(cop_present_files_in_yaml) - set(excluded_files))

if len(license_missing_files) == 0 and len(copyright_missing_files) == 0:
reuse_compliant = True

# Subtract excluded file
license_missing_files = list(set(license_missing_files) - set(excluded_files))
copyright_missing_files = list(set(copyright_missing_files) - set(excluded_files))

# Remove duplicated file
missing_both_files = list(set(license_missing_files) & set(copyright_missing_files))
license_missing_files = list(set(license_missing_files) - set(missing_both_files))
Expand Down

0 comments on commit 56c9d56

Please sign in to comment.