From 81953156f0c5075d21b9d1573ead1f2e482482a6 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 18 Jun 2002 01:26:24 +0000 Subject: Supply more specific version info, including build date. --- README | 55 +++++++++++++------------ SConstruct | 75 +++++++++++++++++++---------------- src/CHANGES.txt | 2 + src/engine/SCons/Platform/__init__.py | 2 - src/engine/SCons/Scanner/__init__.py | 2 - src/engine/SCons/Script/__init__.py | 17 ++++++-- src/engine/SCons/__init__.py | 8 ++++ src/script/scons.py | 14 ++++++- test/option-v.py | 4 +- 9 files changed, 109 insertions(+), 70 deletions(-) diff --git a/README b/README index 6f2441a..f4a0437 100644 --- a/README +++ b/README @@ -51,9 +51,9 @@ part of Python until Python version 1.6, so if your system is running Python 1.5.2, you may not have distutils installed. If you are running Python version 1.6 or later, you should be fine. -NOTE TO RED HAT USERS: All Red Hat Linux versions as late as 7.3 -still ship Python 1.5.2 as the default, so you probably do *not* have -distutils installed, unless you have already done so manually. +NOTE TO RED HAT USERS: All Red Hat Linux versions as late as 7.3 (at +least) still ship Python 1.5.2 as the default, so you probably do *not* +have distutils installed, unless you have already done so manually. In this case, your options are: @@ -93,13 +93,13 @@ system, populate the build/scons/ directory by running: If you don't have SCons version 0.07 or later already installed on your system, you can use SCons itself to populate the build/scons/ directory -with a little more work: +with a little more typing: $ SCONS_LIB_DIR=`pwd`/src/engine python src/script/scons.py build/scons -Either command populates the build/scons/ directory with the necessary -files and directory structure to use the Python-standard setup script as -follows: +Either command will populate the build/scons/ directory with the +necessary files and directory structure to use the Python-standard setup +script as follows: # cd build/scons # python setup.py install @@ -109,9 +109,9 @@ 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 to install SCons in -the default system directories. +You should have system installation privileges (that is, "root" on POSIX +or "Administrator" on Windows) when running the setup.py script to +install SCons in the default system directories. If you don't have system installation privileges, you can use the --prefix option to specify an alternate installation location, such as @@ -129,11 +129,14 @@ TESTING Tests are run by the runtest.py script in this directory. -There are two types of tests in this package. Unit tests for individual -SCons modules live underneath the src/engine/ subdirectory and are the -same base name as the module with "Tests.py" appended--for example, -the unit test for the Builder.py module is the BuilderTests.py script. -End-to-end tests of SCons live in the test/ subdirectory. +There are two types of tests in this package: + + Unit tests for individual SCons modules live underneath the + src/engine/ subdirectory and are the same base name as the module + with "Tests.py" appended--for example, the unit test for the + Builder.py module is the BuilderTests.py script. + + End-to-end tests of SCons live in the test/ subdirectory. You may specifically list one or more tests to be run: @@ -168,7 +171,7 @@ system, you can build everything by simply running it: If you don't have SCons version 0.07 or later already installed on your system, you can build this version of SCons with itself with a little -more work: +more typing: $ SCONS_LIB_DIR=`pwd`/src/engine python src/script/scons.py @@ -192,7 +195,7 @@ For example, if you don't have Debian packaging tools installed, it should just not build the .deb package, not fail the build. If you receive a build error, please report it to the scons-devel -mailing list. +mailing list and open a bug report on the SCons bug tracker. Note that in addition to creating the above packages, the default build will also unpack one or more of the packages for testing. @@ -220,8 +223,8 @@ via the -a option) against the unpacked build/test-/* subdirectory: $ python runtest.py -p zip -(The canonical invocation is to specify the runtest.py -a option so that -all tests are run against the specified package.) +(The canonical invocation is to also use the runtest.py -a option so +that all tests are run against the specified package.) CONTENTS OF THIS PACKAGE @@ -283,12 +286,14 @@ runtest.py (aeb) before running tests. SConstruct - The "Makefile" for the SCons distribution. (It has been - pointed out that it's hard to find the SCons API in here, and - it looks a lot more like a straight Python script than a build - configuration file, but that's mainly because all of the magick - we have to do to deal with a variety of packaging formats - requires a lot of straight Python manipulation.) + The "Makefile" for the SCons distribution. + + (It has been pointed out that it's hard to find the SCons API in + this SConstruct file, and that it looks a lot more like a pure + Python script than a build configuration file. That's mainly + because all of the magick we have to perform to deal with all of + the different packaging formats requires a lot of pure Python + manipulation.) src/ Where the actual source code is kept, of course. diff --git a/SConstruct b/SConstruct index 748f06b..af650d2 100644 --- a/SConstruct +++ b/SConstruct @@ -1,6 +1,8 @@ # # SConstruct file to build scons packages during development. # +# See the README file for an overview of how SCons is built and tested. +# # # Copyright (c) 2001, 2002 Steven Knight @@ -39,11 +41,9 @@ default_version = '0.08' Default('.') # -# An internal "whereis" routine to figure out if we have a -# given program available. Put it in the "cons::" package -# so subsidiary Conscript files can get at it easily, too. +# An internal "whereis" routine to figure out if a given program +# is available on this system. # - def whereis(file): for dir in string.split(os.environ['PATH'], os.pathsep): f = os.path.join(dir, file) @@ -59,7 +59,7 @@ def whereis(file): # # We let the presence or absence of various utilities determine # whether or not we bother to build certain pieces of things. -# This will allow people to still do SCons work even if they +# This should allow people to still do SCons work even if they # don't have Aegis or RPM installed, for example. # aegis = whereis('aegis') @@ -72,7 +72,7 @@ unzip = whereis('unzip') zip = whereis('zip') # -# Now grab the information that we "build" into the files (using sed). +# Now grab the information that we "build" into the files. # try: date = ARGUMENTS['date'] @@ -88,13 +88,17 @@ elif os.environ.has_key('LOGNAME'): elif os.environ.has_key('USER'): developer = os.environ['USER'] -try: +if ARGUMENTS.has_key('build_system'): + build_system = ARGUMENTS['build_system'] +else: + build_system = string.split(os.uname()[1], '.')[0] + +if ARGUMENTS.has_key('version'): revision = ARGUMENTS['version'] -except: - if aesub: - revision = os.popen(aesub + " \\$version", "r").read()[:-1] - else: - revision = default_version +elif aesub: + revision = os.popen(aesub + " \\$version", "r").read()[:-1] +else: + revision = default_version a = string.split(revision, '.') arr = [a[0]] @@ -120,13 +124,14 @@ revision = string.join(arr, '.') #version = string.join(arr, '.') version = default_version -try: +build_id = string.replace(revision, version + '.', '') + +if ARGUMENTS.has_key('change'): change = ARGUMENTS['change'] -except: - if aesub: - change = os.popen(aesub + " \\$change", "r").read()[:-1] - else: - change = default_version +elif aesub: + change = os.popen(aesub + " \\$change", "r").read()[:-1] +else: + change = default_version python_ver = sys.version[0:3] @@ -139,19 +144,17 @@ for key in ['AEGIS_PROJECT', 'PYTHONPATH']: lib_project = os.path.join("lib", project) -unpack_tar_gz_dir = os.path.join(os.getcwd(), "build", "unpack-tar-gz") - -unpack_zip_dir = os.path.join(os.getcwd(), "build", "unpack-zip") - -test_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-tar-gz") -test_src_tar_gz_dir = os.path.join(os.getcwd(), "build", "test-src-tar-gz") - -test_zip_dir = os.path.join(os.getcwd(), "build", "test-zip") -test_src_zip_dir = os.path.join(os.getcwd(), "build", "test-src-zip") +cwd_build = os.path.join(os.getcwd(), "build") -test_rpm_dir = os.path.join(os.getcwd(), "build", "test-rpm") +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") -test_deb_dir = os.path.join(os.getcwd(), "build", "test-deb") +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 = '' @@ -226,11 +229,13 @@ def SCons_revision(target, source, env): # Note: We construct the __*__ substitution strings here # so that they don't get replaced when this file gets # copied into the tree for packaging. - line = string.replace(line, '_' + '_DATE__', env['DATE']) - line = string.replace(line, '_' + '_DEVELOPER__', env['DEVELOPER']) - line = string.replace(line, '_' + '_FILE__', s) - line = string.replace(line, '_' + '_REVISION__', env['REVISION']) - line = string.replace(line, '_' + '_VERSION__', version) + line = string.replace(line, '__BUILD' + '__', env['BUILD']) + line = string.replace(line, '__BUILDSYS' + '__', env['BUILDSYS']) + line = string.replace(line, '__DATE' + '__', env['DATE']) + line = string.replace(line, '__DEVELOPER' + '__', env['DEVELOPER']) + line = string.replace(line, '__FILE' + '__', s) + line = string.replace(line, '__REVISION' + '__', env['REVISION']) + line = string.replace(line, '__VERSION' + '__', version) outf.write(line) inf.close() outf.close() @@ -241,6 +246,8 @@ revbuilder = Builder(action = SCons_revision) env = Environment( ENV = ENV, + BUILD = build_id, + BUILDSYS = build_system, DATE = date, DEVELOPER = developer, REVISION = revision, diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c186d6a..63feea2 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -59,6 +59,8 @@ RELEASE 0.08 - - Fix C #include scanning to detect file names with characters like '-' in them. + - Add more specific version / build output to the -v option. + From Jeff Petkau: - Fix --implicit-cache if the scanner returns an empty list. diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 201a1b9..a519142 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -44,8 +44,6 @@ their own platform definition. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -__version__ = "__VERSION__" - import imp import os import sys diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index b2e04a3..28159c9 100644 --- a/src/engine/SCons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -29,8 +29,6 @@ The Scanner package for the SCons software construction utility. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -__version__ = "__VERSION__" - import SCons.Node.FS import SCons.Util diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 879f6d1..3471190 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -52,7 +52,9 @@ import copy # "SCons" package. Replace it with our own version directory so, if # if they're there, we pick up the right version of the build engine # modules. -sys.path = [os.path.join(sys.prefix, 'lib', 'scons-__VERSION__')] + sys.path[1:] +#sys.path = [os.path.join(sys.prefix, +# 'lib', +# 'scons-%d' % SCons.__version__)] + sys.path[1:] import SCons.Node import SCons.Node.FS @@ -673,10 +675,19 @@ def options_init(): "build Default() targets from local SConscript."]) def option_v(opt, arg): + import __main__ import SCons print "SCons by Steven Knight et al.:" - print "\tscript version __VERSION__" - print "\tbuild engine version %s" % SCons.__version__ + print "\tscript: v%s.%s, %s, by %s on %s" % (__main__.__version__, + __main__.__build__, + __main__.__date__, + __main__.__developer__, + __main__.__buildsys__) + print "\tengine: v%s.%s, %s, by %s on %s" % (SCons.__version__, + SCons.__build__, + SCons.__date__, + SCons.__developer__, + SCons.__buildsys__) print "Copyright 2001, 2002 Steven Knight" sys.exit(0) diff --git a/src/engine/SCons/__init__.py b/src/engine/SCons/__init__.py index a3bcfde..e4d1464 100644 --- a/src/engine/SCons/__init__.py +++ b/src/engine/SCons/__init__.py @@ -30,3 +30,11 @@ The main package for the SCons software construction utility. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" __version__ = "__VERSION__" + +__build__ = "__BUILD__" + +__buildsys__ = "__BUILDSYS__" + +__date__ = "__DATE__" + +__developer__ = "__DEVELOPER__" diff --git a/src/script/scons.py b/src/script/scons.py index 8e64d1d..b42ed42 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -26,6 +26,16 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +__version__ = "__VERSION__" + +__build__ = "__BUILD__" + +__buildsys__ = "__BUILDSYS__" + +__date__ = "__DATE__" + +__developer__ = "__DEVELOPER__" + import sys import os.path import os @@ -47,7 +57,7 @@ if os.environ.has_key("SCONS_LIB_DIR"): libs.append(os.environ["SCONS_LIB_DIR"]) if sys.platform == 'win32': - libs.extend([ os.path.join(sys.prefix, 'SCons-__VERSION__'), + libs.extend([ os.path.join(sys.prefix, 'SCons-%s' % __version__), os.path.join(sys.prefix, 'SCons') ]) else: prefs = [] @@ -76,7 +86,7 @@ else: else: prefs.append(sys.prefix) - libs.extend(map(lambda x: os.path.join(x, 'lib', 'scons-__VERSION__'), prefs)) + 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:] diff --git a/test/option-v.py b/test/option-v.py index 594a0de..f114e25 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -34,8 +34,8 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) test.write('SConstruct', "") expect = r"""SCons by Steven Knight et al.: -\tscript version \S+ -\tbuild engine version \S+ +\tscript: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+ +\tengine: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+ Copyright 2001, 2002 Steven Knight """ -- cgit v0.12