diff options
author | Steven Knight <knight@baldmt.com> | 2004-08-20 17:48:17 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-08-20 17:48:17 (GMT) |
commit | 6ec1c708ae25a616d3e32b5b654d896baf0369ac (patch) | |
tree | 374b9e988044ef05e129d0ebcf3eef3f706692d2 | |
parent | 84f00012c6e961df55c666abcfa1477578c81c34 (diff) | |
download | SCons-6ec1c708ae25a616d3e32b5b654d896baf0369ac.zip SCons-6ec1c708ae25a616d3e32b5b654d896baf0369ac.tar.gz SCons-6ec1c708ae25a616d3e32b5b654d896baf0369ac.tar.bz2 |
Update the packaging SConscript files to be platform independent.
-rw-r--r-- | README | 39 | ||||
-rw-r--r-- | SConstruct | 180 | ||||
-rw-r--r-- | doc/SConscript | 15 | ||||
-rw-r--r-- | src/CHANGES.txt | 2 |
4 files changed, 126 insertions, 110 deletions
@@ -86,11 +86,11 @@ In this case, your options are: INSTALLATION ============ -Assuming your system satisfies the installation requirements in -the previous section, install SCons from this package by first -populating the build/scons/ directory. (For an easier way to -install SCons, without having to populate this directory, use the -scons-{version}.tar.gz or scons-{version}.zip package.) +Assuming your system satisfies the installation requirements in the +previous section, install SCons from this package by first populating +the build/scons/ subdirectory. (For an easier way to install SCons, +without having to populate this directory, use the scons-{version}.tar.gz +or scons-{version}.zip package.) If you already have an appropriate version of SCons installed on your system, populate the build/scons/ directory by running: @@ -99,21 +99,36 @@ system, populate the build/scons/ directory by running: If you don't have SCons version 0.96 or later already installed on your system, you can use SCons itself to populate the build/scons/ directory -with a little more typing: +with a little more typing. You must first set the SCONS_LIB_DIR +environment variable to the local src/engine subdirectory, and then +execute the local src/script/scons.py script to populate the build/scons/ +subdirectory. You would do this as follows on a Linux or UNIX system +(using sh or a derivative like bash or ksh): - $ SCONS_LIB_DIR=`pwd`/src/engine python src/script/scons.py build/scons + $ export SCONS_LIB_DIR=`pwd`/src/engine + $ python src/script/scons.py build/scons -Either command will populate the build/scons/ directory with the -necessary files and directory structure to use the Python-standard setup -script as follows: +Or as follows on Windows: + + C:\scons\>set SCONS_LIB_DIR=%cd%\src\engine + C:\scons\>python src/script/scons.py build/scons + +Either command will populate the build/scons/ directory with the necessary +files and directory structure to use the Python-standard setup script +as follows on Linux or UNIX: # cd build/scons # python setup.py install +And on Windows: + + C:\scons\>cd build\scons + C:\scons\build\scons>python setup.py install + If this is the first time you are installing SCons on your system, the above command will install the scons script in the default system -script directory (/usr/bin or C:\Python*\Scripts, for example) and the -build engine in an appropriate stand-alone SCons library directory +script directory (/usr/bin or C:\Python*\Scripts, for example) and +the build engine in an appropriate stand-alone SCons library directory (/usr/lib/scons or C:\Python*\scons, for example). Note that, by default, SCons does not install its library in the @@ -44,6 +44,8 @@ copyright = "Copyright (c) %s The SCons Foundation" % copyright_years Default('.') +SConsignFile() + # # An internal "whereis" routine to figure out if a given program # is available on this system. @@ -147,8 +149,6 @@ for key in ['AEGIS_PROJECT', 'LOGNAME', 'PYTHONPATH']: if os.environ.has_key(key): ENV[key] = os.environ[key] -lib_project = os.path.join("lib", project) - cwd_build = os.path.join(os.getcwd(), "build") test_deb_dir = os.path.join(cwd_build, "test-deb") @@ -165,11 +165,11 @@ unpack_zip_dir = os.path.join(cwd_build, "unpack-zip") if platform == "win32": tar_hflag = '' - python_project_subinst_dir = None + python_project_subinst_dir = os.path.join("Lib", "site-packages", project) project_script_subinst_dir = 'Scripts' else: tar_hflag = 'h' - python_project_subinst_dir = lib_project + python_project_subinst_dir = os.path.join("lib", project) project_script_subinst_dir = 'bin' @@ -292,9 +292,9 @@ env = Environment( # In the original, more complicated packaging scheme, we were going # to have separate packages for: # -# python-scons only the build engine -# scons-script only the script -# scons the script plus the build engine +# python-scons only the build engine +# scons-script only the script +# scons the script plus the build engine # # We're now only delivering a single "scons" package, but this is still # "built" as two sub-packages (the build engine and the script), so @@ -429,9 +429,9 @@ scons = { 'sconsign.1' : '../doc/man/sconsign.1', }, - 'subpkgs' : [ python_scons, scons_script ], + 'subpkgs' : [ python_scons, scons_script ], - 'subinst_dirs' : { + 'subinst_dirs' : { 'python-' + project : python_project_subinst_dir, project + '-script' : project_script_subinst_dir, }, @@ -514,8 +514,7 @@ for p in [ scons ]: rpm_files.append(r) if f[-3:] == ".py": rpm_files.append(r + 'c') - if isubdir: - files = map(lambda x, i=isubdir: os.path.join(i, x), files) + files = map(lambda x, i=isubdir: os.path.join(i, x), files) dst_files.extend(files) for k in sp['filemap'].keys(): f = sp['filemap'][k] @@ -550,7 +549,7 @@ for p in [ scons ]: def write_src_files(target, source, **kw): global src_files - src_files.sort() + src_files.sort() f = open(str(target[0]), 'wb') for file in src_files: f.write(file + "\n") @@ -587,7 +586,7 @@ for p in [ scons ]: # # We'd like to replace the last three lines with the following: # - # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR + # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR # # but that gives heartburn to Cygwin's tar, so work around it # with separate zcat-tar-rm commands. @@ -596,10 +595,10 @@ for p in [ scons ]: os.path.join(u, pv, x), src_files) env.Command(unpack_tar_gz_files, tar_gz, [ - "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version), + Delete(os.path.join(unpack_tar_gz_dir, pkg_version)), "$ZCAT $SOURCES > .temp", "tar xf .temp -C $UNPACK_TAR_GZ_DIR", - "rm -f .temp", + Delete(".temp"), ]) # @@ -617,12 +616,42 @@ for p in [ scons ]: # dfiles = map(lambda x, d=test_tar_gz_dir: os.path.join(d, x), dst_files) env.Command(dfiles, unpack_tar_gz_files, [ - "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version, 'build'), - "rm -rf $TEST_TAR_GZ_DIR", - "$PYTHON %s install --prefix=$TEST_TAR_GZ_DIR" % \ + Delete(os.path.join(unpack_tar_gz_dir, pkg_version, 'build')), + Delete("$TEST_TAR_GZ_DIR"), + '$PYTHON "%s" install "--prefix=$TEST_TAR_GZ_DIR"' % \ os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'), ]) + # + # Generate portage files for submission to Gentoo Linux. + # + gentoo = os.path.join('build', 'gentoo') + ebuild = os.path.join(gentoo, 'scons-%s.ebuild' % version) + digest = os.path.join(gentoo, 'files', 'digest-scons-%s' % version) + env.Command(ebuild, os.path.join('gentoo', 'scons.ebuild.in'), SCons_revision) + def Digestify(target, source, env): + import md5 + def hexdigest(s): + """Return a signature as a string of hex characters. + """ + # NOTE: This routine is a method in the Python 2.0 interface + # of the native md5 module, but we want SCons to operate all + # the way back to at least Python 1.5.2, which doesn't have it. + h = string.hexdigits + r = '' + for c in s: + i = ord(c) + r = r + h[(i >> 4) & 0xF] + h[i & 0xF] + return r + src = source[0].rfile() + contents = open(str(src)).read() + sig = hexdigest(md5.new(contents).digest()) + bytes = os.stat(str(src))[6] + open(str(target[0]), 'w').write("MD5 %s %s %d\n" % (sig, + src.name, + bytes)) + env.Command(digest, tar_gz, Digestify) + if zipit: distutils_formats.append('zip') @@ -641,8 +670,8 @@ for p in [ scons ]: src_files) env.Command(unpack_zip_files, zip, [ - "rm -rf %s" % os.path.join(unpack_zip_dir, pkg_version), - unzipit + Delete(os.path.join(unpack_zip_dir, pkg_version)), + unzipit, ]) # @@ -660,9 +689,9 @@ for p in [ scons ]: # dfiles = map(lambda x, d=test_zip_dir: os.path.join(d, x), dst_files) env.Command(dfiles, unpack_zip_files, [ - "rm -rf %s" % os.path.join(unpack_zip_dir, pkg_version, 'build'), - "rm -rf $TEST_ZIP_DIR", - "$PYTHON %s install --prefix=$TEST_ZIP_DIR" % \ + Delete(os.path.join(unpack_zip_dir, pkg_version, 'build')), + Delete("$TEST_ZIP_DIR"), + '$PYTHON "%s" install "--prefix=$TEST_ZIP_DIR"' % \ os.path.join(unpack_zip_dir, pkg_version, 'setup.py'), ]) @@ -743,48 +772,18 @@ for p in [ scons ]: # - # Generate portage files for submission to Gentoo Linux. - # - gentoo = os.path.join('build', 'gentoo') - ebuild = os.path.join(gentoo, 'scons-%s.ebuild' % version) - digest = os.path.join(gentoo, 'files', 'digest-scons-%s' % version) - env.Command(ebuild, os.path.join('gentoo', 'scons.ebuild.in'), SCons_revision) - def Digestify(target, source, env): - import md5 - def hexdigest(s): - """Return a signature as a string of hex characters. - """ - # NOTE: This routine is a method in the Python 2.0 interface - # of the native md5 module, but we want SCons to operate all - # the way back to at least Python 1.5.2, which doesn't have it. - h = string.hexdigits - r = '' - for c in s: - i = ord(c) - r = r + h[(i >> 4) & 0xF] + h[i & 0xF] - return r - src = source[0].rfile() - contents = open(str(src)).read() - sig = hexdigest(md5.new(contents).digest()) - bytes = os.stat(str(src))[6] - open(str(target[0]), 'w').write("MD5 %s %s %d\n" % (sig, - src.name, - bytes)) - env.Command(digest, tar_gz, Digestify) - - # # Use the Python distutils to generate the appropriate packages. # commands = [ - "rm -rf %s" % os.path.join(build, 'build', 'lib'), - "rm -rf %s" % os.path.join(build, 'build', 'scripts'), + Delete(os.path.join(build, 'build', 'lib')), + Delete(os.path.join(build, 'build', 'scripts')), ] if distutils_formats: - commands.append("rm -rf %s" % os.path.join(build, - 'build', - 'bdist.' + platform, - 'dumb')) + commands.append(Delete(os.path.join(build, + 'build', + 'bdist.' + platform, + 'dumb'))) for format in distutils_formats: commands.append("$PYTHON $SETUP_PY bdist_dumb -f %s" % format) @@ -810,13 +809,15 @@ for p in [ scons ]: local_zip = os.path.join('build', 'dist', "%s.zip" % s_l_v) commands = [ - "rm -rf %s" % local, - "$PYTHON $SETUP_PY install --install-script=%s --install-lib=%s --no-compile" % \ + Delete(local), + '$PYTHON $SETUP_PY install "--install-script=%s" "--install-lib=%s" --no-compile' % \ (cwd_local, cwd_local_slv), ] for script in scripts: - commands.append("mv %s/%s %s/%s.py" % (local, script, local, script)) + #commands.append("mv %s/%s %s/%s.py" % (local, script, local, script)) + local_script = os.path.join(local, script) + commands.append(Move(local_script + '.py', local_script)) rf = filter(lambda x: not x in scripts, raw_files) rf = map(lambda x, slv=s_l_v: os.path.join(slv, x), rf) @@ -842,8 +843,8 @@ for p in [ scons ]: unpack_targets = map(lambda x, d=test_local_tar_gz_dir: os.path.join(d, x), rf) - commands = ["rm -rf %s" % test_local_tar_gz_dir, - "mkdir %s" % test_local_tar_gz_dir, + commands = [Delete(test_local_tar_gz_dir), + Mkdir(test_local_tar_gz_dir), "cd %s && tar xzf $( ${SOURCE.abspath} $)" % test_local_tar_gz_dir] env.Command(unpack_targets, local_tar_gz, commands) @@ -855,8 +856,8 @@ for p in [ scons ]: unpack_targets = map(lambda x, d=test_local_zip_dir: os.path.join(d, x), rf) - commands = ["rm -rf %s" % test_local_zip_dir, - "mkdir %s" % test_local_zip_dir, + commands = [Delete(test_local_zip_dir), + Mkdir(test_local_zip_dir), unzipit] env.Command(unpack_targets, local_zip, unzipit, @@ -929,10 +930,9 @@ if change: b_ps_files = map(lambda x, d=b_ps: os.path.join(d, x), sfiles) cmds = [ - "rm -rf %s" % b_psv, - "cp -rp %s %s" % (b_ps, b_psv), - "find %s -name .sconsign -exec rm {} \\;" % b_psv, - "touch $TARGET", + Delete(b_psv), + Copy(b_psv, b_ps), + Touch("$TARGET"), ] env.Command(b_psv_stamp, src_deps + b_ps_files, cmds) @@ -954,15 +954,15 @@ if change: # # We'd like to replace the last three lines with the following: # - # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR + # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR # # but that gives heartburn to Cygwin's tar, so work around it # with separate zcat-tar-rm commands. env.Command(unpack_tar_gz_files, src_tar_gz, [ - "rm -rf %s" % os.path.join(unpack_tar_gz_dir, psv), + Delete(os.path.join(unpack_tar_gz_dir, psv)), "$ZCAT $SOURCES > .temp", "tar xf .temp -C $UNPACK_TAR_GZ_DIR", - "rm -f .temp", + Delete(".temp"), ]) # @@ -986,17 +986,17 @@ if change: ENV['USERNAME'] = developer env.Command(dfiles, unpack_tar_gz_files, [ - "rm -rf %s" % os.path.join(unpack_tar_gz_dir, - psv, - 'build', - 'scons', - 'build'), - "rm -rf $TEST_SRC_TAR_GZ_DIR", - "cd %s && $PYTHON %s %s" % \ + Delete(os.path.join(unpack_tar_gz_dir, + psv, + 'build', + 'scons', + 'build')), + Delete("$TEST_SRC_TAR_GZ_DIR"), + 'cd "%s" && $PYTHON "%s" "%s"' % \ (os.path.join(unpack_tar_gz_dir, psv), os.path.join('src', 'script', 'scons.py'), os.path.join('build', 'scons')), - "$PYTHON %s install --prefix=$TEST_SRC_TAR_GZ_DIR" % \ + '$PYTHON "%s" install "--prefix=$TEST_SRC_TAR_GZ_DIR"' % \ os.path.join(unpack_tar_gz_dir, psv, 'build', @@ -1017,7 +1017,7 @@ if change: sfiles) env.Command(unpack_zip_files, src_zip, [ - "rm -rf %s" % os.path.join(unpack_zip_dir, psv), + Delete(os.path.join(unpack_zip_dir, psv)), unzipit ]) @@ -1042,17 +1042,17 @@ if change: ENV['USERNAME'] = developer env.Command(dfiles, unpack_zip_files, [ - "rm -rf %s" % os.path.join(unpack_zip_dir, - psv, - 'build', - 'scons', - 'build'), - "rm -rf $TEST_SRC_ZIP_DIR", - "cd %s && $PYTHON %s %s" % \ + Delete(os.path.join(unpack_zip_dir, + psv, + 'build', + 'scons', + 'build')), + Delete("$TEST_SRC_ZIP_DIR"), + 'cd "%s" && $PYTHON "%s" "%s"' % \ (os.path.join(unpack_zip_dir, psv), os.path.join('src', 'script', 'scons.py'), os.path.join('build', 'scons')), - "$PYTHON %s install --prefix=$TEST_SRC_ZIP_DIR" % \ + '$PYTHON "%s" install "--prefix=$TEST_SRC_ZIP_DIR"' % \ os.path.join(unpack_zip_dir, psv, 'build', diff --git a/doc/SConscript b/doc/SConscript index ce5dd6d..0dd41d1 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -223,9 +223,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. if docs[doc].get('html') and jade: cmds = [ - "rm -f ${TARGET.dir}/*.html", + Delete("${TARGET.dir}/*.html"), "jw -b html -o ${TARGET.dir} $SOURCES", - "mv -v ${TARGET.dir}/index.html $TARGET || true", ] if tidy: cmds.append("tidy -m -q $TARGET || true") @@ -233,9 +232,9 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. Local(htmlindex) cmds = [ - "rm -f ${TARGET.dir}/main.html", + Delete("${TARGET.dir}/main.html"), "jw -u -b html -o ${TARGET.dir} $SOURCES", - "mv -v ${TARGET.dir}/main.html $TARGET || true", + Move("$TARGET", "${TARGET.dir}/main.html"), ] if tidy: cmds.append("tidy -m -q $TARGET || true") @@ -261,10 +260,10 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. if docs[doc].get('ps') and jadetex: env.Command(ps, main, [ - "rm -f ${TARGET.dir}/%s" % out, + Delete("${TARGET.dir}/%s" % out), "jw -b ps -o ${TARGET.dir} $SOURCES", "mv ${TARGET.dir}/main.ps $TARGET", - "rm -f ${TARGET.dir}/%s" % out, + Delete("${TARGET.dir}/%s" % out), ]) Local(ps) @@ -286,10 +285,10 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. if docs[doc].get('pdf') and pdfjadetex: env.Command(pdf, main, [ - "rm -f ${TARGET.dir}/%s" % out, + Delete("${TARGET.dir}/%s" % out), "jw -b pdf -o ${TARGET.dir} $SOURCES", "mv ${TARGET.dir}/main.pdf $TARGET", - "rm -f ${TARGET.dir}/out", + Delete("${TARGET.dir}/out"), ]) Local(pdf) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 52c3809..b8a3628 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -28,6 +28,8 @@ RELEASE 0.97 - XXX - Make the scons.bat REM statements into @REM so they aren't printed. + - Make the SCons packaging SConscript files platform independent. + From Anthony Roach: - Fix scanning of pre-compiled header (.pch) files for #includes, |