@@ -52,20 +52,30 @@ def _locate_executable(name: str) -> Optional[str]:
5252 return None
5353
5454
55+ """
56+ Look for modules in given directory path and recursively in subdirs matching aw-*
57+ """
58+ def _discover_modules_in_directory (modules : List [str ], search_path : str ) -> None :
59+ matches = glob (os .path .join (search_path , "aw-*" ))
60+ for match in matches :
61+ if os .path .isfile (match ) and os .access (match , os .X_OK ):
62+ name = os .path .basename (match )
63+ modules .append (name )
64+ elif os .path .isdir (match ) and os .access (match , os .X_OK ):
65+ _discover_modules_in_directory (modules , match )
66+ else :
67+ logger .warning ("Found matching file but was not executable: {}" .format (match ))
68+
69+
5570def _discover_modules_bundled () -> List [str ]:
56- # Look for modules in source dir and parent dir
57- modules = []
58- for path in _search_paths :
59- matches = glob (os .path .join (path , "aw-*" ))
60- for match in matches :
61- if os .path .isfile (match ) and os .access (match , os .X_OK ):
62- name = os .path .basename (match )
63- modules .append (name )
64- else :
65- logger .warning ("Found matching file but was not executable: {}" .format (match ))
66-
67- # This prints "Found... set()" if we found 0 bundled modules. Can be a bit misleading.
68- logger .info ("Found bundled modules: {}" .format (set (modules )))
71+ modules : List [str ] = []
72+ cwd = os .getcwd ()
73+ _discover_modules_in_directory (modules , cwd )
74+
75+ if len (modules ) > 0 :
76+ logger .info ("Found bundled modules: {}" .format (set (modules )))
77+ else :
78+ logger .info ("Found no bundles modules" )
6979 return modules
7080
7181
0 commit comments