15
15
from __future__ import print_function
16
16
17
17
import argparse
18
- from distutils import dir_util
19
- from distutils import file_util
20
18
import json
21
19
import os
22
20
import platform
@@ -425,7 +423,7 @@ def install_dylib(args, library_name, install_dir, module_names):
425
423
for module in module_names :
426
424
# If we're cross-compiling, we expect the .swiftmodule to be a directory that contains everything.
427
425
if args .cross_compile_hosts :
428
- install_binary (args , module + ".swiftmodule" , install_dir )
426
+ install_binary (args , module + ".swiftmodule" , install_dir , [ 'Project' , '*.swiftmodule' ] )
429
427
else :
430
428
# Otherwise we have either a .swiftinterface or a .swiftmodule, plus a .swiftdoc.
431
429
if os .path .exists (os .path .join (args .bin_dir , module + ".swiftinterface" )):
@@ -436,16 +434,16 @@ def install_dylib(args, library_name, install_dir, module_names):
436
434
437
435
438
436
# Helper function that installs a single built artifact to a particular directory. The source may be either a file or a directory.
439
- def install_binary (args , binary , dest_dir ):
437
+ def install_binary (args , binary , dest_dir , ignored_patterns = [] ):
440
438
src = os .path .join (args .bin_dir , binary )
441
439
dest = os .path .join (dest_dir , binary )
442
440
443
441
note ("Installing %s to %s" % (src , dest ))
444
442
mkdir_p (os .path .dirname (dest ))
445
443
if os .path .isdir (src ):
446
- dir_util . copy_tree (src , dest , update = 1 , verbose = 1 )
444
+ shutil . copytree (src , dest , ignore = shutil . ignore_patterns ( * ignored_patterns ) )
447
445
else :
448
- file_util . copy_file (src , dest , update = 1 , verbose = 1 )
446
+ shutil . copy2 (src , dest )
449
447
450
448
# -----------------------------------------------------------
451
449
# Build functions
0 commit comments