Package a standalone scons-local package.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 4 Dec 2002 14:07:45 +0000 (14:07 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 4 Dec 2002 14:07:45 +0000 (14:07 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@513 fdb21ef1-2011-0410-befe-b5e4ea1792b1

HOWTO/release.txt
LICENSE-local [new file with mode: 0644]
README
README-local [new file with mode: 0644]
SConstruct
runtest.py
src/CHANGES.txt
src/script/scons.py

index 4f3a691d9657309465c4933dcfb7c94cb7e09bef..6ae42267eb5952799b2bfee2f22fd19c5f71c6c7 100644 (file)
@@ -20,6 +20,13 @@ Things to do to release a new version of SCons:
                           cd scons-src-{version}
                           python runtest.py -a -X -x C:\Python20\scons.bat
 
+                       4) mkdir temporary_directory
+                          cd temporary_directory
+                          tar zxf scons-local-{version}.tar.gz
+                          cd scons-src-{version}
+                          ptyhon runtest.py -a -x C:\temporary_directory\scons.py
+
+
        Read through the README and src/README.txt files for any updates
 
        Prepare src/CHANGES.txt
@@ -49,11 +56,11 @@ Things to do to release a new version of SCons:
 
                ae_p scons.0
 
-               aede {7}
+               aede {9}
 
-               aerpass {7}
+               aerpass {9}
 
-               aeib {7}
+               aeib {9}
 
                aeb
 
@@ -67,15 +74,15 @@ Things to do to release a new version of SCons:
 
        START THE NEW BRANCH
 
-               aenbr -p scons.0 {8}
+               aenbr -p scons.0 {10}
 
-               aenc -p scons.0.{8}
+               aenc -p scons.0.{10}
 
                         Call it something like, "Initialize the new
                         branch."  Cause = internal_enhancement.  Exempt
                         it from all tests (*_exempt = true).
 
-               ae_p scons.0.{8}
+               ae_p scons.0.{10}
 
                aedb 100
 
@@ -117,14 +124,16 @@ Things to do to release a new version of SCons:
                <your email>
                cd incoming
                bin
-               put scons-0.08-1.noarch.rpm
-               put scons-0.08-1.src.rpm
-               put scons-0.08.tar.gz
-               put scons-0.08.win32.exe
-               put scons-0.08.zip
-               put scons-src-0.08.tar.gz
-               put scons-src-0.08.zip
-               put scons_0.08-1_all.deb
+               put scons-0.09-1.noarch.rpm
+               put scons-0.09-1.src.rpm
+               put scons-0.09.tar.gz
+               put scons-0.09.win32.exe
+               put scons-0.09.zip
+               put scons-local-0.09.tar.gz
+               put scons-local-0.09.zip
+               put scons-src-0.09.tar.gz
+               put scons-src-0.09.zip
+               put scons_0.09-1_all.deb
 
        Create the new release at the SourceForge project page:
 
@@ -136,7 +145,7 @@ Things to do to release a new version of SCons:
 
                => Add Release
 
-               New release name:  0.08
+               New release name:  0.09
 
                Cut-and-paste or upload the RELEASE.txt file.
 
@@ -153,12 +162,12 @@ Things to do to release a new version of SCons:
 
                Edit the file info:
 
-                       scons-0.08-1.noarch.rpm         Any     .rpm
-                       scons-0.08-1.src.rpm            Any     Source .rpm
-                       scons-0.08.tar.gz               Any     .gz
-                       scons-0.08.win32.exe            i386    .exe (32-bit Windows)
-                       scons-0.08.zip                  Any     .zip
-                       scons_0.08-1_all.deb            Any     .deb
+                       scons-0.09-1.noarch.rpm         Any     .rpm
+                       scons-0.09-1.src.rpm            Any     Source .rpm
+                       scons-0.09.tar.gz               Any     .gz
+                       scons-0.09.win32.exe            i386    .exe (32-bit Windows)
+                       scons-0.09.zip                  Any     .zip
+                       scons_0.09-1_all.deb            Any     .deb
 
                 Click "Update/Refresh" for each file; this must be done
                 one at a time.
@@ -175,7 +184,7 @@ Things to do to release a new version of SCons:
 
                => Add Release
 
-               New release name:  0.08
+               New release name:  0.09
 
                Cut-and-paste or upload the RELEASE.txt file.
 
@@ -192,8 +201,8 @@ Things to do to release a new version of SCons:
 
                Edit the file info:
 
-                       scons-src-0.08.tar.gz           Any     .gz
-                       scons-src-0.08.zip              Any     .zip
+                       scons-src-0.09.tar.gz           Any     .gz
+                       scons-src-0.09.zip              Any     .zip
 
                 Click "Update/Refresh" for each file; this must be done
                 one at a time.
@@ -202,7 +211,42 @@ Things to do to release a new version of SCons:
                Release Notice section.
 
 
-       Hide release {0.06} 2 at the SourceForge download page:
+               Go to the Admin page
+
+               => Edit/Add File Releases
+
+               Package Name:  scons-local
+
+               => Add Release
+
+               New release name:  0.09
+
+               Cut-and-paste or upload the RELEASE.txt file.
+
+               Cut-and-paste or upload the CHANGES.txt file.
+
+               (If you cut-and-paste, check the "Preserve my
+               pre-formatted text." box!)
+
+               Click "Submit/Refresh"  (IMPORTANT!)
+
+               Check the SCons files you uploaded
+
+               Click "Add Files and/or Refresh View"
+
+               Edit the file info:
+
+                       scons-local-0.09.tar.gz         Any     .gz
+                       scons-local-0.09.zip            Any     .zip
+
+                Click "Update/Refresh" for each file; this must be done
+                one at a time.
+
+               Check "I'm sure." and click "Send Notice" in the Email
+               Release Notice section.
+
+
+       Hide release {0.07} 2 at the SourceForge download page:
 
                Go to the Admin page
 
@@ -212,7 +256,7 @@ Things to do to release a new version of SCons:
 
                => Edit Releases
 
-               Release Name: {0.06}
+               Release Name: {0.07}
 
                => Edit This Release
 
@@ -229,7 +273,24 @@ Things to do to release a new version of SCons:
 
                => Edit Releases
 
-               Release Name: {0.06}
+               Release Name: {0.07}
+
+               => Edit This Release
+
+               Status: => Hidden
+
+               Click Submit/Refresh
+
+
+               Go to the Admin page
+
+               => Edit/Add File Releases
+
+               Package Name:  scons-local
+
+               => Edit Releases
+
+               Release Name: {0.07}
 
                => Edit This Release
 
@@ -239,7 +300,7 @@ Things to do to release a new version of SCons:
 
 
 
-       In the Bugs Tracker, add a Group for the new release (0.08)
+       In the Bugs Tracker, add a Group for the new release (0.10)
 
 
 
@@ -314,7 +375,7 @@ Things to do to release a new version of SCons:
 =======================
 Template describe-the-release section:
 
-IMPORTANT:  Release 0.08 contains the following interface changes:
+IMPORTANT:  Release 0.09 contains the following interface changes:
   - XXX
 
 This release adds the following features:
@@ -336,7 +397,7 @@ Template scons-devel announcement:
 
 SConspirators--
 
-SCons alpha release 0.08 is now available for download.
+SCons alpha release 0.09 is now available for download.
 
 XXX Template describe-the-release section goes here XXX
 
@@ -347,7 +408,7 @@ release.
 =======================
 Template scons-users + scons-announce announcement:
 
-Version 0.08 of SCons has been released and is available for download
+Version 0.09 of SCons has been released and is available for download
 from the SCons web site:
 
        http://www.scons.org/
@@ -380,7 +441,7 @@ SCons is a software construction tool (build tool, or make tool) written
 in Python.  It is based on the design which won the Software Carpentry
 build tool competition in August 2000.
 
-Version 0.08 of SCons has been released and is available for download
+Version 0.09 of SCons has been released and is available for download
 from the SCons web site:
 
        http://www.scons.org/
diff --git a/LICENSE-local b/LICENSE-local
new file mode 100644 (file)
index 0000000..1577421
--- /dev/null
@@ -0,0 +1,25 @@
+        Copyright and license for SCons - a software construction tool
+
+        This copyright and license do not apply to any other software
+        with which this software may have been included.
+
+Copyright (c) 2001, 2002 Steven Knight
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README b/README
index d2cb6f4345e1b96116b981f8ad151134f2e646b6..aa2096995378651c9037b926e11b8fbdf608d122 100644 (file)
--- a/README
+++ b/README
@@ -60,12 +60,12 @@ In this case, your options are:
     --  (Optional.)  Install from a pre-packaged SCons package that
         does not require distutils:
 
-            Red Hat Linux       scons-0.08-1.noarch.rpm
+            Red Hat Linux       scons-0.09-1.noarch.rpm
 
-            Debian GNU/Linux    scons_0.08-1_all.deb
+            Debian GNU/Linux    scons_0.09-1_all.deb
                                 (or use apt-get)
 
-            Windows             scons-0.08.win32.exe
+            Windows             scons-0.09.win32.exe
 
     --  (Recommended.)  Download the latest distutils package from the
         following URL:
@@ -178,16 +178,18 @@ more typing:
 Depending on the utilities installed on your system, any or all of the
 following packages will be built:
 
-        build/dist/scons-0.08-1.noarch.rpm
-        build/dist/scons-0.08-1.src.rpm
-        build/dist/scons-0.08.linux-i686.tar.gz
-        build/dist/scons-0.08.tar.gz
-        build/dist/scons-0.08.win32.exe
-        build/dist/scons-0.08.zip
-        build/dist/scons-doc-0.08.tar.gz
-        build/dist/scons-src-0.08.tar.gz
-        build/dist/scons-src-0.08.zip
-        build/dist/scons_0.08-1_all.deb
+        build/dist/scons-0.09-1.noarch.rpm
+        build/dist/scons-0.09-1.src.rpm
+        build/dist/scons-0.09.linux-i686.tar.gz
+        build/dist/scons-0.09.tar.gz
+        build/dist/scons-0.09.win32.exe
+        build/dist/scons-0.09.zip
+        build/dist/scons-doc-0.09.tar.gz
+        build/dist/scons-local-0.09.tar.gz
+        build/dist/scons-local-0.09.zip
+        build/dist/scons-src-0.09.tar.gz
+        build/dist/scons-src-0.09.zip
+        build/dist/scons_0.09-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.
@@ -204,17 +206,22 @@ will also unpack one or more of the packages for testing.
 TESTING PACKAGES
 ================
 
-A full build will unpack and/or install any .deb, .rpm., .src.tar.gz,
-.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:
+A full build will unpack and/or install any .deb, .rpm., .local.tar.gz,
+.local.zip, .src.tar.gz, .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 deb
 
         $ python runtest.py -p rpm
 
+        $ python runtest.py -p local-tar-gz
+
+        $ python runtest.py -p local-zip
+
         $ python runtest.py -p src-tar-gz
 
         $ python runtest.py -p src-zip
diff --git a/README-local b/README-local
new file mode 100644 (file)
index 0000000..b3b13c0
--- /dev/null
@@ -0,0 +1,204 @@
+# Copyright (c) 2001, 2002 Steven Knight
+
+                 SCons - a software construction tool
+
+This is the scons-README file for a version of SCons packaged for local
+execution--that is, execution out of a specific local directory, without
+having to install SCons as a system-wide utility.
+
+You are likely reading this file in one of the following two situations:
+
+    1)  You have unpacked an scons-local-{version} package and are
+        examining the contents.
+
+        In this case, you are presumably interested in using this
+        package to include a local copy of SCons with some other
+        software that you package, so that you can use SCons to build
+        your software without forcing all of your users to have it fully
+        installed.  Instructions for this can be found below.
+
+        If you are not looking to use SCons in this way, then please
+        use either the scons-{version} package to install SCons on your
+        system, or the scons-src-{version} package if you want the full
+        source to SCons, including its packaging code and underlying
+        tests and testing infrastructure.
+
+    2)  This file was included in some other software package so that
+        the package could be built using SCons.
+
+        In this case, follow the instructions provided with the
+        rest of the software package for how to use SCons to build
+        and/or install the software.  The file containing build and
+        installation instructions will typically be named README or
+        INSTALL.
+
+LATEST VERSION
+==============
+
+Before going further, you can check for the latest version of the
+scons-local package, or any SCons package, at the SCons download page:
+
+        http://www.scons.org/download.html
+
+
+EXECUTION REQUIREMENTS
+======================
+
+Running SCons requires Python version 1.5.2 or later.  There should be
+no other dependencies or requirements to run SCons.
+
+The default SCons configuration assumes use of the Microsoft Visual C++
+compiler suite on WIN32 systems, and assumes a C compiler named 'cc',
+a C++ compiler named 'c++', and a Fortran compiler named 'g77' (such
+as found in the GNU C compiler suite) on any other type of system.
+You may, of course, override these default values by appropriate
+configuration of Environment construction variables.
+
+
+INSTALLATION
+============
+
+Installation of this package should be as simple as unpacking the
+archive (either .tar.gz or .zip) in any directory (top-level or a
+subdirectory) within the software package with which you want to ship
+SCons.
+
+Once you have installed this package, you should write an SConstruct
+file at the top level of your source tree to build your software as you
+see fit.
+
+Then modify the build/install instructions for your package to instruct
+your users to execute SCons as follows (if you installed this package in
+your top-level directory):
+
+        $ python scons.py
+
+Or (if, for example, you installed this package in a subdirectory named
+"scons"):
+
+        $ python scons/scons.py
+
+That should be all you have to do.  (If it isn't that simple, please let
+us know!)
+
+
+CONTENTS OF THIS PACKAGE
+========================
+
+This scons-local package consists of the following:
+
+scons-LICENSE
+        A copy of the copyright and terms under which SCons is
+        distributed (the Open Source Initiative-approved MIT license).
+
+        A disclaimer has been added to the beginning to make clear that
+        this license applies only to SCons, and not to any separate
+        software you've written with which you're planning to package
+        SCons.
+
+scons-README
+        What you're looking at right now.
+
+scons-local-{version}/
+        The SCons build engine.  This is structured as a Python
+        library.
+
+scons.py
+        The SCons script itself.  The script sets up the Python
+        sys.path variable to use the build engine found in the
+        scons-local-{version}/ directory in preference to any other
+        SCons build engine installed on your system.
+
+
+DOCUMENTATION
+=============
+
+Because this package is intended to be included with other software by
+experienced users, we have not included any SCons documentation in this
+package (other than this scons-README file you're reading right now).
+
+If, however, you need documentation about SCons, then consult any of the
+following from the corresponding scons-{version} or scons-src-{version}
+package:
+
+        The RELEASE.txt file (src/RELEASE.txt file in the
+        scons-src-{version} package), which contains notes about this
+        specific release, including known problems.
+
+        The CHANGES.txt file (src/CHANGES.txt file in the
+        scons-src-{version} package), which contains a list of changes
+        since the previous release.
+
+        The scons.1 man page (doc/man/scons.1 in the scons-src-{version}
+        package), which contains a section of small examples for getting
+        started using SCons.
+
+Additional documentation for SCons is available at:
+
+        http://www.scons.org/doc.html
+
+
+LICENSING
+=========
+
+SCons is distributed under the MIT license, a full copy of which is
+available in the scons-LICENSE file in this package. The MIT license is
+an approved Open Source license, which means:
+
+        This software is OSI Certified Open Source Software.  OSI
+        Certified is a certification mark of the Open Source Initiative.
+
+More information about OSI certifications and Open Source software is
+available at:
+
+        http://www.opensource.org/
+
+
+REPORTING BUGS
+==============
+
+You can report bugs either by following the "Tracker - Bugs" link
+on the SCons project page:
+
+        http://sourceforge.net/projects/scons/
+
+or by sending mail to the SCons developers mailing list:
+
+        scons-devel@lists.sourceforge.net
+
+
+MAILING LISTS
+=============
+
+A mailing list for users of SCons is available.  You may send questions
+or comments to the list at:
+
+        scons-users@lists.sourceforge.net
+
+You may subscribe to the scons-users mailing list at:
+
+        http://lists.sourceforge.net/lists/listinfo/scons-users
+
+
+FOR MORE INFORMATION
+====================
+
+Check the SCons web site at:
+
+        http://www.scons.org/
+
+
+AUTHOR INFO
+===========
+
+Steven Knight
+knight at baldmt dot com
+http://www.baldmt.com/~knight/
+
+With plenty of help from the SCons Development team:
+        Chad Austin
+        Charles Crain
+        Steve Leblanc
+        Anthony Roach
+        Terrel Shumway
+
index a88d19db47c6b1b70a42e800cde0fa60f95d4fff..47aa8e287dd5be1a86f63a3d49fb83922b205ae4 100644 (file)
@@ -147,15 +147,17 @@ 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")
-test_rpm_dir        = os.path.join(cwd_build, "test-rpm")
-test_tar_gz_dir     = os.path.join(cwd_build, "test-tar-gz")
-test_src_tar_gz_dir = os.path.join(cwd_build, "test-src-tar-gz")
-test_zip_dir        = os.path.join(cwd_build, "test-zip")
-test_src_zip_dir    = os.path.join(cwd_build, "test-src-zip")
-
-unpack_tar_gz_dir   = os.path.join(cwd_build, "unpack-tar-gz")
-unpack_zip_dir      = os.path.join(cwd_build, "unpack-zip")
+test_deb_dir          = os.path.join(cwd_build, "test-deb")
+test_rpm_dir          = os.path.join(cwd_build, "test-rpm")
+test_tar_gz_dir       = os.path.join(cwd_build, "test-tar-gz")
+test_src_tar_gz_dir   = os.path.join(cwd_build, "test-src-tar-gz")
+test_local_tar_gz_dir = os.path.join(cwd_build, "test-local-tar-gz")
+test_zip_dir          = os.path.join(cwd_build, "test-zip")
+test_src_zip_dir      = os.path.join(cwd_build, "test-src-zip")
+test_local_zip_dir    = os.path.join(cwd_build, "test-local-zip")
+
+unpack_tar_gz_dir     = os.path.join(cwd_build, "unpack-tar-gz")
+unpack_zip_dir        = os.path.join(cwd_build, "unpack-zip")
 
 if platform == "win32":
     tar_hflag = ''
@@ -185,7 +187,7 @@ try:
                 if os.path.isfile(path):
                     arg.write(path)
         zf = zipfile.ZipFile(str(target[0]), 'w')
-        os.chdir('build')
+        os.chdir(env['CD'])
         os.path.walk(env['PSV'], visit, zf)
         os.chdir('..')
         zf.close()
@@ -210,7 +212,7 @@ try:
 
 except:
     if unzip and zip:
-        zipit = "cd build && $ZIP $ZIPFLAGS dist/${TARGET.file} $PSV"
+        zipit = "cd $CD && $ZIP $ZIPFLAGS $( ${TARGET.abspath} $) $PSV"
         unzipit = "$UNZIP $UNZIPFLAGS $SOURCES"
 
 def SCons_revision(target, source, env):
@@ -479,6 +481,7 @@ for p in [ scons ]:
     manifest_in = File(os.path.join(src, 'MANIFEST.in')).rstr()
     src_files = map(lambda x: x[:-1],
                     open(manifest_in).readlines())
+    raw_files = src_files[:]
     dst_files = src_files[:]
 
     MANIFEST_in_list = []
@@ -496,6 +499,7 @@ for p in [ scons ]:
             MANIFEST_in = File(os.path.join(src, ssubdir, 'MANIFEST.in')).rstr()
             MANIFEST_in_list.append(MANIFEST_in)
             f = map(lambda x: x[:-1], open(MANIFEST_in).readlines())
+            raw_files.extend(f)
             src_files.extend(map(lambda x, s=ssubdir: os.path.join(s, x), f))
             if isubdir:
                 f = map(lambda x, i=isubdir: os.path.join(i, x), f)
@@ -531,7 +535,7 @@ for p in [ scons ]:
     src_files.append("MANIFEST")
     MANIFEST_in_list.append(os.path.join(src, 'MANIFEST.in'))
 
-    def copy(target, source, **kw):
+    def write_src_files(target, source, **kw):
         global src_files
        src_files.sort()
         f = open(str(target[0]), 'wb')
@@ -539,7 +543,9 @@ for p in [ scons ]:
             f.write(file + "\n")
         f.close()
         return 0
-    env.Command(os.path.join(build, 'MANIFEST'), MANIFEST_in_list, copy)
+    env.Command(os.path.join(build, 'MANIFEST'),
+                MANIFEST_in_list,
+                write_src_files)
 
     #
     # Now go through and arrange to create whatever packages we can.
@@ -724,6 +730,70 @@ for p in [ scons ]:
 
     env.Command(distutils_targets, build_src_files, commands)
 
+    #
+    # Now create local packages for people who want to let people
+    # build their SCons-buildable packages without having to
+    # install SCons.
+    #
+    s_l_v = '%s-local-%s' % (pkg, version)
+
+    local = os.path.join('build', pkg + '-local')
+    cwd_local = os.path.join(os.getcwd(), local)
+    cwd_local_slv = os.path.join(os.getcwd(), local, s_l_v)
+
+    local_tar_gz = os.path.join('build', 'dist', "%s.tar.gz" % s_l_v)
+    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" % \
+                                                (cwd_local, cwd_local_slv),
+        "mv %s/scons %s/scons.py" % (local, local),
+    ]
+
+    rf = filter(lambda x: x != "scons", raw_files)
+    rf = map(lambda x, slv=s_l_v: os.path.join(slv, x), rf)
+    rf.append("scons.py")
+    local_targets = map(lambda x, s=local: os.path.join(s, x), rf)
+
+    env.Command(local_targets, build_src_files, commands)
+
+    scons_LICENSE = os.path.join(local, 'scons-LICENSE')
+    env.SCons_revision(scons_LICENSE, 'LICENSE-local')
+    local_targets.append(scons_LICENSE)
+
+    scons_README = os.path.join(local, 'scons-README')
+    env.SCons_revision(scons_README, 'README-local')
+    local_targets.append(scons_README)
+
+    if gzip:
+        env.Command(local_tar_gz,
+                    local_targets,
+                    "cd %s && tar czf $( ${TARGET.abspath} $) *" % local)
+
+        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,
+                    "cd %s && tar xzf $( ${SOURCE.abspath} $)" % test_local_tar_gz_dir]
+
+        env.Command(unpack_targets, local_tar_gz, commands)
+
+    if zipit:
+        zipenv = env.Copy(CD = local, PSV = '.')
+        zipenv.Command(local_zip, local_targets, zipit)
+
+        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,
+                    unzipit]
+
+        zipenv = env.Copy(UNPACK_ZIP_DIR = test_local_zip_dir)
+        zipenv.Command(unpack_targets, local_zip, unzipit)
+
     #
     # And, lastly, install the appropriate packages in the
     # appropriate subdirectory.
