Change packaging to the new /usr/lib/scons/ scheme
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 28 Nov 2001 03:30:53 +0000 (03:30 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 28 Nov 2001 03:30:53 +0000 (03:30 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@125 fdb21ef1-2011-0410-befe-b5e4ea1792b1

12 files changed:
Construct
debian/rules
runtest.py
src/README.txt
src/engine/README.txt
src/engine/SCons/Script.py
src/script/README.txt
src/script/scons.bat [new file with mode: 0644]
src/script/scons.py
src/setup.cfg
src/setup.py
test/option-v.py

index 2a1c435595cc2c815662299b5b3e0bf03702a4e0..9114a761ae763fdcd10bc6ece7e6657c5cf3e343 100644 (file)
--- a/Construct
+++ b/Construct
@@ -112,17 +112,23 @@ use Cwd;
 $test1_dir = File::Spec->catfile(cwd, "build", "test1");
 $test2_dir = File::Spec->catfile(cwd, "build", "test2");
 
-$test1_lib_dir = File::Spec->catfile($test1_dir,
-                                     "lib",
-                                     "$project-$version");
+$lib_project = File::Spec->catfile("lib", "$project");
+
+# Originally, we were going to package the build engine in a
+# private SCons library that contained the version number, so
+# we could easily have multiple side-by-side versions of SCons
+# installed.  Keep this around in case we ever want to go back
+# to that scheme.  Note that this also requires changes to
+# runtest.py and src/setup.py.
+#$lib_project = File::Spec->catfile("lib", "$project-$version");
+
+$test1_lib_dir = File::Spec->catfile($test1_dir, $lib_project);
 
 $test2_lib_dir = File::Spec->catfile($test2_dir,
                                      "lib",
                                      "python${python_ver}",
                                      "site-packages");
 
-$lib_project_ver = File::Spec->catfile("lib", "$project-$version");
-
 $unpack_dir = File::Spec->catfile(cwd, "build", "unpack");
 
 $env = new cons( ENV => {
@@ -149,7 +155,21 @@ $env = new cons( ENV => {
                 SEDCOM         => "%SED %SEDFLAGS %< > %>",
                );
 
-my @src_deps;
+#
+# Define SCons packages.
+#
+# In the original, more complicated packaging scheme, we were going
+# to have separate packages for:
+#
+#      python-scons    only the build engine
+#      scons-script    only the script
+#      scons           the script plus the build engine
+#
+# We're now only delivering a single "scons" package, but this is still
+# "built" as two sub-packages (the build engine and the script), so
+# the definitions remain here, even though we're not using them for
+# separate packages.
+#
 
 $python_scons = {
         'pkg'          => "python-$project",
@@ -170,8 +190,14 @@ $python_scons = {
         }
 };
 
-# Supporting this is going to take some magic in src/engine/setup.py,
-# so comment it out for now.
+#
+# The original packaging scheme would have have required us to push
+# the Python version number into the package name (python1.5-scons,
+# python2.0-scons, etc.), which would have required a definition
+# like the following.  Leave this here in case we ever decide to do
+# this in the future, but note that this would require some modification
+# to src/engine/setup.py before it would really work.
+#
 #$python2_scons = {
 #        'pkg'         => "python2-$project",
 #        'src_subdir'  => 'engine',
@@ -219,15 +245,18 @@ $scons = {
                                 debian/scons.postinst
                                 debian/scons.prerm) ],
 
-        'files'                => [ qw(LICENSE.txt README.txt setup.cfg setup.py) ],
+        'files'                => [ qw(LICENSE.txt README.txt script/scons.bat
+                                setup.cfg setup.py) ],
 
         'subpkgs'      => [ $python_scons, $scons_script ],
-        'subinst_dirs' => { "python-$project" => $lib_project_ver,
+        'subinst_dirs' => { "python-$project" => $lib_project,
                              "$project-script" => 'bin',
                            },
 };
 
-for $p ($scons, $python_scons, $scons_script) {
+my @src_deps;
+
+for $p ($scons) {
     #
     # Initialize variables with the right directories for this package.
     #
@@ -352,7 +381,7 @@ for $p ($scons, $python_scons, $scons_script) {
         push(@build_targets, $deb);
         $env->Depends($deb, @{$p->{'debian_deps'}});
         $commands .= qq(
-                fakeroot make -f debian/rules DH_COMPAT=$DH_COMPAT ENVOKED_BY_CONSTRUCT=1 binary-$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);
     }
 
index 4ff4659078bdf74f52637fe05f3dcb984f1876ac..e410c4c9dddddff72a4aa3007294fd7cbc316d67 100644 (file)
@@ -51,7 +51,9 @@ install-common-stamp:
 install-scons: build install-common
        python build/scons/setup.py install \
 --install-scripts=`pwd`/debian/scons/usr/bin \
---install-purelib=`pwd`/debian/scons/usr/lib/scons-0.01 --no-compile
+--install-purelib=`pwd`/debian/scons/usr/lib/scons --no-compile
+# Here's how we'd install the build engine in a version-specific directory.
+#--install-purelib=`pwd`/debian/scons/usr/lib/scons-$VERSION --no-compile
 
 install-python-scons: build install-common
        python build/python-scons/setup.py install \
index dd82b0efe13b7a0aa4344adbed0c2f3cfc31c9e2..6ac8a6e7e71f6885701fc8f73c265449952cb374 100644 (file)
@@ -114,7 +114,14 @@ if build == 'aegis':
     scons_dir = os.path.join(cwd, 'build', 'test' + str(testver), 'bin')
 
     if testver == 1:
-        test_dir = os.path.join('test1', 'lib', 'scons-' + str(version))
+        test_dir = os.path.join('test1', 'lib', '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.
+        #test_dir = os.path.join('test1', 'lib', 'scons-' + str(version))
     elif testver == 2:
         test_dir = os.path.join('test2', 'lib', 'python' + sys.version[0:3],
                                 'site-packages')
index 1539f722f5245d77b880ecd66fc1469b656bec63..1659437a807562f30f91b7f128511ae45557aa10 100644 (file)
@@ -23,54 +23,6 @@ the latest version by checking the SCons download page at:
         http://www.scons.org/download.html
 
 
-ABOUT SCONS PACKAGES
-====================
-
-The complete SCons system is comprised of three separate packages:
-
-    scons [THIS PACKAGE]
-        The scons script itself, plus the SCons build engine
-        installed into an SCons-specific library directory.
-
-    python-scons
-        The SCons build engine, installed into the standard
-        Python library directory.
-
-    scons-script
-        Only the scons script itself.
-
-Depending on what you want to do with SCons, you may need to install
-additional (or other) packages:
-
-    If you just want to use scons (the script) to build software:
-
-        Install this package.  You do not need to install any other
-        packages.
-
-    If you do NOT want to use the scons script, but you want to use the
-    SCons build engine in other Python software:
-
-        Do NOT install this package.  Install the python-scons package
-        instead.
-
-    If you want to use the scons script AND you want to use the SCons
-    build engine in other Python software:
-
-        Install this package AND install the python-scons package.
-
-        Note that this installs two separate copies of the build engine,
-        one (in an SCons-specific library directory) used by the scons
-        script itself and one (in the standard Python library) used by
-        other software.  This allows you the flexibility to upgrade
-        one build engine without affecting the other.
-
-    If you want the scons script and other Python software to use the
-    same version of the build engine:
-
-        Do NOT install this package.  Install the python-scons AND the
-        scons-script packages instead.
-
-
 INSTALLATION
 ============
 
@@ -79,6 +31,11 @@ script as follows:
 
         # python setup.py
 
+This will install the scons script in the default script directory
+(/usr/bin or C:\Python*\Scripts, for example) and the build engine in an
+appropriate SCons library directory (/usr/lib/scons or C:\Python*\SCons,
+for example).
+
 You should have system installation privileges (that is, "root" or
 "Administrator") when running the setup.py script.
 
@@ -153,7 +110,7 @@ Steven Knight
 knight at baldmt dot com
 http://www.baldmt.com/~knight/
 
-With more than a little help from:
+With more than a little help from the SCons Development team:
         Chad Austin
         Charles Crain
         Steve Leblanc
index b33fe7298a75f6706a17c399c40ede8b88aef003..10eb6d1dd824c45eccd9023665b6e1cd705066f2 100644 (file)
@@ -1,3 +1,9 @@
+###
+### THIS FILE IS NO LONGER USED.  THIS IS THE README FILE FOR THE
+### SEPARATE BUILD ENGINE PACKAGE FROM THE ORIGINAL (DRAFT) PACKAGING
+### SCHEME.  WE'RE SAVING THIS IN CASE WE NEED OR WANT TO RESURRECT
+### A SEPARATE BUILD ENGINE PACKAGE IN THE FUTURE.
+###
 # Copyright (c) 2001 Steven Knight
 # __FILE__ __REVISION__ __DATE__ __DEVELOPER__
 
index 3b81d50427b160ea1ce6625c5d3a3059df18390a..3857df6de6f15825d30d7d1729f3140d6f31cdb8 100644 (file)
@@ -497,7 +497,10 @@ def options_init():
        help = "Search up directory tree for SConstruct.")
 
     def option_v(opt, arg):
-       print "SCons version __VERSION__, by Steven Knight et al."
+        import SCons
+       print "SCons by Steven Knight et al.:"
+       print "\tscript version __VERSION__"
+       print "\tbuild engine version %s" % SCons.__version__
        print "Copyright 2001 Steven Knight"
        sys.exit(0)
 
index 6f1ef715243748801a5095712da124230559abd2..62a10bbf28f4c012422c4de769a1b84bf9c86f39 100644 (file)
@@ -1,3 +1,9 @@
+###
+### THIS FILE IS NO LONGER USED.  THIS IS THE README FILE FOR THE
+### SEPARATE SCRIPT PACKAGE FROM THE ORIGINAL (DRAFT) PACKAGING
+### SCHEME.  WE'RE SAVING THIS IN CASE WE NEED OR WANT TO RESURRECT
+### A SEPARATE SCRIPT PACKAGE IN THE FUTURE.
+###
 # Copyright (c) 2001 Steven Knight
 # __FILE__ __REVISION__ __DATE__ __DEVELOPER__
 
diff --git a/src/script/scons.bat b/src/script/scons.bat
new file mode 100644 (file)
index 0000000..ce4faad
--- /dev/null
@@ -0,0 +1,2 @@
+# __FILE__ __REVISION__ __DATE__ __DEVELOPER__
+@python -c "import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
index f8ec6a8ca923d2bcb64d928f860ccc27f0297e21..0f4eb0b18018c2c0ca96b42deee339ab8a05e523 100644 (file)
@@ -30,20 +30,26 @@ import sys
 import os.path
 import os
 
-#XXX once we migrate to the new scheme of using /usr/lib/scons
-#    instead of /usr/lib/scons-X.Y this hardcoding will go away:
-scons_lib_dir = "scons-0.01"
+# Strip the script directory from sys.path() so on case-insensitive
+# (WIN32) systems Python doesn't think that the "scons" script is the
+# "SCons" package.  Replace it with our own library directories
+# (version-specific first, in case they installed by hand there,
+# followed by generic) so we pick up the right version of the build
+# engine modules if they're in either directory.
+
+libs = []
 
-script_dir = sys.path[0]
 if os.environ.has_key("SCONS_LIB_DIR"):
-    lib_dir = os.environ["SCONS_LIB_DIR"]
-elif script_dir and script_dir != os.curdir:
-    (head, tail) = os.path.split(script_dir)
-    lib_dir = os.path.join(head, "lib", scons_lib_dir)
+    libs.append = os.environ["SCONS_LIB_DIR"]
+
+if sys.platform == 'win32':
+    libs.extend([ os.path.join(sys.prefix, 'SCons-__VERSION__'),
+                  os.path.join(sys.prefix, 'SCons') ])
 else:
-    lib_dir = os.path.join(os.pardir, "lib", scons_lib_dir)
+    libs.extend([ os.path.join(sys.prefix, 'lib', 'scons-__VERSION__'),
+                  os.path.join(sys.prefix, 'lib', 'scons') ])
 
-sys.path = [lib_dir] + sys.path
+sys.path = libs + sys.path[1:]
 
 import SCons.Script
 SCons.Script.main()
index 94ede1f38e30bb1b8c4ac14fbfe0c06a4e97e928..f04ca1bb7e99d9e03fa320e5167420d0aad64045 100644 (file)
@@ -1,2 +1,5 @@
 [bdist_rpm]
 group = Development/Tools
+
+[bdist_wininst]
+title = SCons - a software construction tool
index f256e2279a123a9ffc95d30ea751c066696957d0..b132a9e82794be174a7068aa86439f97cf9a461d 100644 (file)
@@ -38,7 +38,9 @@ from distutils.command.install_lib import install_lib
 
 class my_install_lib(install_lib):
     def finalize_options(self):
+       open("/dev/tty", "w").write("lib:  self.install_dir = %s\n" % self.install_dir)
         install_lib.finalize_options(self)
+       open("/dev/tty", "w").write("lib:  self.install_dir = %s\n" % self.install_dir)
        head = self.install_dir
         while head:
            if head == os.sep:
@@ -46,27 +48,47 @@ class my_install_lib(install_lib):
                break
            else:
                head, tail = os.path.split(head)
-           open("/dev/tty", 'w').write("head = " + head + "\n")
-           if tail[:6] in ["python", "Python"]:
-               break
-        if head:
-            self.install_dir = os.path.join(head, "scons-__VERSION__")
+            if tail[:6] == "python":
+                self.install_dir = os.path.join(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__")
+                return
+            elif tail[:6] == "Python":
+                self.install_dir = os.path.join(head, tail)
+                return
 
-setup(name = "scons",
-      version = "__VERSION__",
-      description = "an Open Source software construction tool",
-      long_description = """SCons is an Open Source software construction tool--that is, a build tool; an
+description = \
+"""SCons is an Open Source software construction tool--that is, a build tool; an
 improved substitute for the classic Make utility; a better way to build
-software.""",
-      author = "Steven Knight",
-      author_email = "knight@baldmt.com",
-      url = "http://www.scons.org/",
-      license = "MIT, freely distributable",
-      keywords = "scons, cons, make, build tool, make tool",
-      packages = ["SCons",
-                  "SCons.Node",
-                  "SCons.Scanner",
-                  "SCons.Sig"],
-      package_dir = {'': 'engine'},
-      scripts = ["script/scons"],
-      cmdclass = {'install_lib': my_install_lib})
+software."""
+
+keywords = "scons, cons, make, build tool, make tool, software build tool, software construction tool"
+
+arguments = {
+    'name'             : "scons",
+    'version'          : "__VERSION__",
+    'description'      : "an Open Source software construction tool",
+    'long_description' : description,
+    'author'           : "Steven Knight",
+    'author_email'     : "knight@scons.org",
+    'url'              : "http://www.scons.org/",
+    'license'          : "MIT, freely distributable",
+    'keywords'         : keywords,
+    'packages'         : ["SCons",
+                          "SCons.Node",
+                          "SCons.Scanner",
+                          "SCons.Sig"],
+    'package_dir'      : {'' : 'engine'},
+    'scripts'          : ["script/scons"],
+    'cmdclass'         : {'install_lib' : my_install_lib}
+}
+
+if sys.argv[1] == "bdist_wininst":
+    arguments['data_files'] = [('.', ["script/scons.bat"])]
+
+apply(setup, (), arguments)
index 097e3d3473f47309effef4559d940e4e67417a0b..43c883403479e5309aecd20732822f6c776c6045 100644 (file)
@@ -33,7 +33,9 @@ test = TestSCons.TestSCons(match = TestCmd.match_re)
 
 test.write('SConstruct', "")
 
-expect = r"""SCons version \S+, by Steven Knight et al.
+expect = r"""SCons by Steven Knight et al.:
+\tscript version \S+
+\tbuild engine version \S+
 Copyright 2001 Steven Knight
 """