From ad78319ad3ede8f7065f9c945a3585cad04c3731 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Wed, 28 Nov 2001 03:30:53 +0000 Subject: Change packaging to the new /usr/lib/scons/ scheme --- Construct | 53 ++++++++++++++++++++++++++++--------- debian/rules | 4 ++- runtest.py | 9 ++++++- src/README.txt | 55 +++++--------------------------------- src/engine/README.txt | 6 +++++ src/engine/SCons/Script.py | 5 +++- src/script/README.txt | 6 +++++ src/script/scons.bat | 2 ++ src/script/scons.py | 26 +++++++++++------- src/setup.cfg | 3 +++ src/setup.py | 66 ++++++++++++++++++++++++++++++---------------- test/option-v.py | 4 ++- 12 files changed, 142 insertions(+), 97 deletions(-) create mode 100644 src/script/scons.bat diff --git a/Construct b/Construct index 2a1c435..9114a76 100644 --- 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); } diff --git a/debian/rules b/debian/rules index 4ff4659..e410c4c 100644 --- a/debian/rules +++ b/debian/rules @@ -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 \ diff --git a/runtest.py b/runtest.py index dd82b0e..6ac8a6e 100644 --- a/runtest.py +++ b/runtest.py @@ -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') diff --git a/src/README.txt b/src/README.txt index 1539f72..1659437 100644 --- a/src/README.txt +++ b/src/README.txt @@ -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 diff --git a/src/engine/README.txt b/src/engine/README.txt index b33fe72..10eb6d1 100644 --- a/src/engine/README.txt +++ b/src/engine/README.txt @@ -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__ diff --git a/src/engine/SCons/Script.py b/src/engine/SCons/Script.py index 3b81d50..3857df6 100644 --- a/src/engine/SCons/Script.py +++ b/src/engine/SCons/Script.py @@ -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) diff --git a/src/script/README.txt b/src/script/README.txt index 6f1ef71..62a10bb 100644 --- a/src/script/README.txt +++ b/src/script/README.txt @@ -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 index 0000000..ce4faad --- /dev/null +++ b/src/script/scons.bat @@ -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 diff --git a/src/script/scons.py b/src/script/scons.py index f8ec6a8..0f4eb0b 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -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() diff --git a/src/setup.cfg b/src/setup.cfg index 94ede1f..f04ca1b 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -1,2 +1,5 @@ [bdist_rpm] group = Development/Tools + +[bdist_wininst] +title = SCons - a software construction tool diff --git a/src/setup.py b/src/setup.py index f256e22..b132a9e 100644 --- a/src/setup.py +++ b/src/setup.py @@ -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) diff --git a/test/option-v.py b/test/option-v.py index 097e3d3..43c8834 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -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 """ -- cgit v0.12