@@ -865,7 +935,8 @@ if change:
 
         if zipit:
 
-            env.Copy(PSV = psv).Command(src_zip, b_psv_stamp, zipit)
+            zipenv = env.Copy(CD = 'build', PSV = psv)
+            zipenv.Command(src_zip, b_psv_stamp, zipit)
     
             #
             # Unpack the archive into build/unpack/scons-{version}.
index 6120aa508b7d8839624ab76dd2c236ec7b53a4ef..b5ffbea744544cddd0ba2eda64987fec18e059b2 100644 (file)
@@ -90,12 +90,14 @@ Options:
   -o FILE, --output FILE      Print test results to FILE (Aegis format).
   -p PACKAGE, --package PACKAGE
                               Test against the specified PACKAGE:
-                                deb         Debian
-                                rpm         Red Hat
-                                src-tar-gz  .tar.gz source package
-                                src-zip     .zip source package
-                                tar-gz      .tar.gz distribution
-                                zip         .zip distribution
+                                deb           Debian
+                                local-tar-gz  .tar.gz standalone package
+                                local-zip     .zip standalone package
+                                rpm           Red Hat
+                                src-tar-gz    .tar.gz source package
+                                src-zip       .zip source package
+                                tar-gz        .tar.gz distribution
+                                zip           .zip distribution
   -q, --quiet                 Don't print the test being executed.
   -X                          Test script is executable, don't feed to Python.
   -x SCRIPT, --exec SCRIPT    Test SCRIPT.
