@@ -116,17 +116,21 @@ def library(library_path, output_directory, package_folder_prefix,
116
116
# 'walked_files' while retaining subdirectory structure
117
117
walked_files = []
118
118
for path in path_walk :
119
+ rel_path = ""
119
120
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
+
121
125
else :
122
126
path_tail_idx = (path [0 ].rfind ("{}/" .format (filename ))
123
127
+ (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 )
130
134
131
135
for path_files in path [2 ]:
132
136
walked_files .append ("{}{}" .format (rel_path , path_files ))
@@ -151,8 +155,8 @@ def library(library_path, output_directory, package_folder_prefix,
151
155
#print("- package files: {} | {}".format(filename, package_files))
152
156
153
157
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 ):
156
160
py_files .append (filename )
157
161
158
162
if len (py_files ) > 1 :
0 commit comments