2 # SConstruct file to build scons packages during development.
6 # Copyright (c) 2001, 2002 Steven Knight
8 # Permission is hereby granted, free of charge, to any person obtaining
9 # a copy of this software and associated documentation files (the
10 # "Software"), to deal in the Software without restriction, including
11 # without limitation the rights to use, copy, modify, merge, publish,
12 # distribute, sublicense, and/or sell copies of the Software, and to
13 # permit persons to whom the Software is furnished to do so, subject to
14 # the following conditions:
16 # The above copyright notice and this permission notice shall be included
17 # in all copies or substantial portions of the Software.
19 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
20 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
21 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 default_version = '0.07'
42 # An internal "whereis" routine to figure out if we have a
43 # given program available. Put it in the "cons::" package
44 # so subsidiary Conscript files can get at it easily, too.
48 for dir in string.split(os.environ['PATH'], os.pathsep):
49 f = os.path.join(dir, file)
55 if stat.S_IMODE(st[stat.ST_MODE]) & 0111:
60 # We let the presence or absence of various utilities determine
61 # whether or not we bother to build certain pieces of things.
62 # This will allow people to still do SCons work even if they
63 # don't have Aegis or RPM installed, for example.
65 aegis = whereis('aegis')
66 aesub = whereis('aesub')
67 dh_builddeb = whereis('dh_builddeb')
68 fakeroot = whereis('fakeroot')
69 gzip = whereis('gzip')
71 unzip = whereis('unzip')
74 # My installation on Red Hat doesn't like any debhelper version
75 # beyond 2, so let's use 2 as the default on any non-Debian build.
76 if os.path.isfile('/etc/debian_version'):
82 # Now grab the information that we "build" into the files (using sed).
85 date = ARGUMENTS['date']
87 date = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(time.time()))
89 if ARGUMENTS.has_key('developer'):
90 developer = ARGUMENTS['developer']
91 elif os.environ.has_key('USERNAME'):
92 developer = os.environ['USERNAME']
93 elif os.environ.has_key('LOGNAME'):
94 developer = os.environ['LOGNAME']
95 elif os.environ.has_key('USER'):
96 developer = os.environ['USER']
99 revision = ARGUMENTS['version']
102 revision = os.popen(aesub + " \\$version", "r").read()[:-1]
104 revision = default_version
106 a = string.split(revision, '.')
112 revision = string.join(arr, '.')
114 # Here's how we'd turn the calculated $revision into our package $version.
115 # This makes it difficult to coordinate with other files (debian/changelog
116 # and rpm/scons.spec) that hard-code the version number, so just go with
117 # the flow for now and hard code it here, too.
121 # if str[0] == 'C' or str[0] == 'D':
123 # while len(str) > 2 and str[0] == '0':
126 #arr = map(lambda x, xxx=xxx: xxx(x), arr)
127 #version = string.join(arr, '.')
128 version = default_version
131 change = ARGUMENTS['change']
134 change = os.popen(aesub + " \\$change", "r").read()[:-1]
136 change = default_version
138 python_ver = sys.version[0:3]
140 platform = distutils.util.get_platform()
142 ENV = { 'PATH' : os.environ['PATH'] }
143 if os.environ.has_key('AEGIS_PROJECT'):
144 ENV['AEGIS_PROJECT'] = os.environ['AEGIS_PROJECT']
146 lib_project = os.path.join("lib", project)
148 unpack_tar_gz_dir = os.path.join(os.getcwd(), "build", "unpack-tar-gz")
150 unpack_zip_dir = os.path.join(os.getcwd(), "build", "unpack-zip")
152 test_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-tar-gz")
153 test_src_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-src-tar-gz")
155 test_zip_dir = os.path.join(os.getcwd(), "build", "test-zip")
156 test_src_zip_dir = os.path.join(os.getcwd(), "build", "test-src-zip")
158 test_rpm_dir = os.path.join(os.getcwd(), "build", "test-rpm")
160 test_deb_dir = os.path.join(os.getcwd(), "build", "test-deb")
162 if platform == "win32":
164 python_project_subinst_dir = None
165 project_script_subinst_dir = 'Scripts'
168 python_project_subinst_dir = lib_project
169 project_script_subinst_dir = 'bin'
172 # Figure out if we can handle .zip files.
177 def zipit(env, target, source):
178 print "Zipping %s:" % str(target[0])
179 def visit(arg, dirname, names):
181 path = os.path.join(dirname, name)
182 if os.path.isfile(path):
184 zf = zipfile.ZipFile(str(target[0]), 'w')
186 os.path.walk(env['PSV'], visit, zf)
190 def unzipit(env, target, source):
191 print "Unzipping %s:" % str(source[0])
192 zf = zipfile.ZipFile(str(source[0]), 'r')
193 for name in zf.namelist():
194 dest = os.path.join(env['UNPACK_ZIP_DIR'], name)
195 dir = os.path.dirname(dest)
201 # if the file exists, then delete it before writing
202 # to it so that we don't end up trying to write to a symlink:
203 if os.path.exists(dest):
205 open(dest, 'w').write(zf.read(name))
209 zipit = "cd build && $ZIP $ZIPFLAGS dist/${TARGET.file} $PSV"
210 unzipit = "$UNZIP $UNZIPFLAGS $SOURCES"
212 def SCons_revision(target, source, env):
213 """Interpolate specific values from the environment into a file.
215 This is used to copy files into a tree that gets packaged up
216 into the source file package.
220 # Note: We don't use $VERSION from the environment so that
221 # this routine will change when the version number changes
222 # and things will get rebuilt properly.
224 print "SCons_revision() < %s > %s" % (s, t)
227 for line in inf.readlines():
228 # Note: We construct the __*__ substitution strings here
229 # so that they don't get replaced when this file gets
230 # copied into the tree for packaging.
231 line = string.replace(line, '_' + '_DATE__', env['DATE'])
232 line = string.replace(line, '_' + '_DEVELOPER__', env['DEVELOPER'])
233 line = string.replace(line, '_' + '_FILE__', s)
234 line = string.replace(line, '_' + '_REVISION__', env['REVISION'])
235 line = string.replace(line, '_' + '_VERSION__', version)
239 os.chmod(t, os.stat(s)[0])
241 revbuilder = Builder(name = 'SCons_revision', action = SCons_revision)
247 DEVELOPER = developer,
250 DH_COMPAT = dh_compat,
252 TAR_HFLAG = tar_hflag,
257 UNZIPFLAGS = '-o -d $UNPACK_ZIP_DIR',
259 TEST_DEB_DIR = test_deb_dir,
260 TEST_RPM_DIR = test_rpm_dir,
261 TEST_SRC_TAR_GZ_DIR = test_src_tar_gz_dir,
262 TEST_SRC_ZIP_DIR = test_src_zip_dir,
263 TEST_TAR_GZ_DIR = test_tar_gz_dir,
264 TEST_ZIP_DIR = test_zip_dir,
266 UNPACK_TAR_GZ_DIR = unpack_tar_gz_dir,
267 UNPACK_ZIP_DIR = unpack_zip_dir,
269 BUILDERS = [ revbuilder ],
273 # Define SCons packages.
275 # In the original, more complicated packaging scheme, we were going
276 # to have separate packages for:
278 # python-scons only the build engine
279 # scons-script only the script
280 # scons the script plus the build engine
282 # We're now only delivering a single "scons" package, but this is still
283 # "built" as two sub-packages (the build engine and the script), so
284 # the definitions remain here, even though we're not using them for
289 'pkg' : 'python-' + project,
290 'src_subdir' : 'engine',
291 'inst_subdir' : os.path.join('lib', 'python1.5', 'site-packages'),
298 'debian/python-scons.postinst',
299 'debian/python-scons.prerm',
302 'files' : [ 'LICENSE.txt',
309 'LICENSE.txt' : '../LICENSE.txt'
314 # The original packaging scheme would have have required us to push
315 # the Python version number into the package name (python1.5-scons,
316 # python2.0-scons, etc.), which would have required a definition
317 # like the following. Leave this here in case we ever decide to do
318 # this in the future, but note that this would require some modification
319 # to src/engine/setup.py before it would really work.
322 # 'pkg' : 'python2-' + project,
323 # 'src_subdir' : 'engine',
324 # 'inst_subdir' : os.path.join('lib', 'python2.1', 'site-packages'),
329 # 'debian/changelog',
330 # 'debian/copyright',
331 # 'debian/python2-scons.postinst',
332 # 'debian/python2-scons.prerm',
342 # 'LICENSE.txt' : '../LICENSE.txt',
348 'pkg' : project + '-script',
349 'src_subdir' : 'script',
350 'inst_subdir' : 'bin',
357 'debian/python-scons.postinst',
358 'debian/python-scons.prerm',
369 'LICENSE.txt' : '../LICENSE.txt',
370 'scons' : 'scons.py',
382 'debian/scons.postinst',
383 'debian/scons.prerm',
391 'os_spawnv_fix.diff',
399 'scons.1' : '../doc/man/scons.1',
402 'subpkgs' : [ python_scons, scons_script ],
405 'python-' + project : python_project_subinst_dir,
406 project + '-script' : project_script_subinst_dir,
415 # Initialize variables with the right directories for this package.
418 pkg_version = "%s-%s" % (pkg, version)
421 if p.has_key('src_subdir'):
422 src = os.path.join(src, p['src_subdir'])
424 build = os.path.join('build', pkg)
426 tar_gz = os.path.join(build, 'dist', "%s.tar.gz" % pkg_version)
427 platform_tar_gz = os.path.join(build,
429 "%s.%s.tar.gz" % (pkg_version, platform))
430 zip = os.path.join(build, 'dist', "%s.zip" % pkg_version)
431 platform_zip = os.path.join(build,
433 "%s.%s.zip" % (pkg_version, platform))
434 win32_exe = os.path.join(build, 'dist', "%s.win32.exe" % pkg_version)
437 # Update the environment with the relevant information
440 # We can get away with calling setup.py using a directory path
441 # like this because we put a preamble in it that will chdir()
442 # to the directory in which setup.py exists.
444 env.Update(PKG = pkg,
445 PKG_VERSION = pkg_version,
446 SETUP_PY = os.path.join(build, 'setup.py'))
449 # Read up the list of source files from our MANIFEST.in.
450 # This list should *not* include LICENSE.txt, MANIFEST,
451 # README.txt, or setup.py. Make a copy of the list for the
454 src_files = map(lambda x: x[:-1],
455 open(os.path.join(src, 'MANIFEST.in')).readlines())
456 dst_files = src_files[:]
458 MANIFEST_in_list = []
460 if p.has_key('subpkgs'):
462 # This package includes some sub-packages. Read up their
463 # MANIFEST.in files, and add them to our source and destination
464 # file lists, modifying them as appropriate to add the
467 for sp in p['subpkgs']:
468 ssubdir = sp['src_subdir']
469 isubdir = p['subinst_dirs'][sp['pkg']]
470 MANIFEST_in = os.path.join(src, ssubdir, 'MANIFEST.in')
471 MANIFEST_in_list.append(MANIFEST_in)
472 f = map(lambda x: x[:-1], open(MANIFEST_in).readlines())
473 src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), f))
475 f = map(lambda x, i=isubdir: os.path.join(i, x), f)
477 for k in sp['filemap'].keys():
480 k = os.path.join(sp['src_subdir'], k)
481 p['filemap'][k] = os.path.join(sp['src_subdir'], f)
484 # Now that we have the "normal" source files, add those files
485 # that are standard for each distribution. Note that we don't
486 # add these to dst_files, because they don't get installed.
487 # And we still have the MANIFEST to add.
489 src_files.extend(p['files'])
492 # Now run everything in src_file through the sed command we
493 # concocted to expand __FILE__, __VERSION__, etc.
496 s = p['filemap'].get(b, b)
497 env.SCons_revision(os.path.join(build, b), os.path.join(src, s))
500 # NOW, finally, we can create the MANIFEST, which we do
501 # by having Python spit out the contents of the src_files
502 # array we've carefully created. After we've added
503 # MANIFEST itself to the array, of course.
505 src_files.append("MANIFEST")
506 MANIFEST_in_list.append(os.path.join(src, 'MANIFEST.in'))
508 def copy(target, source, **kw):
511 f = open(str(target[0]), 'wb')
512 for file in src_files:
516 env.Command(os.path.join(build, 'MANIFEST'), MANIFEST_in_list, copy)
519 # Now go through and arrange to create whatever packages we can.
521 build_src_files = map(lambda x, b=build: os.path.join(b, x), src_files)
523 distutils_formats = []
525 distutils_targets = [ win32_exe ]
527 install_targets = distutils_targets[:]
531 distutils_formats.append('gztar')
533 src_deps.append(tar_gz)
535 distutils_targets.extend([ tar_gz, platform_tar_gz ])
536 install_targets.extend([ tar_gz, platform_tar_gz ])
539 # Unpack the tar.gz archive created by the distutils into
540 # build/unpack-tar-gz/scons-{version}.
542 # We'd like to replace the last three lines with the following:
544 # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
546 # but that gives heartburn to Cygwin's tar, so work around it
547 # with separate zcat-tar-rm commands.
549 unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, pv=pkg_version:
550 os.path.join(u, pv, x),
552 env.Command(unpack_tar_gz_files, tar_gz, [
553 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version),
554 "zcat $SOURCES > .temp",
555 "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
560 # Run setup.py in the unpacked subdirectory to "install" everything
561 # into our build/test subdirectory. The runtest.py script will set
562 # PYTHONPATH so that the tests only look under build/test-{package},
563 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
564 # and unittest.py). This makes sure that our tests pass with what
565 # we really packaged, not because of something hanging around in
566 # the development directory.
568 # We can get away with calling setup.py using a directory path
569 # like this because we put a preamble in it that will chdir()
570 # to the directory in which setup.py exists.
572 dfiles = map(lambda x, d=test_tar_gz_dir: os.path.join(d, x), dst_files)
573 env.Command(dfiles, unpack_tar_gz_files, [
574 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, pkg_version, 'build'),
575 "rm -rf $TEST_TAR_GZ_DIR",
576 "python %s install --prefix=$TEST_TAR_GZ_DIR" % \
577 os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'),
582 distutils_formats.append('zip')
586 distutils_targets.extend([ zip, platform_zip ])
587 install_targets.extend([ zip, platform_zip ])
590 # Unpack the zip archive created by the distutils into
591 # build/unpack-zip/scons-{version}.
593 unpack_zip_files = map(lambda x, u=unpack_zip_dir, pv=pkg_version:
594 os.path.join(u, pv, x),
597 env.Command(unpack_zip_files, zip, unzipit)
600 # Run setup.py in the unpacked subdirectory to "install" everything
601 # into our build/test subdirectory. The runtest.py script will set
602 # PYTHONPATH so that the tests only look under build/test-{package},
603 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
604 # and unittest.py). This makes sure that our tests pass with what
605 # we really packaged, not because of something hanging around in
606 # the development directory.
608 # We can get away with calling setup.py using a directory path
609 # like this because we put a preamble in it that will chdir()
610 # to the directory in which setup.py exists.
612 dfiles = map(lambda x, d=test_zip_dir: os.path.join(d, x), dst_files)
613 env.Command(dfiles, unpack_zip_files, [
614 "rm -rf %s" % os.path.join(unpack_zip_dir, pkg_version, 'build'),
615 "rm -rf $TEST_ZIP_DIR",
616 "python %s install --prefix=$TEST_ZIP_DIR" % \
617 os.path.join(unpack_zip_dir, pkg_version, 'setup.py'),
621 topdir = os.path.join(os.getcwd(), build, 'build',
622 'bdist.' + platform, 'rpm')
624 BUILDdir = os.path.join(topdir, 'BUILD', pkg + '-' + version)
625 RPMSdir = os.path.join(topdir, 'RPMS', 'noarch')
626 SOURCESdir = os.path.join(topdir, 'SOURCES')
627 SPECSdir = os.path.join(topdir, 'SPECS')
628 SRPMSdir = os.path.join(topdir, 'SRPMS')
630 specfile = os.path.join(SPECSdir, "%s-1.spec" % pkg_version)
631 sourcefile = os.path.join(SOURCESdir, "%s.tar.gz" % pkg_version);
632 rpm = os.path.join(RPMSdir, "%s-1.noarch.rpm" % pkg_version)
633 src_rpm = os.path.join(SRPMSdir, "%s-1.src.rpm" % pkg_version)
635 env.InstallAs(specfile, os.path.join('rpm', "%s.spec" % pkg))
636 env.InstallAs(sourcefile, tar_gz)
638 targets = [ rpm, src_rpm ]
639 cmd = "rpm --define '_topdir $(%s$)' -ba $SOURCES" % topdir
640 if not os.path.isdir(BUILDdir):
641 cmd = ("$( mkdir -p %s; $)" % BUILDdir) + cmd
642 env.Command(targets, specfile, cmd)
643 env.Depends(targets, sourcefile)
645 install_targets.extend(targets)
647 dfiles = map(lambda x, d=test_rpm_dir: os.path.join(d, 'usr', x),
651 "rpm2cpio $SOURCES | (cd $TEST_RPM_DIR && cpio -id)")
653 if dh_builddeb and fakeroot:
654 # Our Debian packaging builds directly into build/dist,
655 # so we don't need to add the .debs to install_targets.
656 deb = os.path.join('build', 'dist', "%s_%s-1_all.deb" % (pkg, version))
657 env.Command(deb, build_src_files, [
658 "fakeroot make -f debian/rules VERSION=$VERSION DH_COMPAT=$DH_COMPAT ENVOKED_BY_CONSTRUCT=1 binary-$PKG",
659 "env DH_COMPAT=$DH_COMPAT dh_clean"
661 env.Depends(deb, p['debian_deps'])
663 dfiles = map(lambda x, d=test_deb_dir: os.path.join(d, 'usr', x),
667 "dpkg --fsys-tarfile $SOURCES | (cd $TEST_DEB_DIR && tar -xf -)")
670 # Use the Python distutils to generate the appropriate packages.
673 "rm -rf %s" % os.path.join(build, 'build', 'lib'),
674 "rm -rf %s" % os.path.join(build, 'build', 'scripts'),
677 if distutils_formats:
678 commands.append("rm -rf %s" % os.path.join(build,
682 for format in distutils_formats:
683 commands.append("python $SETUP_PY bdist_dumb -f %s" % format)
685 commands.append("python $SETUP_PY sdist --formats=%s" % \
686 string.join(distutils_formats, ','))
688 commands.append("python $SETUP_PY bdist_wininst")
690 env.Command(distutils_targets, build_src_files, commands)
693 # And, lastly, install the appropriate packages in the
694 # appropriate subdirectory.
696 env.Install(os.path.join('build', 'dist'), install_targets)
703 SConscript('etc/SConscript')
708 BuildDir('build/doc', 'doc')
710 Export('env', 'whereis')
712 SConscript('build/doc/SConscript')
715 # If we're running in the actual Aegis project, pack up a complete
716 # source archive from the project files and files in the change,
717 # so we can share it with helpful developers who don't use Aegis.
722 cmd = "aegis -list -unf -c %s cf 2>/dev/null" % change
723 for line in map(lambda x: x[:-1], os.popen(cmd, "r").readlines()):
724 a = string.split(line)
731 cmd = "aegis -list -terse pf 2>/dev/null"
732 pf = map(lambda x: x[:-1], os.popen(cmd, "r").readlines())
733 cmd = "aegis -list -terse cf 2>/dev/null"
734 cf = map(lambda x: x[:-1], os.popen(cmd, "r").readlines())
740 sfiles = filter(lambda x: x[-9:] != '.aeignore' and x[-9:] != '.sconsign',
744 ps = "%s-src" % project
745 psv = "%s-%s" % (ps, version)
746 b_ps = os.path.join('build', ps)
747 b_psv = os.path.join('build', psv)
748 b_psv_stamp = b_psv + '-stamp'
750 src_tar_gz = os.path.join('build', 'dist', '%s.tar.gz' % psv)
751 src_zip = os.path.join('build', 'dist', '%s.zip' % psv)
754 env.SCons_revision(os.path.join(b_ps, file), file)
756 b_ps_files = map(lambda x, d=b_ps: os.path.join(d, x), sfiles)
759 "cp -rp %s %s" % (b_ps, b_psv),
760 "find %s -name .sconsign -exec rm {} \\;" % b_psv,
764 env.Command(b_psv_stamp, src_deps + b_ps_files, cmds)
768 env.Command(src_tar_gz, b_psv_stamp,
769 "tar cz${TAR_HFLAG} -f $TARGET -C build %s" % psv)
772 # Unpack the archive into build/unpack/scons-{version}.
774 unpack_tar_gz_files = map(lambda x, u=unpack_tar_gz_dir, psv=psv:
775 os.path.join(u, psv, x),
779 # We'd like to replace the last three lines with the following:
781 # tar zxf $SOURCES -C $UNPACK_TAR_GZ_DIR
783 # but that gives heartburn to Cygwin's tar, so work around it
784 # with separate zcat-tar-rm commands.
785 env.Command(unpack_tar_gz_files, src_tar_gz, [
786 "rm -rf %s" % os.path.join(unpack_tar_gz_dir, psv),
787 "zcat $SOURCES > .temp",
788 "tar xf .temp -C $UNPACK_TAR_GZ_DIR",
793 # Run setup.py in the unpacked subdirectory to "install" everything
794 # into our build/test subdirectory. The runtest.py script will set
795 # PYTHONPATH so that the tests only look under build/test-{package},
796 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
797 # and unittest.py). This makes sure that our tests pass with what
798 # we really packaged, not because of something hanging around in
799 # the development directory.
801 # We can get away with calling setup.py using a directory path
802 # like this because we put a preamble in it that will chdir()
803 # to the directory in which setup.py exists.
805 dfiles = map(lambda x, d=test_src_tar_gz_dir: os.path.join(d, x),
807 ENV = env.Dictionary('ENV')
808 ENV['SCONS_LIB_DIR'] = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine')
809 ENV['USERNAME'] = developer
810 env.Copy(ENV = ENV).Command(dfiles, unpack_tar_gz_files, [
811 "rm -rf %s" % os.path.join(unpack_tar_gz_dir,
816 "rm -rf $TEST_SRC_TAR_GZ_DIR",
817 "cd %s && python %s %s" % \
818 (os.path.join(unpack_tar_gz_dir, psv),
819 os.path.join('src', 'script', 'scons.py'),
820 os.path.join('build', 'scons')),
821 "python %s install --prefix=$TEST_SRC_TAR_GZ_DIR" % \
822 os.path.join(unpack_tar_gz_dir,
831 env.Copy(PSV = psv).Command(src_zip, b_psv_stamp, zipit)
834 # Unpack the archive into build/unpack/scons-{version}.
836 unpack_zip_files = map(lambda x, u=unpack_zip_dir, psv=psv:
837 os.path.join(u, psv, x),
840 env.Command(unpack_zip_files, src_zip, unzipit)
843 # Run setup.py in the unpacked subdirectory to "install" everything
844 # into our build/test subdirectory. The runtest.py script will set
845 # PYTHONPATH so that the tests only look under build/test-{package},
846 # and under etc (for the testing modules TestCmd.py, TestSCons.py,
847 # and unittest.py). This makes sure that our tests pass with what
848 # we really packaged, not because of something hanging around in
849 # the development directory.
851 # We can get away with calling setup.py using a directory path
852 # like this because we put a preamble in it that will chdir()
853 # to the directory in which setup.py exists.
855 dfiles = map(lambda x, d=test_src_zip_dir: os.path.join(d, x),
857 ENV = env.Dictionary('ENV')
858 ENV['SCONS_LIB_DIR'] = os.path.join(unpack_zip_dir, psv, 'src', 'engine')
859 ENV['USERNAME'] = developer
860 env.Copy(ENV = ENV).Command(dfiles, unpack_zip_files, [
861 "rm -rf %s" % os.path.join(unpack_zip_dir,
866 "rm -rf $TEST_SRC_ZIP_DIR",
867 "cd %s && python %s %s" % \
868 (os.path.join(unpack_zip_dir, psv),
869 os.path.join('src', 'script', 'scons.py'),
870 os.path.join('build', 'scons')),
871 "python %s install --prefix=$TEST_SRC_ZIP_DIR" % \
872 os.path.join(unpack_zip_dir,