@@ -214,12 +216,14 @@ elif all:
 if package:
 
     dir = {
-        'deb'        : 'usr',
-        'rpm'        : 'usr',
-        'src-tar-gz' : '',
-        'src-zip'    : '',
-        'tar-gz'     : '',
-        'zip'        : '',
+        'deb'          : 'usr',
+        'local-tar-gz' : None,
+        'local-zip'    : None,
+        'rpm'          : 'usr',
+        'src-tar-gz'   : '',
+        'src-zip'      : '',
+        'tar-gz'       : '',
+        'zip'          : '',
     }
 
     # The hard-coded "python2.1" here is the library directory
@@ -234,13 +238,23 @@ if package:
 
     test_dir = os.path.join(cwd, 'build', 'test-%s' % package)
 
-    if sys.platform == 'win32':
-        scons_dir = os.path.join(test_dir, dir[package], 'Scripts')
-        lib_dir = os.path.join(test_dir, dir[package])
+    if dir[package] is None:
+        scons_script_dir = test_dir
+        globs = glob.glob(os.path.join(test_dir, 'scons-local-*'))
+        if not globs:
+            sys.stderr.write("No `scons-local-*' dir in `%s'\n" % test_dir)
+            sys.exit(2)
+        scons_lib_dir = None
+        pythonpath_dir = globs[len(globs)-1]
+    elif sys.platform == 'win32':
+        scons_script_dir = os.path.join(test_dir, dir[package], 'Scripts')
+        scons_lib_dir = os.path.join(test_dir, dir[package])
+        pythonpath_dir = scons_lib_dir
     else:
