diff options
author | Andy Schwerin <schwerin@10gen.com> | 2012-04-02 10:47:30 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@10gen.com> | 2012-04-02 23:43:47 -0400 |
commit | b099fd4ba8c01742ae367979531e6774f0ff19c7 (patch) | |
tree | ab73dc43e8f8d6ce76e675d78b71e905fbd0c88c | |
parent | 19d5b5bde3ec5950b78953290d93d7445c9f1016 (diff) | |
download | mongo-b099fd4ba8c01742ae367979531e6774f0ff19c7.tar.gz |
SERVER-3331: Changes to the client SConstruct to improve windows building.
-rwxr-xr-x | buildscripts/build_and_test_client.py | 26 | ||||
-rwxr-xr-x | distsrc/client/SConstruct | 3 |
2 files changed, 23 insertions, 6 deletions
diff --git a/buildscripts/build_and_test_client.py b/buildscripts/build_and_test_client.py index e95dbb42917..1b97f623cc5 100755 --- a/buildscripts/build_and_test_client.py +++ b/buildscripts/build_and_test_client.py @@ -19,6 +19,7 @@ import subprocess import sys import tempfile import tarfile +import zipfile import utils @@ -27,21 +28,36 @@ def main(args): scons_args = args[2:] build_and_test(archive_file, scons_args) -def build_and_test(archive, scons_args): +def build_and_test(archive_name, scons_args): work_dir = tempfile.mkdtemp() try: + archive = open_archive(archive_name) extracted_root = extract_archive(work_dir, archive) run_scons(extracted_root, scons_args) smoke_client(extracted_root) finally: shutil.rmtree(work_dir) -def extract_archive(work_dir, archive): - tf = tarfile.open(archive, 'r') - tf.extractall(path=work_dir) +def open_tar(archive_name): + return tarfile.open(archive_name, 'r') + +def open_zip(archive_name): + class ZipWrapper(zipfile.ZipFile): + def getnames(self): + return self.namelist() + return ZipWrapper(archive_name, 'r') + +def open_archive(archive_name): + try: + return open_tar(archive_name) + except: + return open_zip(archive_name) + +def extract_archive(work_dir, archive_file): + archive_file.extractall(path=work_dir) return os.path.join( work_dir, - os.path.dirname([n for n in tf.getnames() if n.endswith('SConstruct')][0]) + os.path.dirname([n for n in archive_file.getnames() if n.endswith('SConstruct')][0]) ) def run_scons(extracted_root, scons_args): diff --git a/distsrc/client/SConstruct b/distsrc/client/SConstruct index 5b40f1a00aa..f8d44817bf7 100755 --- a/distsrc/client/SConstruct +++ b/distsrc/client/SConstruct @@ -53,8 +53,9 @@ elif sys.platform in ("linux2", "linux3"): nix = True linux = True -if sys.platform is 'win32': +if sys.platform == 'win32': env['DIST_ARCHIVE_SUFFIX'] = '.zip' + env.Append(CCFLAGS=['/EHsc', '/O2']) else: env['DIST_ARCHIVE_SUFFIX'] = '.tgz' |