diff options
author | Dirk Baechle <dl9obn@darc.de> | 2015-04-06 16:40:24 +0200 |
---|---|---|
committer | Dirk Baechle <dl9obn@darc.de> | 2015-04-06 16:40:24 +0200 |
commit | 92907f21e0a36be8ef154562af8232f39d7dc842 (patch) | |
tree | 1a02c6889f352c73a293e2edf5586896a8371f3f /SConstruct | |
parent | 7e8b998e6e4174389d8754f7a20ab565b1dc8429 (diff) | |
parent | f1e7810fcb0dbcf7c44768a4139144d25c3142d6 (diff) | |
download | scons-92907f21e0a36be8ef154562af8232f39d7dc842.tar.gz |
Merged in LaurentMarchelli/scons (pull request #209), implementation of Visual Studio users files
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 40 |
1 files changed, 25 insertions, 15 deletions
@@ -48,6 +48,12 @@ copyright = "Copyright (c) %s The SCons Foundation" % copyright_years platform = distutils.util.get_platform() +def is_windows(): + if platform.startswith('win'): + return True + else: + return False + SConsignFile() # @@ -56,7 +62,7 @@ SConsignFile() # def whereis(file): exts = [''] - if platform == "win32": + if is_windows(): exts += ['.exe'] for dir in os.environ['PATH'].split(os.pathsep): f = os.path.join(dir, file) @@ -267,7 +273,7 @@ test_local_zip_dir = os.path.join(build_dir, "test-local-zip") unpack_tar_gz_dir = os.path.join(build_dir, "unpack-tar-gz") unpack_zip_dir = os.path.join(build_dir, "unpack-zip") -if platform == "win32": +if is_windows(): tar_hflag = '' python_project_subinst_dir = os.path.join("Lib", "site-packages", project) project_script_subinst_dir = 'Scripts' @@ -331,7 +337,8 @@ try: path = os.path.join(dirname, name) if os.path.isfile(path): arg.write(path) - zf = zipfile.ZipFile(str(target[0]), 'w') + # default ZipFile compression is ZIP_STORED + zf = zipfile.ZipFile(str(target[0]), 'w', compression=zipfile.ZIP_DEFLATED) olddir = os.getcwd() os.chdir(env['CD']) try: os.path.walk(env['PSV'], visit, zf) @@ -356,7 +363,7 @@ try: if not os.path.isdir(dest): open(dest, 'wb').write(zf.read(name)) -except: +except ImportError: if unzip and zip: zipit = "cd $CD && $ZIP $ZIPFLAGS $( ${TARGET.abspath} $) $PSV" unzipit = "$UNZIP $UNZIPFLAGS $SOURCES" @@ -729,10 +736,9 @@ for p in [ scons ]: platform_zip = os.path.join(build, 'dist', "%s.%s.zip" % (pkg_version, platform)) - if platform == "win-amd64": - win32_exe = os.path.join(build, 'dist', "%s.win-amd64.exe" % pkg_version) - else: - win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) + + win64_exe = os.path.join(build, 'dist', "%s.win-amd64.exe" % pkg_version) + win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) # # Update the environment with the relevant information @@ -844,11 +850,13 @@ for p in [ scons ]: distutils_formats = [] - distutils_targets = [ win32_exe ] + distutils_targets = [ win32_exe , win64_exe ] + dist_distutils_targets = [] - dist_distutils_targets = env.Install('$DISTDIR', distutils_targets) - Local(dist_distutils_targets) - AddPostAction(dist_distutils_targets, Chmod(dist_distutils_targets, 0644)) + for target in distutils_targets: + dist_target = env.Install('$DISTDIR', target) + AddPostAction(dist_target, Chmod(dist_target, 0644)) + dist_distutils_targets += dist_target if not gzip: print "gzip not found in %s; skipping .tar.gz package for %s." % (os.environ['PATH'], pkg) @@ -1080,7 +1088,9 @@ for p in [ scons ]: commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY sdist --formats=%s" % \ ','.join(distutils_formats)) - commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name win32 --user-access-control auto") + commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name=win32 --user-access-control auto") + + commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst --plat-name=win-amd64 --user-access-control auto") env.Command(distutils_targets, build_src_files, commands) @@ -1108,7 +1118,7 @@ for p in [ scons ]: for script in scripts: # add .py extension for scons-local scripts on non-windows platforms - if platform == "win32": + if is_windows(): break local_script = os.path.join(build_dir_local, script) commands.append(Move(local_script + '.py', local_script)) @@ -1132,7 +1142,7 @@ for p in [ scons ]: Local(l) if gzip: - if platform == "win32": + if is_windows(): # avoid problem with tar interpreting c:/ as a remote machine tar_cargs = '-cz --force-local -f' else: |