Skip to content

Commit 45d3387

Browse files
committed
PNG file icon. Find libraries one level deeper from wildcard import of file in learn project code
1 parent 95cef7a commit 45d3387

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: create_requirement_images.py

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def asset_path(asset_name):
7171
"txt": file_empty_icon,
7272
"toml": file_icon,
7373
"bmp": file_image_icon,
74+
"png": file_image_icon,
7475
"wav": file_music_icon,
7576
"mp3": file_music_icon,
7677
"mid": file_music_icon,

Diff for: get_imports.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def get_files_for_project(project_name):
165165

166166

167167
def get_libs_for_project(project_name):
168+
# pylint: disable=too-many-nested-blocks
168169
"""Get the set of libraries for a learn project"""
169170
found_libs = set()
170171
found_imports = []
@@ -173,11 +174,23 @@ def get_libs_for_project(project_name):
173174
if file.endswith(".py"):
174175

175176
found_imports = findimports.find_imports(f"{project_dir}{file}")
176-
177177
for cur_import in found_imports:
178178
cur_lib = cur_import.name.split(".")[0]
179179
if cur_lib in bundle_data or cur_lib in community_bundle_data:
180180
found_libs.add(cur_lib)
181+
if cur_import.name.endswith(".*"):
182+
filepath = os.path.join(
183+
project_dir, "/".join(cur_import.name[:-2].split(".")) + ".py"
184+
)
185+
if os.path.exists(filepath):
186+
second_level_imports = findimports.find_imports(filepath)
187+
for cur_second_level_import in second_level_imports:
188+
cur_lib = cur_second_level_import.name.split(".")[0]
189+
if (
190+
cur_lib in bundle_data
191+
or cur_lib in community_bundle_data
192+
):
193+
found_libs.add(cur_lib)
181194

182195
return found_libs
183196

0 commit comments

Comments
 (0)