Skip to content

Commit eb0d41a

Browse files
author
Mike Ferris
committed
Merge pull request #51 from modocache/build-script-redundancies
[build_script.py] Remove redundant argparse params
2 parents b145eba + 3072710 commit eb0d41a

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

build_script.py

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,31 @@ def run(command):
2424
subprocess.check_call(command, shell=True)
2525

2626
def main():
27-
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
28-
description="""Builds XCTest using a swift compiler.""")
27+
parser = argparse.ArgumentParser(
28+
description="Builds XCTest using a Swift compiler.")
2929
parser.add_argument("--swiftc",
3030
help="path to the swift compiler",
3131
metavar="PATH",
32-
action="store",
33-
dest="swiftc",
34-
required=True,
35-
default=None)
32+
required=True)
3633
parser.add_argument("--build-dir",
3734
help="path to the output build directory",
3835
metavar="PATH",
39-
action="store",
40-
dest="build_dir",
41-
required=True,
42-
default=None)
36+
required=True)
4337
parser.add_argument("--swift-build-dir",
4438
help="path to the swift build directory",
4539
metavar="PATH",
46-
action="store",
47-
dest="swift_build_dir",
48-
required=True,
49-
default=None)
40+
required=True)
41+
parser.add_argument("--arch",
42+
help="target architecture",
43+
required=True)
5044
parser.add_argument("--module-install-path",
5145
help="location to install module files",
5246
metavar="PATH",
53-
action="store",
54-
dest="module_path",
55-
default=None)
47+
dest="module_path")
5648
parser.add_argument("--library-install-path",
5749
help="location to install shared library files",
5850
metavar="PATH",
59-
action="store",
60-
dest="lib_path",
61-
default=None)
51+
dest="lib_path")
6252
parser.add_argument("--release",
6353
help="builds for release",
6454
action="store_const",
@@ -78,20 +68,12 @@ def main():
7868
"at {} in order to run this command. ".format(
7969
os.path.join(
8070
os.path.dirname(SOURCE_DIR), 'llvm')),
81-
action="store_true",
82-
dest="test",
83-
default=False)
84-
parser.add_argument("--arch",
85-
help="target architecture",
86-
action="store",
87-
dest="arch",
88-
default=None)
71+
action="store_true")
8972
args = parser.parse_args()
9073

9174
swiftc = os.path.abspath(args.swiftc)
9275
build_dir = os.path.abspath(args.build_dir)
9376
swift_build_dir = os.path.abspath(args.swift_build_dir)
94-
arch = args.arch
9577

9678
if not os.path.exists(build_dir):
9779
run("mkdir -p {}".format(build_dir))
@@ -118,7 +100,7 @@ def main():
118100
run("{0} -c {1} -emit-object {2} -module-name XCTest -parse-as-library -emit-module "
119101
"-emit-module-path {3}/XCTest.swiftmodule -o {3}/XCTest.o -force-single-frontend-invocation "
120102
"-module-link-name XCTest".format(swiftc, style_options, " ".join(sourcePaths), build_dir))
121-
run("clang {1}/lib/swift/linux/{2}/swift_begin.o {0}/XCTest.o {1}/lib/swift/linux/{2}/swift_end.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm".format(build_dir, swift_build_dir, arch))
103+
run("clang {1}/lib/swift/linux/{2}/swift_begin.o {0}/XCTest.o {1}/lib/swift/linux/{2}/swift_end.o -shared -o {0}/libXCTest.so -Wl,--no-undefined -Wl,-soname,libXCTest.so -L{1}/lib/swift/linux/ -lswiftGlibc -lswiftCore -lm".format(build_dir, swift_build_dir, args.arch))
122104

123105
# If we were given an install directive, perform installation
124106
if args.module_path is not None and args.lib_path is not None:

0 commit comments

Comments
 (0)