@@ -104,50 +104,6 @@ def find_package_manager(input_dir, abs_path_to_exclude=[]):
104104 return ret , found_package_manager , input_dir
105105
106106
107- def find_manifest_for_package_manager (package_manager , input_dir , abs_path_to_exclude = []):
108- ret = True
109- manifest_file_name = []
110-
111- value = const .SUPPORT_PACKAE [package_manager ]
112- if isinstance (value , list ):
113- manifest_file_name .extend (value )
114- else :
115- manifest_file_name .append (value )
116-
117- found_manifest_file = []
118- for (parent , _ , files ) in os .walk (input_dir ):
119- if len (files ) < 1 :
120- continue
121- if os .path .basename (parent ) in _exclude_dir :
122- continue
123- if os .path .abspath (parent ) in abs_path_to_exclude :
124- continue
125- for file in files :
126- file_path = os .path .join (parent , file )
127- file_abs_path = os .path .abspath (file_path )
128- if any (os .path .commonpath ([file_abs_path , exclude_path ]) == exclude_path
129- for exclude_path in abs_path_to_exclude ):
130- continue
131- if file in manifest_file_name :
132- found_manifest_file .append (file )
133- if len (found_manifest_file ) > 0 :
134- input_dir = parent
135- break
136-
137- found_package_manager = defaultdict (list )
138- for f_idx in found_manifest_file :
139- found_package_manager [package_manager ].append (f_idx )
140-
141- if len (found_package_manager ) >= 1 :
142- manifest_file_w_path = map (lambda x : os .path .join (input_dir , x ), found_manifest_file )
143- logger .info (f"Found the manifest file({ ',' .join (manifest_file_w_path )} ) automatically." )
144- else :
145- ret = False
146- logger .info ("It cannot find the manifest file." )
147-
148- return ret , found_package_manager , input_dir
149-
150-
151107def run_dependency_scanner (package_manager = '' , input_dir = '' , output_dir_file = '' , pip_activate_cmd = '' ,
152108 pip_deactivate_cmd = '' , output_custom_dir = '' , app_name = const .default_app_name ,
153109 github_token = '' , formats = [], direct = True , path_to_exclude = [], graph_path = '' ,
@@ -246,18 +202,7 @@ def run_dependency_scanner(package_manager='', input_dir='', output_dir_file='',
246202 logger .warning ("Dependency scanning terminated because the package manager was not found." )
247203 ret = False
248204 else :
249- try :
250- ret , found_package_manager , input_dir = find_manifest_for_package_manager (package_manager ,
251- input_dir ,
252- abs_path_to_exclude )
253- os .chdir (input_dir )
254- except Exception as e :
255- logger .error (f'Fail to find manifest file: { e } ' )
256- ret = False
257- finally :
258- if not ret :
259- logger .warning ("Dependency scanning terminated because any manifest file was not found." )
260- ret = False
205+ found_package_manager [package_manager ] = ["manual detect ('-m option')" ]
261206
262207 pass_key = 'PASS'
263208 success_pm = []
0 commit comments