-        scons_dir = os.path.join(test_dir, dir[package], 'bin')
+        scons_script_dir = os.path.join(test_dir, dir[package], 'bin')
         l = lib.get(package, 'scons')
-        lib_dir = os.path.join(test_dir, dir[package], 'lib', l)
+        scons_lib_dir = os.path.join(test_dir, dir[package], 'lib', l)
+        pythonpath_dir = scons_lib_dir
 
 else:
     sd = None
@@ -261,30 +275,30 @@ else:
     #    spe = map(lambda x: os.path.join(x, 'src', 'engine'), spe)
     #    ld = string.join(spe, os.pathsep)
 
-    scons_dir = sd or os.path.join(cwd, 'src', 'script')
+    scons_script_dir = sd or os.path.join(cwd, 'src', 'script')
 
-    lib_dir = ld or os.path.join(cwd, 'src', 'engine')
+    scons_lib_dir = ld or os.path.join(cwd, 'src', 'engine')
 
 if scons:
     # Let the version of SCons that the -x option pointed to find
     # its own modules.
     os.environ['SCONS'] = scons
-else:
+elif scons_lib_dir:
     # Because SCons is really aggressive about finding its modules,
     # it sometimes finds SCons modules elsewhere on the system.
     # This forces SCons to use the modules that are being tested.
