Skip to content

Commit 84e4847

Browse files
committed
fix duplicate lib dirs
1 parent 8f2e717 commit 84e4847

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

create_requirement_images.py

+34-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,17 @@ def get_dependencies(libraries):
317317
lib_name = libraries_to_check[0]
318318
del libraries_to_check[0]
319319

320-
lib_obj = bundle_data[lib_name]
320+
try:
321+
lib_obj = bundle_data[lib_name]
322+
except KeyError:
323+
# Library isn't in bundle, so we don't know about its
324+
# dependencies.
325+
if "." in lib_name:
326+
file_list.add(lib_name)
327+
else:
328+
package_list.add(lib_name)
329+
continue
330+
321331
for dep_name in lib_obj["dependencies"]:
322332
libraries_to_check.append(dep_name)
323333
dep_obj = bundle_data[dep_name]
@@ -377,6 +387,29 @@ def make_sd_dir(position):
377387
triangle_icon=right_triangle,
378388
)
379389

390+
def filter_custom_project_libs(project_file_set):
391+
"""
392+
Find and remove the custom project lib folder.
393+
Returns a tuple with the contents of the custom project lib folder
394+
which will in turn get included in the libraries list that the
395+
tool uses to generate the "main" lib folder in the screenshot.
396+
"""
397+
_custom_libs = None
398+
remove_files = []
399+
for file in project_file_set:
400+
if not isinstance(file, tuple):
401+
continue
402+
if file[0] == "lib":
403+
_custom_libs = file[1]
404+
remove_files.append(file)
405+
for file in remove_files:
406+
project_file_set.remove(file)
407+
return _custom_libs
408+
409+
custom_libs = filter_custom_project_libs(project_files)
410+
libs_list = list(libs)
411+
libs_list.extend(custom_libs)
412+
libs = set(libs_list)
380413
final_list_to_render = sort_libraries(libs)
381414
if settings_required(final_list_to_render):
382415
context["added_settings_toml"] = True

0 commit comments

Comments
 (0)