@@ -131,16 +131,31 @@ class NoSuchURL(Exception):
131
131
pass
132
132
133
133
134
- def copytree (src , dst , symlinks = False , ignore = None , executable = False ):
134
+ def copytree (src , dst , symlinks = False , ignore_errors = None , executable = False ):
135
135
if not os .path .exists (dst ):
136
136
os .makedirs (dst )
137
137
for item in os .listdir (src ):
138
138
s = os .path .join (src , item )
139
+ if os .name == "nt" :
140
+ from __np__ .windows import get_short_path
141
+ try :
142
+ s = get_short_path (os .path .dirname (s ))
143
+ except :
144
+ pass
139
145
d = os .path .join (dst , item )
146
+ if os .name == "nt" :
147
+ try :
148
+ d = get_short_path (os .path .dirname (d ))
149
+ except :
150
+ pass
140
151
if os .path .isdir (s ):
141
- copytree (s , d , symlinks , ignore )
152
+ copytree (s , d , symlinks , ignore_errors )
142
153
else :
143
- shutil .copy2 (s , d )
154
+ try :
155
+ shutil .copy2 (s , d )
156
+ except :
157
+ if not ignore_errors :
158
+ raise
144
159
if executable :
145
160
os .chmod (d , 509 ) # 775
146
161
@@ -281,6 +296,7 @@ def run_with_output(*args, **kwargs):
281
296
def install_files (dst , * files , ** kwargs ):
282
297
base_dir = kwargs .pop ("base_dir" , None )
283
298
executable = kwargs .pop ("executable" , None )
299
+ ignore_errors = kwargs .pop ("ignore_errors" , None )
284
300
assert not kwargs
285
301
286
302
if not os .path .isdir (dst ):
@@ -294,7 +310,7 @@ def install_files(dst, *files, **kwargs):
294
310
if not os .path .exists (os .path .dirname (file_dst )):
295
311
os .makedirs (os .path .dirname (file_dst ))
296
312
if os .path .isdir (file ):
297
- copytree (file , os .path .join (dst , destination_filename ), executable = executable )
313
+ copytree (file , os .path .join (dst , destination_filename ), executable = executable , ignore_errors = ignore_errors )
298
314
else :
299
315
shutil .copy (file , os .path .join (dst , destination_filename ))
300
316
if executable :
@@ -323,10 +339,11 @@ def install_dep_libs(dependency_name, *files, **kwargs):
323
339
324
340
def install_build_tool (tool_name , * files , ** kwargs ):
325
341
base_dir = kwargs .pop ("base_dir" , None )
342
+ ignore_errors = kwargs .pop ("ignore_errors" , None )
326
343
assert not kwargs
327
344
328
345
dependency_location = os .path .join (getToolsInstallDir (), tool_name )
329
- install_files (dependency_location , * files , base_dir = base_dir , executable = True )
346
+ install_files (dependency_location , * files , base_dir = base_dir , executable = True , ignore_errors = ignore_errors )
330
347
331
348
332
349
def find_build_tool_exe (tool_name , exe ):
@@ -435,4 +452,4 @@ def importFileAsModule(modulename, filename):
435
452
)
436
453
build_script_module = importlib .util .module_from_spec (build_script_spec )
437
454
build_script_spec .loader .exec_module (build_script_module )
438
- return build_script_module
455
+ return build_script_module
0 commit comments