Skip to content

Commit 3741792

Browse files
committed
Filter out *.swiftmodule and Project entries when installing binaries, since these should not be part of the installed toolchain.
1 parent 82cd80f commit 3741792

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Utilities/bootstrap

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
from __future__ import print_function
1616

1717
import argparse
18-
from distutils import dir_util
19-
from distutils import file_util
2018
import json
2119
import os
2220
import platform
@@ -425,7 +423,7 @@ def install_dylib(args, library_name, install_dir, module_names):
425423
for module in module_names:
426424
# If we're cross-compiling, we expect the .swiftmodule to be a directory that contains everything.
427425
if args.cross_compile_hosts:
428-
install_binary(args, module + ".swiftmodule", install_dir)
426+
install_binary(args, module + ".swiftmodule", install_dir, ['Project', '*.swiftmodule'])
429427
else:
430428
# Otherwise we have either a .swiftinterface or a .swiftmodule, plus a .swiftdoc.
431429
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):
436434

437435

438436
# 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=[]):
440438
src = os.path.join(args.bin_dir, binary)
441439
dest = os.path.join(dest_dir, binary)
442440

443441
note("Installing %s to %s" % (src, dest))
444442
mkdir_p(os.path.dirname(dest))
445443
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))
447445
else:
448-
file_util.copy_file(src, dest, update=1, verbose=1)
446+
shutil.copy2(src, dest)
449447

450448
# -----------------------------------------------------------
451449
# Build functions

0 commit comments

Comments
 (0)