@@ -116,17 +116,21 @@ def library(library_path, output_directory, package_folder_prefix,
116116 # 'walked_files' while retaining subdirectory structure
117117 walked_files = []
118118 for path in path_walk :
119+ rel_path = ""
119120 if filename .startswith ("examples" ):
120- path_tail_idx = path [0 ].rfind ("examples/" ) + 9
121+ path_tail_idx = path [0 ].rfind ("examples/" )
122+ if path_tail_idx != - 1 :
123+ rel_path = "{}/" .format (path [0 ][path_tail_idx + 9 :])
124+
121125 else :
122126 path_tail_idx = (path [0 ].rfind ("{}/" .format (filename ))
123127 + (len (filename ) + 1 ))
124- path_tail = path [0 ][path_tail_idx :]
125- rel_path = ""
126- # if this entry is the package top dir, keep it
127- # empty so we don't double append the dir name
128- if filename not in path_tail :
129- rel_path = "{}/" .format (path_tail )
128+ path_tail = path [0 ][path_tail_idx :]
129+
130+ # if this entry is the package top dir, keep it
131+ # empty so we don't double append the dir name
132+ if filename not in path_tail :
133+ rel_path = "{}/" .format (path_tail )
130134
131135 for path_files in path [2 ]:
132136 walked_files .append ("{}{}" .format (rel_path , path_files ))
@@ -151,8 +155,8 @@ def library(library_path, output_directory, package_folder_prefix,
151155 #print("- package files: {} | {}".format(filename, package_files))
152156
153157 if (filename .endswith (".py" ) and
154- filename not in IGNORE_PY and
155- not example_bundle ):
158+ filename not in IGNORE_PY and
159+ not example_bundle ):
156160 py_files .append (filename )
157161
158162 if len (py_files ) > 1 :
0 commit comments