diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-06-21 07:55:31 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-06-21 07:55:31 +0200 |
commit | 39fa0bace059116d9a45e09fcd18691390b166bd (patch) | |
tree | 77f5abf2964bd92dc9e338654a4ffaaffc24d9ce /SConstruct | |
parent | f9b0c331d8b9d03be91b56e324f59424af45302b (diff) | |
parent | f7e5d2b46b03cc4bc09c38f7e0873378bb9c3b78 (diff) |
Merge tag 'upstream/2.3.5'
Upstream version 2.3.5
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 69 |
1 files changed, 48 insertions, 21 deletions
@@ -3,13 +3,13 @@ # # See the README.rst file for an overview of how SCons is built and tested. -copyright_years = '2001 - 2014' +copyright_years = '2001 - 2015' # This gets inserted into the man pages to reflect the month of release. -month_year = 'September 2014' +month_year = 'June 2015' # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -43,11 +43,17 @@ import tempfile import bootstrap project = 'scons' -default_version = '2.3.4' +default_version = '2.3.5' 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) @@ -166,6 +172,14 @@ if build_id is None: else: build_id = '' +import os.path +import distutils.command + +no_winpack_templates = not os.path.exists(os.path.join(os.path.split(distutils.command.__file__)[0],'wininst-9.0.exe')) +skip_win_packages = ARGUMENTS.get('SKIP_WIN_PACKAGES',False) or no_winpack_templates +if skip_win_packages: + print "Skipping the build of Windows packages..." + python_ver = sys.version[0:3] # @@ -229,6 +243,8 @@ command_line_variables = [ ("VERSION=", "The SCons version being packaged. The default " + "is the hard-coded value '%s' " % default_version + "from this SConstruct file."), + + ("SKIP_WIN_PACKAGES=", "If set, skip building win32 and win64 packages."), ] Default('.', build_dir) @@ -267,7 +283,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 +347,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 +373,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" @@ -488,10 +505,13 @@ Version_values = [Value(version), Value(build_id)] # separate packages. # +from distutils.sysconfig import get_python_lib; + + python_scons = { 'pkg' : 'python-' + project, 'src_subdir' : 'engine', - 'inst_subdir' : os.path.join('lib', 'python1.5', 'site-packages'), + 'inst_subdir' : get_python_lib(), 'rpm_dir' : '/usr/lib/scons', 'debian_deps' : [ @@ -729,10 +749,7 @@ 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) + # # Update the environment with the relevant information @@ -805,7 +822,7 @@ for p in [ scons ]: # # Now run everything in src_file through the sed command we - # concocted to expand SConstruct, 2.3.4, etc. + # concocted to expand SConstruct, 2.3.5, etc. # for b in src_files: s = p['filemap'].get(b, b) @@ -843,12 +860,19 @@ for p in [ scons ]: Local(*build_src_files) distutils_formats = [] + distutils_targets = [] - distutils_targets = [ win32_exe ] + if not skip_win_packages: + 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) + distutils_targets.extend([ 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 +1104,10 @@ 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") + if not skip_win_packages: + 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 +1135,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 +1159,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: |