Skip to content

Commit

Permalink
Merge pull request #118 from fosslight/develop
Browse files Browse the repository at this point in the history
Exclude specific file and folder
  • Loading branch information
bjk7119 authored Jul 31, 2024
2 parents 8b862fd + 9de88f3 commit fb3e8b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/fosslight_binary/binary_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
_REMOVE_FILE_COMMAND_RESULT = [
'data', 'timezone data', 'apple binary property list']
INCLUDE_FILE_COMMAND_RESULT = ['current ar archive']
_EXCLUDE_FILE_EXTENSION = ['class']
_EXCLUDE_FILE = ['fosslight_bin', 'fosslight_bin.exe']
_EXCLUDE_DIR = ["test", "tests", "doc", "docs"]
_EXCLUDE_DIR = ["test", "tests", "doc", "docs", "intermediates"]
_EXCLUDE_DIR = [os.path.sep + dir_name + os.path.sep for dir_name in _EXCLUDE_DIR]
_EXCLUDE_DIR.append("/.")
_REMOVE_DIR = ['.git']
Expand Down Expand Up @@ -106,7 +107,7 @@ def get_file_list(path_to_find, abs_path_to_exclude):
for exclude_path in abs_path_to_exclude):
continue
file_lower_case = file.lower()
extension = file_lower_case.split(".")[-1]
extension = os.path.splitext(file_lower_case)[1][1:].strip()

if extension == 'jar':
found_jar = True
Expand All @@ -127,6 +128,8 @@ def get_file_list(path_to_find, abs_path_to_exclude):
bin_item.set_exclude(True)
elif file.lower() in _EXCLUDE_FILE:
bin_item.set_exclude(True)
elif extension in _EXCLUDE_FILE_EXTENSION:
bin_item.set_exclude(True)
bin_list.append(bin_item)
file_cnt += 1
return file_cnt, bin_list, found_jar
Expand Down

0 comments on commit fb3e8b0

Please sign in to comment.