-    os.environ['SCONS_LIB_DIR'] = lib_dir
+    os.environ['SCONS_LIB_DIR'] = scons_lib_dir
 
 if scons_exec:
     os.environ['SCONS_EXEC'] = '1'
 
-os.environ['PYTHONPATH'] = lib_dir + \
+os.environ['PYTHONPATH'] = pythonpath_dir + \
                            os.pathsep + \
                            os.path.join(cwd, 'build', 'etc') + \
                            os.pathsep + \
                            os.path.join(cwd, 'etc')
 
-os.chdir(scons_dir)
+os.chdir(scons_script_dir)
 
 class Unbuffered:
     def __init__(self, file):
index a2c6d36c06f79cd12d033876606c3acef3e69a2f..c3b9d869d269226ba36bfe97ab7ba35f00f8bf58 100644 (file)
@@ -66,6 +66,10 @@ RELEASE 0.09 -
     and before trying to build a file that doesn't have all its source
     files (including when an invalid drive letter is used on WIN32).
 
+  - Add an scons-local-{version} package (in both .tar.gz and .zip
+    flavors) to help people who want to ship SCons as a stand-alone
+    build tool in their software packages.
+
  From Steven Knight and Anthony Roach:
 
   - Man page:  document the fact that Builder calls return Node objects.
