2 # SConstruct file to build scons packages during development.
4 # See the README file for an overview of how SCons is built and tested.
8 # Copyright (c) 2001, 2002 Steven Knight
10 # Permission is hereby granted, free of charge, to any person obtaining
11 # a copy of this software and associated documentation files (the
12 # "Software"), to deal in the Software without restriction, including
13 # without limitation the rights to use, copy, modify, merge, publish,
14 # distribute, sublicense, and/or sell copies of the Software, and to
15 # permit persons to whom the Software is furnished to do so, subject to
16 # the following conditions:
18 # The above copyright notice and this permission notice shall be included
19 # in all copies or substantial portions of the Software.
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
22 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
23 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 default_version = '0.09'
45 # An internal "whereis" routine to figure out if a given program
46 # is available on this system.
49 for dir in string.split(os.environ['PATH'], os.pathsep):
50 f = os.path.join(dir, file)
56 if stat.S_IMODE(st[stat.ST_MODE]) & 0111:
61 # We let the presence or absence of various utilities determine
62 # whether or not we bother to build certain pieces of things.
63 # This should allow people to still do SCons work even if they
64 # don't have Aegis or RPM installed, for example.
66 aegis = whereis('aegis')
67 aesub = whereis('aesub')
68 dh_builddeb = whereis('dh_builddeb')
69 fakeroot = whereis('fakeroot')
70 gzip = whereis('gzip')
72 unzip = whereis('unzip')
76 # Now grab the information that we "build" into the files.
79 date = ARGUMENTS['date']
81 date = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(time.time()))
83 if ARGUMENTS.has_key('developer'):
84 developer = ARGUMENTS['developer']
85 elif os.environ.has_key('USERNAME'):
86 developer = os.environ['USERNAME']
87 elif os.environ.has_key('LOGNAME'):
88 developer = os.environ['LOGNAME']
89 elif os.environ.has_key('USER'):
90 developer = os.environ['USER']
92 if ARGUMENTS.has_key('build_system'):
93 build_system = ARGUMENTS['build_system']
95 build_system = string.split(socket.gethostname(), '.')[0]
97 if ARGUMENTS.has_key('version'):
98 revision = ARGUMENTS['version']
100 revision = os.popen(aesub + " \\$version", "r").read()[:-1]
102 revision = default_version
104 a = string.split(revision, '.')
110 revision = string.join(arr, '.')
112 # Here's how we'd turn the calculated $revision into our package $version.
113 # This makes it difficult to coordinate with other files (debian/changelog
114 # and rpm/scons.spec) that hard-code the version number, so just go with
115 # the flow for now and hard code it here, too.
119 # if str[0] == 'C' or str[0] == 'D':
121 # while len(str) > 2 and str[0] == '0':
124 #arr = map(lambda x, xxx=xxx: xxx(x), arr)
125 #version = string.join(arr, '.')
126 version = default_version
128 build_id = string.replace(revision, version + '.', '')
130 if ARGUMENTS.has_key('change'):
131 change = ARGUMENTS['change']
133 change = os.popen(aesub + " \\$change", "r").read()[:-1]
135 change = default_version
137 python_ver = sys.version[0:3]
139 platform = distutils.util.get_platform()
141 ENV = { 'PATH' : os.environ['PATH'] }
142 for key in ['AEGIS_PROJECT', 'PYTHONPATH']:
143 if os.environ.has_key(key):
144 ENV[key] = os.environ[key]
146 lib_project = os.path.join("lib", project)
148 cwd_build = os.path.join(os.getcwd(), "build")
150 test_deb_dir = os.path.join(cwd_build, "test-deb")
151 test_rpm_dir = os.path.join(cwd_build, "test-rpm")
152 test_tar_gz_dir = os.path.join(cwd_build, "test-tar-gz")
153 test_src_tar_gz_dir = os.path.join(cwd_build, "test-src-tar-gz")
154 test_zip_dir = os.path.join(cwd_build, "test-zip")
155 test_src_zip_dir = os.path.join(cwd_build, "test-src-zip")
157 unpack_tar_gz_dir = os.path.join(cwd_build, "unpack-tar-gz")
158 unpack_zip_dir = os.path.join(cwd_build, "unpack-zip")
160 if platform == "win32":
162 python_project_subinst_dir = None
163 project_script_subinst_dir = 'Scripts'
166 python_project_subinst_dir = lib_project
167 project_script_subinst_dir = 'bin'
173 # Figure out if we can handle .zip files.
180 def zipit(env, target, source):
181 print "Zipping %s:" % str(target[0])
182 def visit(arg, dirname, names):
184 path = os.path.join(dirname, name)
185 if os.path.isfile(path):
187 zf = zipfile.ZipFile(str(target[0]), 'w')
189 os.path.walk(env['PSV'], visit, zf)
193 def unzipit(env, target, source):
194 print "Unzipping %s:" % str(source[0])
195 zf = zipfile.ZipFile(str(source[0]), 'r')
196 for name in zf.namelist():
197 dest = os.path.join(env['UNPACK_ZIP_DIR'], name)
198 dir = os.path.dirname(dest)
204 # if the file exists, then delete it before writing
205 # to it so that we don't end up trying to write to a symlink:
206 if os.path.isfile(dest) or os.path.islink(dest):
208 if not os.path.isdir(dest):
209 open(dest, 'w').write(zf.read(name))
213 zipit = "cd build && $ZIP $ZIPFLAGS dist/${TARGET.file} $PSV"
214 unzipit = "$UNZIP $UNZIPFLAGS $SOURCES"
216 def SCons_revision(target, source, env):
217 """Interpolate specific values from the environment into a file.
219 This is used to copy files into a tree that gets packaged up
220 into the source file package.
224 # Note: We don't use $VERSION from the environment so that
225 # this routine will change when the version number changes
226 # and things will get rebuilt properly.
228 print "SCons_revision() < %s > %s" % (s, t)
231 for line in inf.readlines():
232 # Note: We construct the __*__ substitution strings here
233 # so that they don't get replaced when this file gets
234 # copied into the tree for packaging.
235 line = string.replace(line, '__BUILD' + '__', env['BUILD'])
236 line = string.replace(line, '__BUILDSYS' + '__', env['BUILDSYS'])
237 line = string.replace(line, '__DATE' + '__', env['DATE'])
238 line = string.replace(line, '__DEVELOPER' + '__', env['DEVELOPER'])
239 line = string.replace(line, '__FILE' + '__', s)
240 line = string.replace(line, '__REVISION' + '__', env['REVISION'])
241 line = string.replace(line, '__VERSION' + '__', version)
245 os.chmod(t, os.stat(s)[0])
247 revbuilder = Builder(action = SCons_revision)
253 BUILDSYS = build_system,
255 DEVELOPER = developer,
260 TAR_HFLAG = tar_hflag,
265 UNZIPFLAGS = '-o -d $UNPACK_ZIP_DIR',
269 TEST_DEB_DIR = test_deb_dir,
270 TEST_RPM_DIR = test_rpm_dir,
271 TEST_SRC_TAR_GZ_DIR = test_src_tar_gz_dir,
272 TEST_SRC_ZIP_DIR = test_src_zip_dir,
273 TEST_TAR_GZ_DIR = test_tar_gz_dir,
274 TEST_ZIP_DIR = test_zip_dir,
276 UNPACK_TAR_GZ_DIR = unpack_tar_gz_dir,
277 UNPACK_ZIP_DIR = unpack_zip_dir,
279 BUILDERS = { 'SCons_revision' : revbuilder },
281 PYTHON = sys.executable
285 # Define SCons packages.
287 # In the original, more complicated packaging scheme, we were going
288 # to have separate packages for:
290 # python-scons only the build engine
291 # scons-script only the script
292 # scons the script plus the build engine
294 # We're now only delivering a single "scons" package, but this is still
295 # "built" as two sub-packages (the build engine and the script), so
296 # the definitions remain here, even though we're not using them for
301 'pkg' : 'python-' + project,
302 'src_subdir' : 'engine',
303 'inst_subdir' : os.path.join('lib', 'python1.5', 'site-packages'),
316 'files' : [ 'LICENSE.txt',
323 'LICENSE.txt' : '../LICENSE.txt'
328 # The original packaging scheme would have have required us to push
329 # the Python version number into the package name (python1.5-scons,
330 # python2.0-scons, etc.), which would have required a definition
331 # like the following. Leave this here in case we ever decide to do
332 # this in the future, but note that this would require some modification
333 # to src/engine/setup.py before it would really work.
336 # 'pkg' : 'python2-' + project,
337 # 'src_subdir' : 'engine',
338 # 'inst_subdir' : os.path.join('lib', 'python2.1', 'site-packages'),
341 # 'debian/changelog',
343 # 'debian/copyright',
358 # 'LICENSE.txt' : '../LICENSE.txt',
364 'pkg' : project + '-script',
365 'src_subdir' : 'script',
366 'inst_subdir' : 'bin',
387 'LICENSE.txt' : '../LICENSE.txt',
388 'scons' : 'scons.py',
411 'os_spawnv_fix.diff',
419 'scons.1' : '../doc/man/scons.1',
422 'subpkgs' : [ python_scons, scons_script ],
425 'python-' + project : python_project_subinst_dir,
426 project + '-script' : project_script_subinst_dir,
435 # Initialize variables with the right directories for this package.
438 pkg_version = "%s-%s" % (pkg, version)
441 if p.has_key('src_subdir'):
442 src = os.path.join(src, p['src_subdir'])
444 build = os.path.join('build', pkg)
446 tar_gz = os.path.join(build, 'dist', "%s.tar.gz" % pkg_version)
447 platform_tar_gz = os.path.join(build,
449 "%s.%s.tar.gz" % (pkg_version, platform))
450 zip = os.path.join(build, 'dist', "%s.zip" % pkg_version)
451 platform_zip = os.path.join(build,
453 "%s.%s.zip" % (pkg_version, platform))
454 win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version)
457 # Update the environment with the relevant information
460 # We can get away with calling setup.py using a directory path
461 # like this because we put a preamble in it that will chdir()
462 # to the directory in which setup.py exists.
464 env.Update(PKG = pkg,
465 PKG_VERSION = pkg_version,
466 SETUP_PY = os.path.join(build, 'setup.py'))
469 # Read up the list of source files from our MANIFEST.in.
470 # This list should *not* include LICENSE.txt, MANIFEST,
471 # README.txt, or setup.py. Make a copy of the list for the
474 manifest_in = File(os.path.join(src, 'MANIFEST.in')).rstr()
475 src_files = map(lambda x: x[:-1],
476 open(manifest_in).readlines())
477 dst_files = src_files[:]
479 MANIFEST_in_list = []
481 if p.has_key('subpkgs'):
483 # This package includes some sub-packages. Read up their
484 # MANIFEST.in files, and add them to our source and destination
485 # file lists, modifying them as appropriate to add the
488 for sp in p['subpkgs']:
489 ssubdir = sp['src_subdir']
490 isubdir = p['subinst_dirs'][sp['pkg']]
491 MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr()
492 MANIFEST_in_list.append(MANIFEST_in)
493 f = map(lambda x: x[:-1], open(MANIFEST_in).readlines())
494 src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), f))
496 f = map(lambda x, i=isubdir: os.path.join(i, x), f)
498 for k in sp['filemap'].keys():
501 k = os.path.join(sp['src_subdir'], k)
502 p['filemap'][k] = os.path.join(sp['src_subdir'], f)
505 # Now that we have the "normal" source files, add those files
506 # that are standard for each distribution. Note that we don't
507 # add these to dst_files, because they don't get installed.
508 # And we still have the MANIFEST to add.
510 src_files.extend(p['files'])
513 # Now run everything in src_file through the sed command we
514 # concocted to expand __FILE__, __VERSION__, etc.
517 s = p['filemap'].get(b, b)
518 env.SCons_revision(os.path.join(build, b), os.path.join(src, s))
521 # NOW, finally, we can create the MANIFEST, which we do
522 # by having Python spit out the contents of the src_files
523 # array we've carefully created. After we've added
524 # MANIFEST itself to the array, of course.
526 src_files.append("MANIFEST")
527 MANIFEST_in_list.append(os.path.join(src, 'MANIFEST.in'))
529 def copy(target, source, **kw):
532 f = open(str(target[0]), 'wb')
533 for file in src_files:
537 env.Command(os.path.join(build, 'MANIFEST'), MANIFEST_in_list, copy)
540 # Now go through and arrange to create whatever packages we can.
542 build_src_files = map(lambda x, b=build: os.path.join(b, x), src_files)
544 distutils_formats = []
546 distutils_targets = [ win32_exe ]
548 install_targets = distutils_targets[:]
552 distutils_formats.append('gztar')
554 src_deps.append(tar_gz)
556 distutils_targets.extend([ tar_gz, platform_tar_gz ])
557 install_targets.extend([ tar_gz, platform_tar_gz ])
560 # Unpack the tar.gz archive created by the distutils into
561 # build/unpack-tar-gz/scons-{version}.
563 # We'd like to replace the last three lines with the following:
565 # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
567 # but that gives heartburn to Cygwin's tar, so work around it
568 # with separate zcat-tar-rm commands.
570 unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, pv=pkg_version:
571 os.path.join(u, pv, x),
573 env.Command(unpack_tar_gz_files, tar_gz, [
574 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version),
575 "$ZCAT $SOURCES > .temp",
576 "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
581 # Run setup.py in the unpacked subdirectory to "install" everything
582 # into our build/test subdirectory. The runtest.py script will set
583 # PYTHONPATH so that the tests only look under build/test-{package},
584 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
585 # and unittest.py). This makes sure that our tests pass with what
586 # we really packaged, not because of something hanging around in
587 # the development directory.
589 # We can get away with calling setup.py using a directory path
590 # like this because we put a preamble in it that will chdir()
591 # to the directory in which setup.py exists.
593 dfiles = map(lambda x, d=test_tar_gz_dir: os.path.join(d, x), dst_files)
594 env.Command(dfiles, unpack_tar_gz_files, [
595 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version, 'build'),
596 "rm -rf $TEST_TAR_GZ_DIR",
597 "$PYTHON %s install --prefix=$TEST_TAR_GZ_DIR" % \
598 os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'),
603 distutils_formats.append('zip')
607 distutils_targets.extend([ zip, platform_zip ])
608 install_targets.extend([ zip, platform_zip ])
611 # Unpack the zip archive created by the distutils into
612 # build/unpack-zip/scons-{version}.
614 unpack_zip_files = map(lambda x, u=unpack_zip_dir, pv=pkg_version:
615 os.path.join(u, pv, x),
618 env.Command(unpack_zip_files, zip, unzipit)
621 # Run setup.py in the unpacked subdirectory to "install" everything
622 # into our build/test subdirectory. The runtest.py script will set
623 # PYTHONPATH so that the tests only look under build/test-{package},
624 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
625 # and unittest.py). This makes sure that our tests pass with what
626 # we really packaged, not because of something hanging around in
627 # the development directory.
629 # We can get away with calling setup.py using a directory path
630 # like this because we put a preamble in it that will chdir()
631 # to the directory in which setup.py exists.
633 dfiles = map(lambda x, d=test_zip_dir: os.path.join(d, x), dst_files)
634 env.Command(dfiles, unpack_zip_files, [
635 "rm -rf %s" % os.path.join(unpack_zip_dir, pkg_version, 'build'),
636 "rm -rf $TEST_ZIP_DIR",
637 "$PYTHON %s install --prefix=$TEST_ZIP_DIR" % \
638 os.path.join(unpack_zip_dir, pkg_version, 'setup.py'),
642 topdir = os.path.join(os.getcwd(), build, 'build',
643 'bdist.' + platform, 'rpm')
645 BUILDdir = os.path.join(topdir, 'BUILD', pkg + '-' + version)
646 RPMSdir = os.path.join(topdir, 'RPMS', 'noarch')
647 SOURCESdir = os.path.join(topdir, 'SOURCES')
648 SPECSdir = os.path.join(topdir, 'SPECS')
649 SRPMSdir = os.path.join(topdir, 'SRPMS')
651 specfile = os.path.join(SPECSdir, "%s-1.spec" % pkg_version)
652 sourcefile = os.path.join(SOURCESdir, "%s.tar.gz" % pkg_version);
653 rpm = os.path.join(RPMSdir, "%s-1.noarch.rpm" % pkg_version)
654 src_rpm = os.path.join(SRPMSdir, "%s-1.src.rpm" % pkg_version)
656 env.InstallAs(specfile, os.path.join('rpm', "%s.spec" % pkg))
657 env.InstallAs(sourcefile, tar_gz)
659 targets = [ rpm, src_rpm ]
660 cmd = "rpm --define '_topdir $(%s$)' -ba $SOURCES" % topdir
661 if not os.path.isdir(BUILDdir):
662 cmd = ("$( mkdir -p %s; $)" % BUILDdir) + cmd
663 env.Command(targets, specfile, cmd)
664 env.Depends(targets, sourcefile)
666 install_targets.extend(targets)
668 dfiles = map(lambda x, d=test_rpm_dir: os.path.join(d, 'usr', x),
672 "rpm2cpio $SOURCES | (cd $TEST_RPM_DIR && cpio -id)")
674 if dh_builddeb and fakeroot:
675 # Our Debian packaging builds directly into build/dist,
676 # so we don't need to add the .debs to install_targets.
677 deb = os.path.join('build', 'dist', "%s_%s-1_all.deb" % (pkg, version))
678 for d in p['debian_deps']:
679 b = env.SCons_revision(os.path.join(build, d), d)
681 env.Command(deb, build_src_files, [
682 "cd %s && fakeroot make -f debian/rules PYTHON=$PYTHON BUILDDEB_OPTIONS=--destdir=../../build/dist binary" % build,
685 old = os.path.join('lib', 'scons', '')
686 new = os.path.join('lib', 'python2.1', 'site-packages', '')
687 def xxx(s, old=old, new=new):
688 if s[:len(old)] == old:
689 s = new + s[len(old):]
690 return os.path.join('usr', s)
691 dfiles = map(lambda x, t=test_deb_dir: os.path.join(t, x),
695 "dpkg --fsys-tarfile $SOURCES | (cd $TEST_DEB_DIR && tar -xf -)")
698 # Use the Python distutils to generate the appropriate packages.
701 "rm -rf %s" % os.path.join(build, 'build', 'lib'),
702 "rm -rf %s" % os.path.join(build, 'build', 'scripts'),
705 if distutils_formats:
706 commands.append("rm -rf %s" % os.path.join(build,
710 for format in distutils_formats:
711 commands.append("$PYTHON $SETUP_PY bdist_dumb -f %s" % format)
713 commands.append("$PYTHON $SETUP_PY sdist --formats=%s" % \
714 string.join(distutils_formats, ','))
716 commands.append("$PYTHON $SETUP_PY bdist_wininst")
718 env.Command(distutils_targets, build_src_files, commands)
721 # And, lastly, install the appropriate packages in the
722 # appropriate subdirectory.
724 env.Install(os.path.join('build', 'dist'), install_targets)
731 SConscript('etc/SConscript')
736 BuildDir('build/doc', 'doc')
738 Export('env', 'whereis')
740 SConscript('build/doc/SConscript')
743 # If we're running in the actual Aegis project, pack up a complete
744 # source archive from the project files and files in the change,
745 # so we can share it with helpful developers who don't use Aegis.
750 cmd = "aegis -list -unf -c %s cf 2>/dev/null" % change
751 for line in map(lambda x: x[:-1], os.popen(cmd, "r").readlines()):
752 a = string.split(line)
756 cmd = "aegis -list -terse pf 2>/dev/null"
757 pf = map(lambda x: x[:-1], os.popen(cmd, "r").readlines())
758 cmd = "aegis -list -terse cf 2>/dev/null"
759 cf = map(lambda x: x[:-1], os.popen(cmd, "r").readlines())
765 sfiles = filter(lambda x: x[-9:] != '.aeignore' and x[-9:] != '.sconsign',
769 ps = "%s-src" % project
770 psv = "%s-%s" % (ps, version)
771 b_ps = os.path.join('build', ps)
772 b_psv = os.path.join('build', psv)
773 b_psv_stamp = b_psv + '-stamp'
775 src_tar_gz = os.path.join('build', 'dist', '%s.tar.gz' % psv)
776 src_zip = os.path.join('build', 'dist', '%s.zip' % psv)
779 env.SCons_revision(os.path.join(b_ps, file), file)
781 b_ps_files = map(lambda x, d=b_ps: os.path.join(d, x), sfiles)
784 "cp -rp %s %s" % (b_ps, b_psv),
785 "find %s -name .sconsign -exec rm {} \\;" % b_psv,
789 env.Command(b_psv_stamp, src_deps + b_ps_files, cmds)
793 env.Command(src_tar_gz, b_psv_stamp,
794 "tar cz${TAR_HFLAG} -f $TARGET -C build %s" % psv)
797 # Unpack the archive into build/unpack/scons-{version}.
799 unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, psv=psv:
800 os.path.join(u, psv, x),
804 # We'd like to replace the last three lines with the following:
806 # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
808 # but that gives heartburn to Cygwin's tar, so work around it
809 # with separate zcat-tar-rm commands.
810 env.Command(unpack_tar_gz_files, src_tar_gz, [
811 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, psv),
812 "$ZCAT $SOURCES > .temp",
813 "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
818 # Run setup.py in the unpacked subdirectory to "install" everything
819 # into our build/test subdirectory. The runtest.py script will set
820 # PYTHONPATH so that the tests only look under build/test-{package},
821 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
822 # and unittest.py). This makes sure that our tests pass with what
823 # we really packaged, not because of something hanging around in
824 # the development directory.
826 # We can get away with calling setup.py using a directory path
827 # like this because we put a preamble in it that will chdir()
828 # to the directory in which setup.py exists.
830 dfiles = map(lambda x, d=test_src_tar_gz_dir: os.path.join(d, x),
832 ENV = env.Dictionary('ENV')
833 ENV['SCONS_LIB_DIR'] = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine')
834 ENV['USERNAME'] = developer
835 env.Copy(ENV = ENV).Command(dfiles, unpack_tar_gz_files, [
836 "rm -rf %s" % os.path.join(unpack_tar_gz_dir,
841 "rm -rf $TEST_SRC_TAR_GZ_DIR",
842 "cd %s && $PYTHON %s %s" % \
843 (os.path.join(unpack_tar_gz_dir, psv),
844 os.path.join('src', 'script', 'scons.py'),
845 os.path.join('build', 'scons')),
846 "$PYTHON %s install --prefix=$TEST_SRC_TAR_GZ_DIR" % \
847 os.path.join(unpack_tar_gz_dir,
856 env.Copy(PSV = psv).Command(src_zip, b_psv_stamp, zipit)
859 # Unpack the archive into build/unpack/scons-{version}.
861 unpack_zip_files = map(lambda x, u=unpack_zip_dir, psv=psv:
862 os.path.join(u, psv, x),
865 env.Command(unpack_zip_files, src_zip, unzipit)
868 # Run setup.py in the unpacked subdirectory to "install" everything
869 # into our build/test subdirectory. The runtest.py script will set
870 # PYTHONPATH so that the tests only look under build/test-{package},
871 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
872 # and unittest.py). This makes sure that our tests pass with what
873 # we really packaged, not because of something hanging around in
874 # the development directory.
876 # We can get away with calling setup.py using a directory path
877 # like this because we put a preamble in it that will chdir()
878 # to the directory in which setup.py exists.
880 dfiles = map(lambda x, d=test_src_zip_dir: os.path.join(d, x),
882 ENV = env.Dictionary('ENV')
883 ENV['SCONS_LIB_DIR'] = os.path.join(unpack_zip_dir, psv, 'src', 'engine')
884 ENV['USERNAME'] = developer
885 env.Copy(ENV = ENV).Command(dfiles, unpack_zip_files, [
886 "rm -rf %s" % os.path.join(unpack_zip_dir,
891 "rm -rf $TEST_SRC_ZIP_DIR",
892 "cd %s && $PYTHON %s %s" % \
893 (os.path.join(unpack_zip_dir, psv),
894 os.path.join('src', 'script', 'scons.py'),
895 os.path.join('build', 'scons')),
896 "$PYTHON %s install --prefix=$TEST_SRC_ZIP_DIR" % \
897 os.path.join(unpack_zip_dir,