@@ -158,15 +158,30 @@ def get_files_for_example(example_path):
158
158
"""Get the set of files for a library example"""
159
159
found_files = set (("code.py" ,))
160
160
example_dir = os .path .dirname (example_path )
161
- for file in os .listdir (example_dir ):
161
+
162
+ full_tree = os .walk (example_dir )
163
+ root_level = next (full_tree )
164
+
165
+ for file in root_level [2 ]:
162
166
if "." in file :
163
167
cur_extension = file .split ("." )[- 1 ]
164
168
if cur_extension in SHOWN_FILETYPES_EXAMPLE :
165
169
# print(file)
166
170
found_files .add (file )
167
- else :
168
- # add dir
169
- found_files .add (file )
171
+
172
+ for _dir in root_level [1 ]:
173
+ dir_tuple = (_dir , tuple ())
174
+ for cur_tuple in os .walk (example_dir ):
175
+ if cur_tuple [0 ].split ("/" )[- 1 ] == _dir :
176
+ for _sub_dir in cur_tuple [1 ]:
177
+ dir_tuple = (dir_tuple [0 ], dir_tuple [1 ] + (_sub_dir ,))
178
+ for _sub_file in cur_tuple [2 ]:
179
+ dir_tuple = (dir_tuple [0 ], dir_tuple [1 ] + (_sub_file ,))
180
+
181
+ # e.g. ("dir_name", ("file_1.txt", "file_2.txt"))
182
+
183
+ if ".circuitpython.skip-screenshot" not in dir_tuple [1 ]:
184
+ found_files .add (dir_tuple )
170
185
return found_files
171
186
172
187
@@ -201,7 +216,7 @@ def get_learn_guide_cp_projects():
201
216
# Skip files in this folder, but handle sub-folders
202
217
if ".circuitpython.skip-screenshot-here" in filenames :
203
218
continue
204
- # Do not reurse , but handle files in this folder
219
+ # Do not recurse , but handle files in this folder
205
220
if ".circuitpython.skip-screenshot-sub" in filenames :
206
221
del dirnames [:]
207
222
0 commit comments