index b42ed424c0ffbaf8374e7e492f20ca325e381338..c66008f378e252f196cdba07e182f2e64ac31bb5 100644 (file)
@@ -47,15 +47,21 @@ import os
 # followed by generic) so we pick up the right version of the build
 # engine modules if they're in either directory.
 
-selfdir = os.path.abspath(sys.argv[0])
-if selfdir in sys.path:
-    sys.path.remove(selfdir)
+script_dir = sys.path[0]
+
+if script_dir in sys.path:
+    sys.path.remove(script_dir)
 
 libs = []
 
 if os.environ.has_key("SCONS_LIB_DIR"):
     libs.append(os.environ["SCONS_LIB_DIR"])
 
+local = 'scons-local-' + __version__
+if script_dir:
+    local = os.path.join(script_dir, local)
+libs.append(local)
+
 if sys.platform == 'win32':
     libs.extend([ os.path.join(sys.prefix, 'SCons-%s' % __version__),
                   os.path.join(sys.prefix, 'SCons') ])
@@ -66,8 +72,6 @@ else:
     _usr = os.path.join('', 'usr')
     _usr_local = os.path.join('', 'usr', 'local')
 
-    script_dir = sys.path[0]
-
     if script_dir == 'bin':
         prefs.append(os.getcwd())
     else:
@@ -89,7 +93,7 @@ else:
     libs.extend(map(lambda x: os.path.join(x, 'lib', 'scons-%s' % __version__), prefs))
     libs.extend(map(lambda x: os.path.join(x, 'lib', 'scons'), prefs))
 
-sys.path = libs + sys.path[1:]
+sys.path = libs + sys.path
 
 import SCons.Script
 SCons.Script.main()