From 024596366a4d3c03942015b2c7e09ed080d8a6b2 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 26 Feb 2002 21:00:23 +0000 Subject: Extend SConstruct et al. to build .zip files, and to build the scons-src package on Win32 platforms. --- HOWTO/release.txt | 8 +- README | 47 +++-- SConstruct | 504 ++++++++++++++++++++++++++++++++++++------------------ doc/SConscript | 5 +- runtest.py | 11 +- src/CHANGES.txt | 8 + src/setup.py | 7 +- 7 files changed, 394 insertions(+), 196 deletions(-) diff --git a/HOWTO/release.txt b/HOWTO/release.txt index e668be2..caf6ba6 100644 --- a/HOWTO/release.txt +++ b/HOWTO/release.txt @@ -83,9 +83,9 @@ Things to do to release a new version of SCons: # Change the hard-coded package version numbers # in the following files. - aecp SConstruct debian/changelog rpm/scons.spec + aecp README SConstruct debian/changelog rpm/scons.spec - vi SConstruct debian/changelog rpm/scons.spec + vi README SConstruct debian/changelog rpm/scons.spec # Optionally, do the same in the following: [optional] aecp HOWTO/change.txt @@ -123,7 +123,9 @@ Things to do to release a new version of SCons: put scons-0.06-1.src.rpm put scons-0.06.tar.gz put scons-0.06.win32.exe + put scons-0.06.zip put scons-src-0.06.tar.gz + put scons-src-0.06.zip put scons_0.06-1_all.deb Create the new release at the SourceForge project page: @@ -153,7 +155,9 @@ Things to do to release a new version of SCons: scons-0.06-1.src.rpm Any Source .rpm scons-0.06.tar.gz Any .gz scons-0.06.win32.exe i386 Other + scons-0.06.zip Any .zip scons-src-0.06.tar.gz Any Source .gz + scons-src-0.06.zip Any Source .zip scons_0.06-1_all.deb Any .deb (This has to be done one at a time.) diff --git a/README b/README index 1f24ddc..82ae6f6 100644 --- a/README +++ b/README @@ -2,9 +2,9 @@ SCons - a software construction tool -Welcome to the SCons development tree. The purpose of this tree is -not just to hack SCons code, but to package SCons for production -distribution. +Welcome to the SCons development tree. The real purpose of this tree is +to package SCons for production distribution in a variety of formats, +not just to hack SCons code. To that extent, the normal development cycle (enforced by Aegis) is not to test the code directly, but to package SCons, unpack the package, @@ -139,14 +139,16 @@ more work: Depending on the utilities installed on your system, any or all of the following packages will be built: - build/dist/scons-0.04-1.noarch.rpm - build/dist/scons-0.04-1.src.rpm - build/dist/scons-0.04.linux-i686.tar.gz - build/dist/scons-0.04.tar.gz - build/dist/scons-0.04.win32.exe - build/dist/scons-doc-0.04.tar.gz - build/dist/scons-src-0.04.tar.gz - build/dist/scons_0.04-1_all.deb + build/dist/scons-0.06-1.noarch.rpm + build/dist/scons-0.06-1.src.rpm + build/dist/scons-0.06.linux-i686.tar.gz + build/dist/scons-0.06.tar.gz + build/dist/scons-0.06.win32.exe + build/dist/scons-0.06.zip + build/dist/scons-doc-0.06.tar.gz + build/dist/scons-src-0.06.tar.gz + build/dist/scons-src-0.06.zip + build/dist/scons_0.06-1_all.deb The SConstruct file is supposed to be smart enough to avoid trying to build packages for which you don't have the proper utilities installed. @@ -164,19 +166,26 @@ TESTING PACKAGES ================ A full build will unpack and/or install any .deb, .rpm., .src.tar.gz, -and .tar.gz packages into separate build/test-*/ subdirectories. (Of -course, if a package was not built on your system, it should not try to -install it.) The runtest.py script supports a -p option that will run -the specified tests (individually or collectively via the -a option) -against the unpacked build/test-/* subdirectory: +.src.zip, .tar.gz, and .zip packages into separate build/test-*/ +subdirectories. (Of course, if a package was not built on your system, +it should not try to install it.) The runtest.py script supports a -p +option that will run the specified tests (individually or collectively +via the -a option) against the unpacked build/test-/* subdirectory: - $ python runtest.py -p tar-gz + $ python runtest.py -p deb + + $ python runtest.py -p rpm $ python runtest.py -p src-tar-gz - $ python runtest.py -p rpm + $ python runtest.py -p src-zip - $ python runtest.py -p deb + $ python runtest.py -p tar-gz + + $ python runtest.py -p zip + +(The canonical invocation is to specify the runtest.py -a option so that +all tests are run against the specified package.) CONTENTS OF THIS PACKAGE diff --git a/SConstruct b/SConstruct index 9c1fd83..3503874 100644 --- a/SConstruct +++ b/SConstruct @@ -64,9 +64,11 @@ def whereis(file): # aegis = whereis('aegis') aesub = whereis('aesub') -rpm = whereis('rpm') dh_builddeb = whereis('dh_builddeb') fakeroot = whereis('fakeroot') +gzip = whereis('gzip') +rpm = whereis('rpm') +unzip = whereis('unzip') # My installation on Red Hat doesn't like any debhelper version # beyond 2, so let's use 2 as the default on any non-Debian build. @@ -136,33 +138,63 @@ python_ver = sys.version[0:3] platform = distutils.util.get_platform() -if platform == "win32": - archsuffix = "zip" -else: - archsuffix = "tar.gz" - ENV = { 'PATH' : os.environ['PATH'] } if os.environ.has_key('AEGIS_PROJECT'): ENV['AEGIS_PROJECT'] = os.environ['AEGIS_PROJECT'] lib_project = os.path.join("lib", project) -unpack_dir = os.path.join(os.getcwd(), "build", "unpack") +unpack_tar_gz_dir = os.path.join(os.getcwd(), "build", "unpack-tar-gz") -test_arch_dir = os.path.join(os.getcwd(), - "build", - "test-%s" % string.replace(archsuffix, '.', '-')) +unpack_zip_dir = os.path.join(os.getcwd(), "build", "unpack-zip") -test_src_arch_dir = os.path.join(os.getcwd(), - "build", - "test-src-%s" % string.replace(archsuffix, - '.', - '-')) +test_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-tar-gz") +test_src_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-src-tar-gz") + +test_zip_dir = os.path.join(os.getcwd(), "build", "test-zip") +test_src_zip_dir = os.path.join(os.getcwd(), "build", "test-src-zip") test_rpm_dir = os.path.join(os.getcwd(), "build", "test-rpm") test_deb_dir = os.path.join(os.getcwd(), "build", "test-deb") +if platform == "win32": + tar_hflag = '' + python_project_subinst_dir = None + project_script_subinst_dir = 'Scripts' +else: + tar_hflag = 'h' + python_project_subinst_dir = lib_project + project_script_subinst_dir = 'bin' + +# +# Figure out if we can handle .zip files. +# +try: + import zipfile + + def zipit(env, target, source): + print "Zipping %s:" % target + def visit(arg, dirname, names): + for name in names: + arg.write(os.path.join(dirname, name)) + os.chdir('build') + zf = zipfile.ZipFile(target, 'w') + os.path.walk(env['PSV'], visit, zf) + os.chdir('..') + + def unzipit(env, target, source): + print "Unzipping %s:" % source[0] + zf = zipfile.ZipFile(source[0], 'r') + for name in zf.namelist(): + dest = os.path.join(env['UNPACK_ZIP_DIR'], name) + open(dest, 'w').write(zf.read(name)) + +except: + if unzip: + zipit = "cd build && $ZIP $ZIPFLAGS dist/${TARGET.file} $PSV" + unzipit = "$UNZIP $UNZIPFLAGS $SOURCES" + def SCons_revision(target, source, env): """Interpolate specific values from the environment into a file. @@ -193,15 +225,32 @@ def SCons_revision(target, source, env): revbuilder = Builder(name = 'SCons_revision', action = SCons_revision) env = Environment( - ENV = ENV, + ENV = ENV, - DATE = date, - DEVELOPER = developer, - REVISION = revision, - VERSION = version, - DH_COMPAT = dh_compat, - - BUILDERS = [ revbuilder ], + DATE = date, + DEVELOPER = developer, + REVISION = revision, + VERSION = version, + DH_COMPAT = dh_compat, + + TAR_HFLAG = tar_hflag, + + ZIP = whereis('zip'), + ZIPFLAGS = '-r', + UNZIP = unzip, + UNZIPFLAGS = '-o -d $UNPACK_ZIP_DIR', + + TEST_DEB_DIR = test_deb_dir, + TEST_RPM_DIR = test_rpm_dir, + TEST_SRC_TAR_GZ_DIR = test_src_tar_gz_dir, + TEST_SRC_ZIP_DIR = test_src_zip_dir, + TEST_TAR_GZ_DIR = test_tar_gz_dir, + TEST_ZIP_DIR = test_zip_dir, + + UNPACK_TAR_GZ_DIR = unpack_tar_gz_dir, + UNPACK_ZIP_DIR = unpack_zip_dir, + + BUILDERS = [ revbuilder ], ) # @@ -337,8 +386,8 @@ scons = { 'subpkgs' : [ python_scons, scons_script ], 'subinst_dirs' : { - 'python-' + project : lib_project, - project + '-script' : 'bin', + 'python-' + project : python_project_subinst_dir, + project + '-script' : project_script_subinst_dir, }, } @@ -358,6 +407,28 @@ for p in [ scons ]: build = os.path.join('build', pkg) + tar_gz = os.path.join(build, 'dist', "%s.tar.gz" % pkg_version) + platform_tar_gz = os.path.join(build, + 'dist', + "%s.%s.tar.gz" % (pkg_version, platform)) + zip = os.path.join(build, 'dist', "%s.zip" % pkg_version) + platform_zip = os.path.join(build, + 'dist', + "%s.%s.zip" % (pkg_version, platform)) + win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) + + # + # Update the environment with the relevant information + # for this package. + # + # We can get away with calling setup.py using a directory path + # like this because we put a preamble in it that will chdir() + # to the directory in which setup.py exists. + # + env.Update(PKG = pkg, + PKG_VERSION = pkg_version, + SETUP_PY = os.path.join(build, 'setup.py')) + # # Read up the list of source files from our MANIFEST.in. # This list should *not* include LICENSE.txt, MANIFEST, @@ -381,7 +452,9 @@ for p in [ scons ]: f = map(lambda x: x[:-1], open(os.path.join(src, ssubdir, 'MANIFEST.in')).readlines()) src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), f)) - dst_files.extend(map(lambda x, i=isubdir: os.path.join(i, x), f)) + if isubdir: + f = map(lambda x, i=isubdir: os.path.join(i, x), f) + dst_files.extend(f) for k in sp['filemap'].keys(): f = sp['filemap'][k] if f: @@ -411,6 +484,7 @@ for p in [ scons ]: # MANIFEST itself to the array, of course. # src_files.append("MANIFEST") + def copy(target, source, **kw): global src_files src_files.sort() @@ -424,34 +498,106 @@ for p in [ scons ]: copy) # - # Use the Python distutils to generate the packages. + # Now go through and arrange to create whatever packages we can. # - archive = os.path.join(build, 'dist', "%s.%s" % (pkg_version, archsuffix)) - platform_archive = os.path.join(build, - 'dist', - "%s.%s.%s" % (pkg_version, - platform, - archsuffix)) - win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version) + build_src_files = map(lambda x, b=build: os.path.join(b, x), src_files) - src_deps.append(archive) + distutils_formats = [] - build_targets = [ platform_archive, archive, win32_exe ] - install_targets = build_targets[:] + distutils_targets = [ win32_exe ] - # We can get away with calling setup.py using a directory path - # like this because we put a preamble in it that will chdir() - # to the directory in which setup.py exists. - bdist_dirs = [ - os.path.join(build, 'build', 'lib'), - os.path.join(build, 'build', 'scripts'), - ] - setup_py = os.path.join(build, 'setup.py') - commands = [ - "rm -rf %s && python %s bdist" % (string.join(bdist_dirs), setup_py), - "python %s sdist" % setup_py, - "python %s bdist_wininst" % setup_py, - ] + install_targets = distutils_targets[:] + + if gzip: + + distutils_formats.append('gztar') + + src_deps.append(tar_gz) + + distutils_targets.extend([ tar_gz, platform_tar_gz ]) + install_targets.extend([ tar_gz, platform_tar_gz ]) + + # + # Unpack the tar.gz archive created by the distutils into + # build/unpack-tar-gz/scons-{version}. + # + # We'd like to replace the last three lines with the following: + # + # 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. + # + unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, pv=pkg_version: + 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), + "zcat $SOURCES > .temp", + "tar xf .temp -C $UNPACK_TAR_GZ_DIR", + "rm -f .temp", + ]) + + # + # Run setup.py in the unpacked subdirectory to "install" everything + # into our build/test subdirectory. The runtest.py script will set + # PYTHONPATH so that the tests only look under build/test-{package}, + # and under etc (for the testing modules TestCmd.py, TestSCons.py, + # and unittest.py). This makes sure that our tests pass with what + # we really packaged, not because of something hanging around in + # the development directory. + # + # We can get away with calling setup.py using a directory path + # like this because we put a preamble in it that will chdir() + # to the directory in which setup.py exists. + # + 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" % \ + os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'), + ]) + + if zipit: + + distutils_formats.append('zip') + + src_deps.append(zip) + + distutils_targets.extend([ zip, platform_zip ]) + install_targets.extend([ zip, platform_zip ]) + + # + # Unpack the zip archive created by the distutils into + # build/unpack-zip/scons-{version}. + # + unpack_zip_files = map(lambda x, u=unpack_zip_dir, pv=pkg_version: + os.path.join(u, pv, x), + src_files) + + env.Command(unpack_zip_files, zip, unzipit) + + # + # Run setup.py in the unpacked subdirectory to "install" everything + # into our build/test subdirectory. The runtest.py script will set + # PYTHONPATH so that the tests only look under build/test-{package}, + # and under etc (for the testing modules TestCmd.py, TestSCons.py, + # and unittest.py). This makes sure that our tests pass with what + # we really packaged, not because of something hanging around in + # the development directory. + # + # We can get away with calling setup.py using a directory path + # like this because we put a preamble in it that will chdir() + # to the directory in which setup.py exists. + # + 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" % \ + os.path.join(unpack_zip_dir, pkg_version, 'setup.py'), + ]) if rpm: topdir = os.path.join(os.getcwd(), build, 'build', @@ -464,13 +610,12 @@ for p in [ scons ]: SRPMSdir = os.path.join(topdir, 'SRPMS') specfile = os.path.join(SPECSdir, "%s-1.spec" % pkg_version) - sourcefile = os.path.join(SOURCESdir, - "%s.%s" % (pkg_version, archsuffix)); + sourcefile = os.path.join(SOURCESdir, "%s.tar.gz" % pkg_version); rpm = os.path.join(RPMSdir, "%s-1.noarch.rpm" % pkg_version) src_rpm = os.path.join(SRPMSdir, "%s-1.src.rpm" % pkg_version) env.InstallAs(specfile, os.path.join('rpm', "%s.spec" % pkg)) - env.InstallAs(sourcefile, archive) + env.InstallAs(sourcefile, tar_gz) targets = [ rpm, src_rpm ] cmd = "rpm --define '_topdir $(%s$)' -ba $SOURCES" % topdir @@ -485,16 +630,14 @@ for p in [ scons ]: dst_files) env.Command(dfiles, rpm, - "rpm2cpio $SOURCES | (cd %s && cpio -id)" % test_rpm_dir) - - build_src_files = map(lambda x, b=build: os.path.join(b, x), src_files) + "rpm2cpio $SOURCES | (cd $TEST_RPM_DIR && cpio -id)") if dh_builddeb and fakeroot: - # Debian builds directly into build/dist, so we don't - # need to add the .debs to the install_targets. + # Our Debian packaging builds directly into build/dist, + # so we don't need to add the .debs to install_targets. deb = os.path.join('build', 'dist', "%s_%s-1_all.deb" % (pkg, version)) env.Command(deb, build_src_files, [ - "fakeroot make -f debian/rules VERSION=$VERSION DH_COMPAT=$DH_COMPAT ENVOKED_BY_CONSTRUCT=1 binary-%s" % pkg, + "fakeroot make -f debian/rules VERSION=$VERSION DH_COMPAT=$DH_COMPAT ENVOKED_BY_CONSTRUCT=1 binary-$PKG", "env DH_COMPAT=$DH_COMPAT dh_clean" ]) env.Depends(deb, p['debian_deps']) @@ -503,58 +646,32 @@ for p in [ scons ]: dst_files) env.Command(dfiles, deb, - "dpkg --fsys-tarfile $SOURCES | (cd %s && tar -xf -)" % test_deb_dir) + "dpkg --fsys-tarfile $SOURCES | (cd $TEST_DEB_DIR && tar -xf -)") # - # Now set up creation and installation of the packages. + # Use the Python distutils to generate the appropriate packages. # - env.Command(build_targets, build_src_files, commands) - env.Install(os.path.join('build', 'dist'), install_targets) + commands = [ + "rm -rf %s %s" % (os.path.join(build, 'build', 'lib'), + os.path.join(build, 'build', 'scripts')) + ] - # - # Unpack the archive created by the distutils into - # build/unpack/scons-{version}. - # - unpack_files = map(lambda x, u=unpack_dir, pv=pkg_version: - os.path.join(u, pv, x), - src_files) + if distutils_formats: + for format in distutils_formats: + commands.append("python $SETUP_PY bdist_dumb -f %s" % format) - # - # We'd like to replace the last three lines with the following: - # - # tar zxf %< -C $unpack_dir - # - # but that gives heartburn to Cygwin's tar, so work around it - # with separate zcat-tar-rm commands. - env.Command(unpack_files, archive, [ - "rm -rf %s" % os.path.join(unpack_dir, pkg_version), - "zcat $SOURCES > .temp", - "tar xf .temp -C %s" % unpack_dir, - "rm -f .temp", - ]) + commands.append("python $SETUP_PY sdist --formats=%s" % \ + string.join(distutils_formats, ',')) + + commands.append("python $SETUP_PY bdist_wininst") + + env.Command(distutils_targets, build_src_files, commands) # - # Run setup.py in the unpacked subdirectory to "install" everything - # into our build/test subdirectory. The runtest.py script will set - # PYTHONPATH so that the tests only look under build/test-{package}, - # and under etc (for the testing modules TestCmd.py, TestSCons.py, - # and unittest.py). This makes sure that our tests pass with what - # we really packaged, not because of something hanging around in - # the development directory. + # And, lastly, install the appropriate packages in the + # appropriate subdirectory. # - # We can get away with calling setup.py using a directory path - # like this because we put a preamble in it that will chdir() - # to the directory in which setup.py exists. - dfiles = map(lambda x, d=test_arch_dir: os.path.join(d, x), dst_files) - env.Command(dfiles, unpack_files, [ - "rm -rf %s" % os.path.join(unpack_dir, pkg_version, 'build'), - "rm -rf %s" % test_arch_dir, - "python %s install --prefix=%s" % (os.path.join(unpack_dir, - pkg_version, - 'setup.py'), - test_arch_dir - ), - ]) + env.Install(os.path.join('build', 'dist'), install_targets) # # @@ -598,9 +715,7 @@ if change: u[f] = 1 for f in df: del u[f] - sfiles = filter(lambda x: x[-9:] != '.aeignore' - and x[-8:] != '.consign' - and x[-9:] != '.sconsign', + sfiles = filter(lambda x: x[-9:] != '.aeignore' and x[-9:] != '.sconsign', u.keys()) if sfiles: @@ -608,8 +723,10 @@ if change: psv = "%s-%s" % (ps, version) b_ps = os.path.join('build', ps) b_psv = os.path.join('build', psv) + b_psv_stamp = b_psv + '-stamp' - src_archive = os.path.join('build', 'dist', '%s.tar.gz' % psv) + src_tar_gz = os.path.join('build', 'dist', '%s.tar.gz' % psv) + src_zip = os.path.join('build', 'dist', '%s.zip' % psv) for file in sfiles: env.SCons_revision(os.path.join(b_ps, file), file) @@ -618,68 +735,121 @@ if change: cmds = [ "rm -rf %s" % b_psv, "cp -rp %s %s" % (b_ps, b_psv), - "find %s -name .consign -exec rm {} \\;" % b_psv, "find %s -name .sconsign -exec rm {} \\;" % b_psv, - "tar czh -f $TARGET -C build %s" % psv, + "touch $TARGET", ] - env.Command(src_archive, src_deps + b_ps_files, cmds) - - # - # Unpack the archive created by the distutils into - # build/unpack/scons-{version}. - # - unpack_files = map(lambda x, u=unpack_dir, psv=psv: - os.path.join(u, psv, x), - sfiles) + env.Command(b_psv_stamp, src_deps + b_ps_files, cmds) - # - # We'd like to replace the last three lines with the following: - # - # tar zxf %< -C $unpack_dir - # - # but that gives heartburn to Cygwin's tar, so work around it - # with separate zcat-tar-rm commands. - env.Command(unpack_files, src_archive, [ - "rm -rf %s" % os.path.join(unpack_dir, psv), - "zcat $SOURCES > .temp", - "tar xf .temp -C %s" % unpack_dir, - "rm -f .temp", - ]) + if gzip: - # - # Run setup.py in the unpacked subdirectory to "install" everything - # into our build/test subdirectory. The runtest.py script will set - # PYTHONPATH so that the tests only look under build/test-{package}, - # and under etc (for the testing modules TestCmd.py, TestSCons.py, - # and unittest.py). This makes sure that our tests pass with what - # we really packaged, not because of something hanging around in - # the development directory. - # - # We can get away with calling setup.py using a directory path - # like this because we put a preamble in it that will chdir() - # to the directory in which setup.py exists. - dfiles = map(lambda x, d=test_src_arch_dir: os.path.join(d, x), - dst_files) - ENV = env.Dictionary('ENV') - ENV['SCONS_LIB_DIR'] = os.path.join(unpack_dir, psv, 'src', 'engine') - ENV['USERNAME'] = developer - env.Copy(ENV = ENV).Command(dfiles, unpack_files, [ - "rm -rf %s" % os.path.join(unpack_dir, - psv, - 'build', - 'scons', - 'build'), - "rm -rf %s" % test_src_arch_dir, - "cd %s && python %s %s" % \ - (os.path.join(unpack_dir, psv), - os.path.join('src', 'script', 'scons.py'), - os.path.join('build', 'scons')), - "python %s install --prefix=%s" % (os.path.join(unpack_dir, - psv, - 'build', - 'scons', - 'setup.py'), - test_src_arch_dir - ), - ]) + env.Command(src_tar_gz, b_psv_stamp, + "tar cz${TAR_HFLAG} -f $TARGET -C build %s" % psv) + + # + # Unpack the archive into build/unpack/scons-{version}. + # + unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, psv=psv: + os.path.join(u, psv, x), + sfiles) + + # + # We'd like to replace the last three lines with the following: + # + # 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), + "zcat $SOURCES > .temp", + "tar xf .temp -C $UNPACK_TAR_GZ_DIR", + "rm -f .temp", + ]) + + # + # Run setup.py in the unpacked subdirectory to "install" everything + # into our build/test subdirectory. The runtest.py script will set + # PYTHONPATH so that the tests only look under build/test-{package}, + # and under etc (for the testing modules TestCmd.py, TestSCons.py, + # and unittest.py). This makes sure that our tests pass with what + # we really packaged, not because of something hanging around in + # the development directory. + # + # We can get away with calling setup.py using a directory path + # like this because we put a preamble in it that will chdir() + # to the directory in which setup.py exists. + # + dfiles = map(lambda x, d=test_src_tar_gz_dir: os.path.join(d, x), + dst_files) + ENV = env.Dictionary('ENV') + ENV['SCONS_LIB_DIR'] = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine') + ENV['USERNAME'] = developer + env.Copy(ENV = 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" % \ + (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" % \ + os.path.join(unpack_tar_gz_dir, + psv, + 'build', + 'scons', + 'setup.py'), + ]) + + if zipit: + + env.Copy(PSV = psv).Command(src_zip, b_psv_stamp, zipit) + + # + # Unpack the archive into build/unpack/scons-{version}. + # + unpack_zip_files = map(lambda x, u=unpack_zip_dir, psv=psv: + os.path.join(u, psv, x), + sfiles) + + env.Command(unpack_zip_files, src_zip, unzipit) + + # + # Run setup.py in the unpacked subdirectory to "install" everything + # into our build/test subdirectory. The runtest.py script will set + # PYTHONPATH so that the tests only look under build/test-{package}, + # and under etc (for the testing modules TestCmd.py, TestSCons.py, + # and unittest.py). This makes sure that our tests pass with what + # we really packaged, not because of something hanging around in + # the development directory. + # + # We can get away with calling setup.py using a directory path + # like this because we put a preamble in it that will chdir() + # to the directory in which setup.py exists. + # + dfiles = map(lambda x, d=test_src_zip_dir: os.path.join(d, x), + dst_files) + ENV = env.Dictionary('ENV') + ENV['SCONS_LIB_DIR'] = os.path.join(unpack_zip_dir, psv, 'src', 'engine') + ENV['USERNAME'] = developer + env.Copy(ENV = 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" % \ + (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" % \ + os.path.join(unpack_zip_dir, + psv, + 'build', + 'scons', + 'setup.py'), + ]) diff --git a/doc/SConscript b/doc/SConscript index 0356bf5..185cad0 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -280,5 +280,6 @@ if man2html: # Now actually create the tar file of the documentation, # for easy distribution to the web site. # -env.Command(doc_tar_gz, tar_deps, - "tar zch -f $TARGET -C build/doc %s" % tar_list) +if tar_deps: + env.Command(doc_tar_gz, tar_deps, + "tar zc${TAR_HFLAG} -f $TARGET -C build/doc %s" % tar_list) diff --git a/runtest.py b/runtest.py index af6e258..400f84c 100644 --- a/runtest.py +++ b/runtest.py @@ -88,7 +88,9 @@ if package: 'deb' : 'usr', 'rpm' : 'usr', 'src-tar-gz' : '', + 'src-zip' : '', 'tar-gz' : '', + 'zip' : '', } if not dir.has_key(package): @@ -97,9 +99,12 @@ if package: test_dir = os.path.join(cwd, 'build', 'test-%s' % package) - scons_dir = os.path.join(test_dir, dir[package], 'bin') - - lib_dir = os.path.join(test_dir, dir[package], 'lib', 'scons') + if sys.platform == 'win32': + scons_dir = os.path.join(test_dir, dir[package], 'Scripts') + lib_dir = os.path.join(test_dir, dir[package]) + else: + scons_dir = os.path.join(test_dir, dir[package], 'bin') + lib_dir = os.path.join(test_dir, dir[package], 'lib', 'scons') else: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9d0db07..5abbe6d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -8,6 +8,14 @@ +RELEASE 0.06 - + + From Steven Knight: + + - Add .zip files to the packages we build. + + + RELEASE 0.05 - Thu, 21 Feb 2002 16:50:03 -0600 From Chad Austin: diff --git a/src/setup.py b/src/setup.py index d664527..73abe19 100644 --- a/src/setup.py +++ b/src/setup.py @@ -40,6 +40,7 @@ class my_install_lib(install_lib): def finalize_options(self): install_lib.finalize_options(self) head = self.install_dir + drive, head = os.path.splitdrive(self.install_dir) while head: if head == os.sep: head = None @@ -47,17 +48,17 @@ class my_install_lib(install_lib): else: head, tail = os.path.split(head) if tail[:6] == "python": - self.install_dir = os.path.join(head, "scons") + self.install_dir = os.path.join(drive + head, "scons") # Our original packaging scheme placed the build engine # in a private library directory that contained the SCons # version number in the directory name. Here's how this # was supported here. See the Construct file for details # on other files that would need to be changed to support # this as well. - #self.install_dir = os.path.join(head, "scons-__VERSION__") + #self.install_dir = os.path.join(drive + head, "scons-__VERSION__") return elif tail[:6] == "Python": - self.install_dir = os.path.join(head, tail) + self.install_dir = os.path.join(drive + head, tail) return arguments = { -- cgit v0.12