diff options
-rw-r--r-- | Construct | 181 | ||||
-rw-r--r-- | doc/Conscript | 15 | ||||
-rw-r--r-- | etc/Conscript | 4 | ||||
-rw-r--r-- | etc/TestSCons.py | 5 | ||||
-rw-r--r-- | runtest.py | 16 | ||||
-rw-r--r-- | src/MANIFEST | 17 | ||||
-rw-r--r-- | src/engine/MANIFEST | 16 | ||||
-rw-r--r-- | src/engine/SCons/.aeignore (renamed from src/scons/Sig/.aeignore) | 0 | ||||
-rw-r--r-- | src/engine/SCons/Builder.py (renamed from src/scons/Builder.py) | 8 | ||||
-rw-r--r-- | src/engine/SCons/BuilderTests.py (renamed from src/scons/BuilderTests.py) | 26 | ||||
-rw-r--r-- | src/engine/SCons/Defaults.py (renamed from src/scons/Defaults.py) | 10 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py (renamed from src/scons/Environment.py) | 6 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py (renamed from src/scons/EnvironmentTests.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/Errors.py (renamed from src/scons/Errors.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/ErrorsTests.py (renamed from src/scons/ErrorsTests.py) | 10 | ||||
-rw-r--r-- | src/engine/SCons/Job.py (renamed from src/scons/Job.py) | 2 | ||||
-rw-r--r-- | src/engine/SCons/JobTests.py (renamed from src/scons/JobTests.py) | 10 | ||||
-rw-r--r-- | src/engine/SCons/Node/.aeignore (renamed from src/scons/Scanner/.aeignore) | 0 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py (renamed from src/scons/Node/FS.py) | 8 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS/.aeignore (renamed from src/scons/Node/FS/.aeignore) | 0 | ||||
-rw-r--r-- | src/engine/SCons/Node/FSTests.py (renamed from src/scons/Node/FSTests.py) | 14 | ||||
-rw-r--r-- | src/engine/SCons/Node/NodeTests.py (renamed from src/scons/Node/NodeTests.py) | 6 | ||||
-rw-r--r-- | src/engine/SCons/Node/__init__.py (renamed from src/scons/Node/__init__.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/.aeignore (renamed from src/scons/Node/.aeignore) | 0 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/C.py (renamed from src/scons/Scanner/C.py) | 6 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/CTests.py (renamed from src/scons/Scanner/CTests.py) | 16 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/ScannerTests.py (renamed from src/scons/Scanner/ScannerTests.py) | 10 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/__init__.py (renamed from src/scons/Scanner/__init__.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/Sig/.aeignore (renamed from src/scons/.aeignore) | 0 | ||||
-rw-r--r-- | src/engine/SCons/Sig/MD5.py (renamed from src/scons/Sig/MD5.py) | 6 | ||||
-rw-r--r-- | src/engine/SCons/Sig/MD5Tests.py (renamed from src/scons/Sig/MD5Tests.py) | 18 | ||||
-rw-r--r-- | src/engine/SCons/Sig/TimeStamp.py (renamed from src/scons/Sig/TimeStamp.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/Sig/TimeStampTests.py (renamed from src/scons/Sig/TimeStampTests.py) | 14 | ||||
-rw-r--r-- | src/engine/SCons/Sig/__init__.py (renamed from src/scons/Sig/__init__.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/__init__.py (renamed from src/scons/__init__.py) | 4 | ||||
-rw-r--r-- | src/engine/SCons/exitfuncs.py (renamed from src/scons/exitfuncs.py) | 4 | ||||
-rw-r--r-- | src/engine/setup.py | 16 | ||||
-rw-r--r-- | src/script/MANIFEST | 3 | ||||
-rw-r--r-- | src/script/scons.py (renamed from src/scons.py) | 29 | ||||
-rw-r--r-- | src/script/setup.py (renamed from src/setup.py) | 1 | ||||
-rw-r--r-- | test/exitfns.py | 2 |
41 files changed, 297 insertions, 210 deletions
@@ -5,11 +5,6 @@ # $project = 'scons'; -$env = new cons( ENV => { - AEGIS_PROJECT => $ENV{AEGIS_PROJECT}, - PATH => $ENV{PATH}, - } ); - Default qw( . ); # @@ -65,74 +60,140 @@ pop @arr if $#arr >= 2; map {s/^[CD]//, s/^0*(\d\d)$/$1/} @arr; $version = join('.', @arr); -# -# Use %(-%) around the date so date changes don't cause rebuilds. -# -$sed_cmd = "sed" . - " %( -e 's+__DATE__+$date+' %)" . - " -e 's+__DEVELOPER__+$developer+'" . - " -e 's+__REVISION__+$revision+'" . - " -e 's+__VERSION__+$version+'" . - " %< > %>"; +chomp($python_ver = `python -c 'import sys; print sys.version[0:3]'`); -# -# Run everything in the MANIFEST through the sed command we concocted. -# -chomp(@files = `cat src/MANIFEST`); -foreach $file (@files) { - Command $env "build/$file", "src/$file", $sed_cmd; -} +use Cwd; +$test_dir = File::Spec->catfile(cwd, "build", "test"); -# -# Use the Python distutils to generate the packages. -# -$tar_gz = "build/dist/$project-$version.tar.gz"; +%package_name = ( + 'script' => $project, + 'engine' => "$project-pylib", +); -@setup_args = ('bdist sdist'); +$test_bin_dir = File::Spec->catfile($test_dir, "bin"); +$test_lib_dir = File::Spec->catfile($test_dir, + "lib", + "python${python_ver}", + "site-packages"), -@targets = ( - "build/dist/$project-$version.linux-i686.tar.gz", - $tar_gz, +%install_dir = ( + 'script' => $test_bin_dir, + 'engine' => $test_lib_dir, ); -if ($rpm) { - push(@setup_args, 'bdist_rpm'); +$env = new cons( ENV => { + AEGIS_PROJECT => $ENV{AEGIS_PROJECT}, + PATH => $ENV{PATH}, + }, - push(@targets, - "build/build/bdist.linux-i686/rpm/SOURCES/$project-$version.tar.gz", - "build/build/bdist.linux-i686/rpm/SPECS/$project.spec", - "build/dist/$project-$version-1.src.rpm", - "build/dist/$project-$version-1.noarch.rpm", - ); -}; + TEST_BIN_DIR => $test_bin_dir, + TEST_LIB_DIR => $test_lib_dir, + + DATE => $date, + DEVELOPER => $developer, + REVISION => $revision, + VERSION => $version, + + SED => 'sed', + # Use %(-%) around the date so date + # changes don't cause rebuilds. + SEDFLAGS => " %( -e 's+__DATE__+%DATE+' %)" . + " -e 's+__DEVELOPER__+%DEVELOPER+'" . + " -e 's+__REVISION__+%REVISION+'" . + " -e 's+__VERSION__+%VERSION+'", + SEDCOM => "%SED %SEDFLAGS %< > %>", + ); + +my @src_deps; +for $dir ('script', 'engine') { -$env->Command([@targets], - map("build/$_", @files), - qq(rm -rf build/build build/dist/* - cd build && python setup.py @setup_args) + my $pkg = $package_name{$dir}; + my $install = $install_dir{$dir}; + + my $build = "build/$dir"; + my $src = "src/$dir"; + + my @files; + chomp(@files = `cat src/$dir/MANIFEST`); + + # + # Run everything in the MANIFEST through the sed command we concocted. + # + my $file; + foreach $file (@files) { + $env->Command("$build/$file", "$src/$file", "%SEDCOM"); + } + + # + # Use the Python distutils to generate the packages. + # + my $tar_gz = "$build/dist/$pkg-$version.tar.gz"; + + push(@src_deps, $tar_gz); + + my @setup_args = ('bdist sdist'); + + my @targets = ( + "$build/dist/$pkg-$version.linux-i686.tar.gz", + $tar_gz, + ); + + if ($rpm) { + push(@setup_args, 'bdist_rpm'); + + # XXX "$build/build/bdist.linux-i686/rpm/SOURCES/$pkg-$version.tar.gz", + # XXX "$build/build/bdist.linux-i686/rpm/SPECS/$pkg.spec", + push(@targets, + "$build/dist/$pkg-$version-1.src.rpm", + "$build/dist/$pkg-$version-1.noarch.rpm", + ); + }; + + $env->Command([@targets], + map("$build/$_", @files), + qq(rm -rf $build/build $build/dist/* + cd $build && python setup.py @setup_args) ); -$env->Depends([@targets], 'build/MANIFEST'); + $env->Depends([@targets], "$build/MANIFEST"); -# -# Unpack the .tar.gz created by the distutils into build/test, and -# add the TestCmd.py module. The runtest.py script will set PYTHONPATH -# so that the tests only look under build/test. This makes sure that -# our tests pass with what we really packaged, not because of something -# hanging around in the development directory. -# -$test_dir = "build/test"; + $env->Install("build/dist", @targets); -@test_files = map("$test_dir/$project-$version/$_", @files); + # + # Unpack the .tar.gz created by the distutils into build/unpack. + # + my $unpack = "build/unpack"; -Command $env [@test_files], $tar_gz, qq( - rm -rf $test_dir/$project-$version - tar zxf %< -C $test_dir -); + my @unpack_files = map("$unpack/$pkg-$version/$_", @files); -Export qw( env test_dir ); + Command $env [@unpack_files], $tar_gz, qq( + rm -rf $unpack/$pkg-$version + tar zxf %< -C $unpack + ); + + # + # Run setup.py in the unpacked subdirectory to "install" everything + # into our build/test subdirectory. Auxiliary modules that we need + # (TestCmd.py, TestSCons.py, unittest.py) will be copied in by + # etc/Conscript. The runtest.py script will set PYTHONPATH so that + # the tests only look under build/test. This makes sure that our + # tests pass with what we really packaged, not because of something + # hanging around in the development directory. + # + my %seen; + map($seen{$_}++, "MANIFEST", "setup.py"); + @test_files = map(File::Spec->catfile($install, $_), + grep($_ =~ /\.py$/ && ! $seen{$_}++, @files)); + + Command $env [@test_files], @unpack_files, qq( + rm -rf $install + cd $unpack/$pkg-$version && python setup.py install --prefix=$test_dir + ); +} + +Export qw( env ); Build "etc/Conscript"; @@ -142,8 +203,6 @@ Build "etc/Conscript"; if ($jw) { Link 'build/doc' => 'doc'; - Export qw( date env revision version ); - Build 'build/doc/Conscript'; } @@ -172,11 +231,11 @@ if ($change) { chomp(@src_files); foreach $file (@src_files) { - $env->Command("build/$project-src/$file", $file, $sed_cmd); + $env->Command("build/$project-src/$file", $file, "%SEDCOM"); } $env->Command("build/dist/$project-src-$version.tar.gz", - $tar_gz, + @src_deps, map("build/$project-src/$_", @src_files), qq( rm -rf build/$project-src-$version diff --git a/doc/Conscript b/doc/Conscript index 0ca7999..9e5f0d9 100644 --- a/doc/Conscript +++ b/doc/Conscript @@ -2,17 +2,12 @@ # Conscript file for building SCons documentation. # -Import qw( - date - env - revision - version -); +Import qw( env ); # # # -$doc_tar_gz = "#build/dist/scons-doc-$version.tar.gz"; +$doc_tar_gz = "#build/dist/scons-doc-${\$env->{VERSION}}.tar.gz"; # # We'll only try to build text files (for some documents) @@ -33,9 +28,9 @@ print FILE <<_EOF_; <!-- THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. --> -<!ENTITY build_date "$date"> -<!ENTITY build_version "$version"> -<!ENTITY build_revision "$revision"> +<!ENTITY build_date "${\$env->{DATE}}"> +<!ENTITY build_version "${\$env->{VERSION}}"> +<!ENTITY build_revision "${\$env->{REVISION}}"> _EOF_ close(FILE); diff --git a/etc/Conscript b/etc/Conscript index 5c4efc5..c1a7942 100644 --- a/etc/Conscript +++ b/etc/Conscript @@ -4,8 +4,8 @@ # of stuff to work on SCons. # -Import qw( env test_dir ); +Import qw( env ); @modules = qw(TestCmd.py TestSCons.py unittest.py); -$env->Install("#$test_dir", @modules); +$env->Install($env->{TEST_LIB_DIR}, @modules); diff --git a/etc/TestSCons.py b/etc/TestSCons.py index b1eeae6..dcd462a 100644 --- a/etc/TestSCons.py +++ b/etc/TestSCons.py @@ -84,6 +84,11 @@ class TestSCons(TestCmd.TestCmd): print "STDERR ============" print self.stderr() raise + if self.status: + print self.progam + " returned " + (self.status >> 8) + print "STDERR ============" + print self.stderr() + raise TestFailed if stdout and not self.match(self.stdout(), stdout): print "Expected STDOUT ==========" print stdout @@ -100,18 +100,20 @@ if build == 'aegis': version = aegis_to_version(version) - build_test = os.path.join(cwd, "build", "test") - scons_dir = os.path.join(build_test, "scons-" + version) + scons_dir = os.path.join(cwd, 'build', 'test', 'bin') - os.environ['PYTHONPATH'] = string.join([scons_dir, - build_test], - os.pathsep) + os.environ['PYTHONPATH'] = os.path.join(cwd, + 'build', + 'test', + 'lib', + 'python' + sys.version[0:3], + 'site-packages') else: - scons_dir = os.path.join(cwd, 'src') + scons_dir = os.path.join(cwd, 'src', 'script') - os.environ['PYTHONPATH'] = string.join([os.path.join(cwd, 'src'), + os.environ['PYTHONPATH'] = string.join([os.path.join(cwd, 'src', 'engine'), os.path.join(cwd, 'etc')], os.pathsep) diff --git a/src/MANIFEST b/src/MANIFEST deleted file mode 100644 index 33e888c..0000000 --- a/src/MANIFEST +++ /dev/null @@ -1,17 +0,0 @@ -MANIFEST -scons/__init__.py -scons/Builder.py -scons/Defaults.py -scons/Environment.py -scons/Errors.py -scons/Job.py -scons/exitfuncs.py -scons/Node/__init__.py -scons/Node/FS.py -scons/Scanner/__init__.py -scons/Scanner/C.py -scons/Sig/__init__.py -scons/Sig/MD5.py -scons/Sig/TimeStamp.py -scons.py -setup.py diff --git a/src/engine/MANIFEST b/src/engine/MANIFEST new file mode 100644 index 0000000..51c6822 --- /dev/null +++ b/src/engine/MANIFEST @@ -0,0 +1,16 @@ +MANIFEST +SCons/__init__.py +SCons/Builder.py +SCons/Defaults.py +SCons/Environment.py +SCons/Errors.py +SCons/Job.py +SCons/exitfuncs.py +SCons/Node/__init__.py +SCons/Node/FS.py +SCons/Scanner/__init__.py +SCons/Scanner/C.py +SCons/Sig/__init__.py +SCons/Sig/MD5.py +SCons/Sig/TimeStamp.py +setup.py diff --git a/src/scons/Sig/.aeignore b/src/engine/SCons/.aeignore index 43fe851..43fe851 100644 --- a/src/scons/Sig/.aeignore +++ b/src/engine/SCons/.aeignore diff --git a/src/scons/Builder.py b/src/engine/SCons/Builder.py index 8b19bd5..f1ab100 100644 --- a/src/scons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -1,4 +1,4 @@ -"""scons.Builder +"""SCons.Builder XXX @@ -9,8 +9,8 @@ __revision__ = "Builder.py __REVISION__ __DATE__ __DEVELOPER__" import os +import SCons.Node.FS import types -from scons.Node.FS import Dir, File, lookup @@ -23,7 +23,7 @@ class Builder: action = None, input_suffix = None, output_suffix = None, - node_class = File): + node_class = SCons.Node.FS.File): self.name = name self.action = Action(action) self.insuffix = input_suffix @@ -38,7 +38,7 @@ class Builder: return cmp(self.__dict__, other.__dict__) def __call__(self, env, target = None, source = None): - node = lookup(self.node_class, target) + node = SCons.Node.FS.lookup(self.node_class, target) node.builder_set(self) node.env_set(self) node.sources = source # XXX REACHING INTO ANOTHER OBJECT diff --git a/src/scons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index 822b64c..67435bc 100644 --- a/src/scons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -4,7 +4,7 @@ import sys import unittest import TestCmd -from scons.Builder import Builder, CommandAction, FunctionAction +import SCons.Builder # Initial setup of the common environment for all tests, @@ -34,16 +34,16 @@ class BuilderTestCase(unittest.TestCase): Verify that we can retrieve the supplied action attribute. """ - builder = Builder(action = "foo") + builder = SCons.Builder.Builder(action = "foo") assert builder.action.command == "foo" def test_cmp(self): """Test simple comparisons of Builder objects """ - b1 = Builder(input_suffix = '.o') - b2 = Builder(input_suffix = '.o') + b1 = SCons.Builder.Builder(input_suffix = '.o') + b2 = SCons.Builder.Builder(input_suffix = '.o') assert b1 == b2 - b3 = Builder(input_suffix = '.x') + b3 = SCons.Builder.Builder(input_suffix = '.x') assert b1 != b3 assert b2 != b3 @@ -54,7 +54,7 @@ class BuilderTestCase(unittest.TestCase): and one is an internal Python function. """ cmd = "python %s %s xyzzy" % (act_py, outfile) - builder = Builder(action = cmd) + builder = SCons.Builder.Builder(action = cmd) builder.execute() assert test.read(outfile, 'r') == "act.py: xyzzy\n" @@ -65,7 +65,7 @@ class BuilderTestCase(unittest.TestCase): f.close() return not None - builder = Builder(action = function) + builder = SCons.Builder.Builder(action = function) builder.execute(out = outfile) assert test.read(outfile, 'r') == "function\n" @@ -75,15 +75,15 @@ class BuilderTestCase(unittest.TestCase): Make sure that the '.' separator is appended to the beginning if it isn't already present. """ - builder = Builder(input_suffix = '.c') + builder = SCons.Builder.Builder(input_suffix = '.c') assert builder.insuffix == '.c' - builder = Builder(input_suffix = 'c') + builder = SCons.Builder.Builder(input_suffix = 'c') assert builder.insuffix == '.c' def test_name(self): """Test Builder creation with a specified name """ - builder = Builder(name = 'foo') + builder = SCons.Builder.Builder(name = 'foo') assert builder.name == 'foo' def test_node_class(self): @@ -91,7 +91,7 @@ class BuilderTestCase(unittest.TestCase): """ class Foo: pass - builder = Builder(node_class = Foo) + builder = SCons.Builder.Builder(node_class = Foo) assert builder.node_class is Foo def test_outsuffix(self): @@ -100,9 +100,9 @@ class BuilderTestCase(unittest.TestCase): Make sure that the '.' separator is appended to the beginning if it isn't already present. """ - builder = Builder(input_suffix = '.o') + builder = SCons.Builder.Builder(input_suffix = '.o') assert builder.insuffix == '.o' - builder = Builder(input_suffix = 'o') + builder = SCons.Builder.Builder(input_suffix = 'o') assert builder.insuffix == '.o' diff --git a/src/scons/Defaults.py b/src/engine/SCons/Defaults.py index 0aa2b82..56a15f7 100644 --- a/src/scons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -1,4 +1,4 @@ -"""scons.Defaults +"""SCons.Defaults Builders and other things for the local site. Here's where we'll duplicate the functionality of autoconf until we move it into the @@ -10,11 +10,13 @@ __revision__ = "local.py __REVISION__ __DATE__ __DEVELOPER__" -from scons.Builder import Builder +import SCons.Builder -Object = Builder(name = 'Object', action = 'cc -c -o %(target)s %(source)s') -Program = Builder(name = 'Program', action = 'cc -o %(target)s %(source)s') +Object = SCons.Builder.Builder(name = 'Object', + action = 'cc -c -o %(target)s %(source)s') +Program = SCons.Builder.Builder(name = 'Program', + action = 'cc -o %(target)s %(source)s') Builders = [Object, Program] diff --git a/src/scons/Environment.py b/src/engine/SCons/Environment.py index 9b050d1..a3fe27a 100644 --- a/src/scons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1,4 +1,4 @@ -"""scons.Environment +"""SCons.Environment XXX @@ -59,8 +59,8 @@ class Environment: if not type(builders) is types.ListType: kw['BUILDERS'] = [builders] else: - import scons.Defaults - kw['BUILDERS'] = scons.Defaults.Builders[:] + import SCons.Defaults + kw['BUILDERS'] = SCons.Defaults.Builders[:] self.Dictionary.update(copy.deepcopy(kw)) class BuilderWrapper: diff --git a/src/scons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 2f13c81..6ac4cb7 100644 --- a/src/scons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1,9 +1,9 @@ -__revision__ = "EnivronmentTests.py __REVISION__ __DATE__ __DEVELOPER__" +__revision__ = "EnvironmentTests.py __REVISION__ __DATE__ __DEVELOPER__" import sys import unittest -from scons.Environment import * +from SCons.Environment import * diff --git a/src/scons/Errors.py b/src/engine/SCons/Errors.py index 2709c19..52facf7 100644 --- a/src/scons/Errors.py +++ b/src/engine/SCons/Errors.py @@ -1,7 +1,7 @@ -"""scons.Errors +"""SCons.Errors This file contains the exception classes used to handle internal -and user errors in scons. +and user errors in SCons. """ diff --git a/src/scons/ErrorsTests.py b/src/engine/SCons/ErrorsTests.py index 8d27332..911b11b 100644 --- a/src/scons/ErrorsTests.py +++ b/src/engine/SCons/ErrorsTests.py @@ -2,22 +2,22 @@ __revision__ = "ErrorsTests.py __REVISION__ __DATE__ __DEVELOPER__" import sys import unittest -from scons.Errors import InternalError, UserError +import SCons.Errors class ErrorsTestCase(unittest.TestCase): def test_InternalError(self): """Test the InternalError exception.""" try: - raise InternalError, "test internal error" - except InternalError, e: + raise SCons.Errors.InternalError, "test internal error" + except SCons.Errors.InternalError, e: assert e.args == "test internal error" def test_UserError(self): """Test the UserError exception.""" try: - raise UserError, "test user error" - except UserError, e: + raise SCons.Errors.UserError, "test user error" + except SCons.Errors.UserError, e: assert e.args == "test user error" diff --git a/src/scons/Job.py b/src/engine/SCons/Job.py index 09bfcb8..aa9d92a 100644 --- a/src/scons/Job.py +++ b/src/engine/SCons/Job.py @@ -1,4 +1,4 @@ -"""scons.Job +"""SCons.Job This module defines the Serial and Parallel classes that execute tasks to complete a build. The Jobs class provides a higher level interface to start, diff --git a/src/scons/JobTests.py b/src/engine/SCons/JobTests.py index 2d9eff0..ec4c46d 100644 --- a/src/scons/JobTests.py +++ b/src/engine/SCons/JobTests.py @@ -3,7 +3,7 @@ __revision__ = "JobTests.py __REVISION__ __DATE__ __DEVELOPER__" import unittest import random import math -import scons.Job +import SCons.Job import sys # a large number @@ -134,7 +134,7 @@ class ParallelTestCase(unittest.TestCase): raise NoThreadsException() taskmaster = Taskmaster(num_tasks, self, Task) - jobs = scons.Job.Jobs(num_jobs, taskmaster) + jobs = SCons.Job.Jobs(num_jobs, taskmaster) jobs.start() jobs.wait() @@ -152,7 +152,7 @@ class SerialTestCase(unittest.TestCase): "test a serial job" taskmaster = Taskmaster(num_tasks, self, Task) - jobs = scons.Job.Jobs(1, taskmaster) + jobs = SCons.Job.Jobs(1, taskmaster) jobs.start() jobs.wait() @@ -170,7 +170,7 @@ class SerialExceptionTestCase(unittest.TestCase): "test a serial job with tasks that raise exceptions" taskmaster = Taskmaster(num_tasks, self, ExceptionTask) - jobs = scons.Job.Jobs(1, taskmaster) + jobs = SCons.Job.Jobs(1, taskmaster) jobs.start() jobs.wait() @@ -186,7 +186,7 @@ class ParallelExceptionTestCase(unittest.TestCase): "test parallel jobs with tasks that raise exceptions" taskmaster = Taskmaster(num_tasks, self, ExceptionTask) - jobs = scons.Job.Jobs(num_jobs, taskmaster) + jobs = SCons.Job.Jobs(num_jobs, taskmaster) jobs.start() jobs.wait() diff --git a/src/scons/Scanner/.aeignore b/src/engine/SCons/Node/.aeignore index 43fe851..43fe851 100644 --- a/src/scons/Scanner/.aeignore +++ b/src/engine/SCons/Node/.aeignore diff --git a/src/scons/Node/FS.py b/src/engine/SCons/Node/FS.py index 7640a7a..e7956c2 100644 --- a/src/scons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1,4 +1,4 @@ -"""scons.Node.FS +"""SCons.Node.FS File system nodes. @@ -10,7 +10,7 @@ __revision__ = "Node/FS.py __REVISION__ __DATE__ __DEVELOPER__" import os import os.path -from scons.Node import Node +import SCons.Node @@ -94,7 +94,7 @@ def lookup(fsclass, name, directory = Top): # linked_targets # is_accessible -class Dir(Node): +class Dir(SCons.Node.Node): """A class for directories in a file system. """ @@ -130,7 +130,7 @@ class Dir(Node): # is_under # relpath -class File(Node): +class File(SCons.Node.Node): """A class for files in a file system. """ diff --git a/src/scons/Node/FS/.aeignore b/src/engine/SCons/Node/FS/.aeignore index 43fe851..43fe851 100644 --- a/src/scons/Node/FS/.aeignore +++ b/src/engine/SCons/Node/FS/.aeignore diff --git a/src/scons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 14b62c2..aa8cf2a 100644 --- a/src/scons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -4,7 +4,7 @@ import os import sys import unittest -from scons.Node.FS import init, lookup, Dir, File +import SCons.Node.FS @@ -39,10 +39,10 @@ class FSTestCase(unittest.TestCase): os.chdir(sub_dir) - init() + SCons.Node.FS.init() def Dir_test(lpath, path, abspath, up_path): - dir = lookup(Dir, lpath) + dir = SCons.Node.FS.lookup(SCons.Node.FS.Dir, lpath) assert(dir.path == path) assert(dir.abspath == abspath) assert(dir.up().path == up_path) @@ -58,14 +58,14 @@ class FSTestCase(unittest.TestCase): Dir_test('./.', '.', sub_dir, sub) Dir_test('foo/./bar', 'foo/bar/', sub_dir_foo_bar, 'foo/') - d1 = lookup(Dir, 'd1') + d1 = SCons.Node.FS.lookup(SCons.Node.FS.Dir, 'd1') - f1 = lookup(File, 'f1', directory = d1) + f1 = SCons.Node.FS.lookup(SCons.Node.FS.File, 'f1', directory = d1) assert(f1.path == 'd1/f1') try: - f2 = lookup(File, 'f1/f2', directory = d1) + f2 = SCons.Node.FS.lookup(SCons.Node.FS.File, 'f1/f2', directory = d1) except TypeError, x: node = x.args[0] assert(node.path == 'd1/f1') @@ -74,7 +74,7 @@ class FSTestCase(unittest.TestCase): raise try: - dir = lookup(Dir, 'd1/f1') + dir = SCons.Node.FS.lookup(SCons.Node.FS.Dir, 'd1/f1') except TypeError, x: node = x.args[0] assert(node.path == 'd1/f1') diff --git a/src/scons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py index 46292bc..2249a96 100644 --- a/src/scons/Node/NodeTests.py +++ b/src/engine/SCons/Node/NodeTests.py @@ -4,7 +4,7 @@ import os import sys import unittest -from scons.Node import Node +import SCons.Node @@ -22,7 +22,7 @@ class NodeTestCase(unittest.TestCase): def test_build(self): """Test building a node """ - node = Node() + node = SCons.Node.Node() node.builder_set(Builder()) node.path = "xxx" # XXX FAKE SUBCLASS ATTRIBUTE node.sources = "yyy" # XXX FAKE SUBCLASS ATTRIBUTE @@ -32,7 +32,7 @@ class NodeTestCase(unittest.TestCase): def test_builder_set(self): """Test setting a Node's Builder """ - node = Node() + node = SCons.Node.Node() b = Builder() node.builder_set(b) assert node.builder == b diff --git a/src/scons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index e4eb45a..fb77c65 100644 --- a/src/scons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -1,6 +1,6 @@ -"""scons.Node +"""SCons.Node -The Node package for the scons software construction utility. +The Node package for the SCons software construction utility. """ diff --git a/src/scons/Node/.aeignore b/src/engine/SCons/Scanner/.aeignore index 43fe851..43fe851 100644 --- a/src/scons/Node/.aeignore +++ b/src/engine/SCons/Scanner/.aeignore diff --git a/src/scons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index fcb3a46..ce6f9c6 100644 --- a/src/scons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -1,4 +1,4 @@ -"""scons.Scanner.C +"""SCons.Scanner.C This module implements the depenency scanner for C/C++ code. @@ -7,7 +7,7 @@ This module implements the depenency scanner for C/C++ code. __revision__ = "Scanner/C.py __REVISION__ __DATE__ __DEVELOPER__" -import scons.Scanner +import SCons.Scanner import re import os.path @@ -16,7 +16,7 @@ quote_re = re.compile('^[ \t]*#[ \t]*include[ \t]+"([\\w./\\\\]+)"', re.M) def CScan(): "Return a Scanner instance for scanning C/C++ source files" - return scons.Scanner.Scanner(scan) + return SCons.Scanner.Scanner(scan) def find_files(filenames, paths): """ diff --git a/src/scons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index 326e9b8..6a85120 100644 --- a/src/scons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -1,11 +1,11 @@ __revision__ = "Scanner/CTests.py __REVISION__ __DATE__ __DEVELOPER__" -from TestCmd import TestCmd -import scons.Scanner.C +import TestCmd +import SCons.Scanner.C import unittest import sys -test = TestCmd(workdir = '') +test = TestCmd.TestCmd(workdir = '') # create some source files and headers: @@ -75,7 +75,7 @@ def deps_match(deps, headers): class CScannerTestCase1(unittest.TestCase): def runTest(self): env = DummyEnvironment - s = scons.Scanner.C.CScan() + s = SCons.Scanner.C.CScan() deps = s.scan(test.workpath('f1.cpp'), env) self.failUnless(deps_match(deps, ['f1.h', 'f2.h'])) @@ -83,7 +83,7 @@ class CScannerTestCase2(unittest.TestCase): def runTest(self): env = DummyEnvironment env.CPPPATH = [test.workpath("d1")] - s = scons.Scanner.C.CScan() + s = SCons.Scanner.C.CScan() deps = s.scan(test.workpath('f1.cpp'), env) headers = ['f1.h', 'd1/f2.h'] self.failUnless(deps_match(deps, headers)) @@ -92,7 +92,7 @@ class CScannerTestCase3(unittest.TestCase): def runTest(self): env = DummyEnvironment env.CPPPATH = [test.workpath("d1")] - s = scons.Scanner.C.CScan() + s = SCons.Scanner.C.CScan() deps = s.scan(test.workpath('f2.cpp'), env) headers = ['f1.h', 'd1/f2.h', 'd1/d2/f1.h'] self.failUnless(deps_match(deps, headers)) @@ -102,7 +102,7 @@ class CScannerTestCase4(unittest.TestCase): def runTest(self): env = DummyEnvironment env.CPPPATH = [test.workpath("d1"), test.workpath("d1/d2")] - s = scons.Scanner.C.CScan() + s = SCons.Scanner.C.CScan() deps = s.scan(test.workpath('f2.cpp'), env) headers = ['f1.h', 'd1/f2.h', 'd1/d2/f1.h', 'd1/d2/f4.h'] self.failUnless(deps_match(deps, headers)) @@ -110,7 +110,7 @@ class CScannerTestCase4(unittest.TestCase): class CScannerTestCase5(unittest.TestCase): def runTest(self): env = DummyEnvironment - s = scons.Scanner.C.CScan() + s = SCons.Scanner.C.CScan() deps = s.scan(test.workpath('f3.cpp'), env) headers = ['f1.h', 'f2.h', 'f3.h', 'd1/f1.h', 'd1/f2.h', 'd1/f3.h'] self.failUnless(deps_match(deps, headers)) diff --git a/src/scons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index 9761cd0..9c7163d 100644 --- a/src/scons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -1,7 +1,7 @@ __revision__ = "Scanner/ScannerTests.py __REVISION__ __DATE__ __DEVELOPER__" import unittest -import scons.Scanner +import SCons.Scanner import sys class ScannerTestBase: @@ -36,7 +36,7 @@ class DummyEnvironment: class ScannerPositionalTestCase(ScannerTestBase, unittest.TestCase): "Test the Scanner class using the position argument" def runTest(self): - s = scons.Scanner.Scanner(self.func) + s = SCons.Scanner.Scanner(self.func) env = DummyEnvironment() env.VARIABLE = "var1" self.test(s, env, 'f1.cpp', ['f1.h', 'f1.hpp']) @@ -44,7 +44,7 @@ class ScannerPositionalTestCase(ScannerTestBase, unittest.TestCase): class ScannerKeywordTestCase(ScannerTestBase, unittest.TestCase): "Test the Scanner class using the keyword argument" def runTest(self): - s = scons.Scanner.Scanner(function = self.func) + s = SCons.Scanner.Scanner(function = self.func) env = DummyEnvironment() env.VARIABLE = "var2" self.test(s, env, 'f2.cpp', ['f2.h', 'f2.hpp']) @@ -53,7 +53,7 @@ class ScannerPositionalArgumentTestCase(ScannerTestBase, unittest.TestCase): "Test the Scanner class using the position argument and optional argument" def runTest(self): arg = "this is the argument" - s = scons.Scanner.Scanner(self.func, arg) + s = SCons.Scanner.Scanner(self.func, arg) env = DummyEnvironment() env.VARIABLE = "var3" self.test(s, env, 'f3.cpp', ['f3.h', 'f3.hpp'], arg) @@ -62,7 +62,7 @@ class ScannerKeywordArgumentTestCase(ScannerTestBase, unittest.TestCase): "Test the Scanner class using the keyword argument and optional argument" def runTest(self): arg = "this is another argument" - s = scons.Scanner.Scanner(function = self.func, argument = arg) + s = SCons.Scanner.Scanner(function = self.func, argument = arg) env = DummyEnvironment() env.VARIABLE = "var4" self.test(s, env, 'f4.cpp', ['f4.h', 'f4.hpp'], arg) diff --git a/src/scons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index 7ce602c..225c7f3 100644 --- a/src/scons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -1,6 +1,6 @@ -"""scons.Scanner +"""SCons.Scanner -The Scanner package for the scons software construction utility. +The Scanner package for the SCons software construction utility. """ diff --git a/src/scons/.aeignore b/src/engine/SCons/Sig/.aeignore index 43fe851..43fe851 100644 --- a/src/scons/.aeignore +++ b/src/engine/SCons/Sig/.aeignore diff --git a/src/scons/Sig/MD5.py b/src/engine/SCons/Sig/MD5.py index 36e4230..9d461d9 100644 --- a/src/scons/Sig/MD5.py +++ b/src/engine/SCons/Sig/MD5.py @@ -1,6 +1,6 @@ -"""scons.Sig.MD5 +"""SCons.Sig.MD5 -The MD5 signature package for the scons software construction +The MD5 signature package for the SCons software construction utility. """ @@ -16,7 +16,7 @@ def hexdigest(s): """Return a signature as a string of hex characters. """ # NOTE: This routine is a method in the Python 2.0 interface - # of the native md5 module, but we want scons to operate all + # of the native md5 module, but we want SCons to operate all # the way back to at least Python 1.5.2, which doesn't have it. h = string.hexdigits r = '' diff --git a/src/scons/Sig/MD5Tests.py b/src/engine/SCons/Sig/MD5Tests.py index efcec7f..ac67f1d 100644 --- a/src/scons/Sig/MD5Tests.py +++ b/src/engine/SCons/Sig/MD5Tests.py @@ -3,7 +3,7 @@ __revision__ = "Sig/MD5Tests.py __REVISION__ __DATE__ __DEVELOPER__" import sys import unittest -import scons.Sig.MD5 +import SCons.Sig.MD5 @@ -18,11 +18,11 @@ class my_obj: def signature(self): if not self.sig: - self.sig = scons.Sig.MD5.signature(self.value) + self.sig = SCons.Sig.MD5.signature(self.value) return self.sig def current(self, sig): - return scons.Sig.MD5.current(self, sig) + return SCons.Sig.MD5.current(self, sig) @@ -40,9 +40,9 @@ class MD5TestCase(unittest.TestCase): Simple comparison of different "signature" values. """ o111 = my_obj(value = '111') - assert not o111.current(scons.Sig.MD5.signature('110')) - assert o111.current(scons.Sig.MD5.signature('111')) - assert not o111.current(scons.Sig.MD5.signature('112')) + assert not o111.current(SCons.Sig.MD5.signature('110')) + assert o111.current(SCons.Sig.MD5.signature('111')) + assert not o111.current(SCons.Sig.MD5.signature('112')) def test_set(self): pass # XXX @@ -56,9 +56,9 @@ class MD5TestCase(unittest.TestCase): o1 = my_obj(value = '111') o2 = my_obj(value = '222') o3 = my_obj(value = '333') - assert '698d51a19d8a121ce581499d7b701668' == scons.Sig.MD5.collect(o1) - assert '8980c988edc2c78cc43ccb718c06efd5' == scons.Sig.MD5.collect(o1, o2) - assert '53fd88c84ff8a285eb6e0a687e55b8c7' == scons.Sig.MD5.collect(o1, o2, o3) + assert '698d51a19d8a121ce581499d7b701668' == SCons.Sig.MD5.collect(o1) + assert '8980c988edc2c78cc43ccb718c06efd5' == SCons.Sig.MD5.collect(o1, o2) + assert '53fd88c84ff8a285eb6e0a687e55b8c7' == SCons.Sig.MD5.collect(o1, o2, o3) def test_signature(self): pass # XXX diff --git a/src/scons/Sig/TimeStamp.py b/src/engine/SCons/Sig/TimeStamp.py index cab44bf..b821742 100644 --- a/src/scons/Sig/TimeStamp.py +++ b/src/engine/SCons/Sig/TimeStamp.py @@ -1,6 +1,6 @@ -"""scons.Sig.TimeStamp +"""SCons.Sig.TimeStamp -The TimeStamp signature package for the scons software construction +The TimeStamp signature package for the SCons software construction utility. """ diff --git a/src/scons/Sig/TimeStampTests.py b/src/engine/SCons/Sig/TimeStampTests.py index 4fb1920..4cc72e4 100644 --- a/src/scons/Sig/TimeStampTests.py +++ b/src/engine/SCons/Sig/TimeStampTests.py @@ -3,7 +3,7 @@ __revision__ = "Sig/TimeStampTests.py __REVISION__ __DATE__ __DEVELOPER__" import sys import unittest -import scons.Sig.TimeStamp +import SCons.Sig.TimeStamp @@ -37,9 +37,9 @@ class TimeStampTestCase(unittest.TestCase): Simple comparison of different timestamp values. """ o1 = my_obj(value = 111) - assert scons.Sig.TimeStamp.current(o1, 110) - assert scons.Sig.TimeStamp.current(o1, 111) - assert not scons.Sig.TimeStamp.current(o1, 112) + assert SCons.Sig.TimeStamp.current(o1, 110) + assert SCons.Sig.TimeStamp.current(o1, 111) + assert not SCons.Sig.TimeStamp.current(o1, 112) def test_set(self): pass # XXX @@ -54,9 +54,9 @@ class TimeStampTestCase(unittest.TestCase): o1 = my_obj(value = 111) o2 = my_obj(value = 222) o3 = my_obj(value = 333) - assert 111 == scons.Sig.TimeStamp.collect(o1) - assert 222 == scons.Sig.TimeStamp.collect(o1, o2) - assert 333 == scons.Sig.TimeStamp.collect(o1, o2, o3) + assert 111 == SCons.Sig.TimeStamp.collect(o1) + assert 222 == SCons.Sig.TimeStamp.collect(o1, o2) + assert 333 == SCons.Sig.TimeStamp.collect(o1, o2, o3) def test_signature(self): pass # XXX diff --git a/src/scons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index 411a94b..c3b06ed 100644 --- a/src/scons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -1,6 +1,6 @@ -"""scons.Sig +"""SCons.Sig -The Signature package for the scons software construction utility. +The Signature package for the SCons software construction utility. """ diff --git a/src/scons/__init__.py b/src/engine/SCons/__init__.py index 9e279c2..56c5fad 100644 --- a/src/scons/__init__.py +++ b/src/engine/SCons/__init__.py @@ -1,6 +1,6 @@ -"""scons +"""SCons -The main package for the scons software construction utility. +The main package for the SCons software construction utility. """ diff --git a/src/scons/exitfuncs.py b/src/engine/SCons/exitfuncs.py index e26a031..86d1990 100644 --- a/src/scons/exitfuncs.py +++ b/src/engine/SCons/exitfuncs.py @@ -1,6 +1,6 @@ -"""scons.exitfuncs +"""SCons.exitfuncs -Register functions which are executed when scons exits for any reason. +Register functions which are executed when SCons exits for any reason. """ diff --git a/src/engine/setup.py b/src/engine/setup.py new file mode 100644 index 0000000..10fbef5 --- /dev/null +++ b/src/engine/setup.py @@ -0,0 +1,16 @@ +__revision__ = "setup.py __REVISION__ __DATE__ __DEVELOPER__" + +from string import join, split + +from distutils.core import setup + +setup(name = "scons-pylib", + version = "__VERSION__", + description = "scons", + author = "Steven Knight", + author_email = "knight@baldmt.com", + url = "http://www.scons.org/", + packages = ["SCons", + "SCons.Node", + "SCons.Scanner", + "SCons.Sig"]) diff --git a/src/script/MANIFEST b/src/script/MANIFEST new file mode 100644 index 0000000..98e74a0 --- /dev/null +++ b/src/script/MANIFEST @@ -0,0 +1,3 @@ +MANIFEST +scons.py +setup.py diff --git a/src/scons.py b/src/script/scons.py index 78cfece..d433773 100644 --- a/src/scons.py +++ b/src/script/scons.py @@ -11,11 +11,16 @@ import string import sys import traceback -from scons.Node.FS import init, Dir, File, lookup -from scons.Environment import Environment -import scons.Job -from scons.Builder import Builder -from scons.Errors import * +import SCons.Node.FS +import SCons.Job +from SCons.Errors import * + +# +# Modules and classes that we don't use directly in this script, but +# which we want available for use in SConstruct and SConscript files. +# +from SCons.Environment import Environment +from SCons.Builder import Builder class Task: "XXX: this is here only until the build engine is implemented" @@ -361,7 +366,7 @@ def options_init(): help = "Don't build; list files and where defined.") def opt_n(opt, arg): - scons.Builder.execute_actions = None + SCons.Builder.execute_actions = None Option(func = opt_n, short = 'n', long = ['no-exec', 'just-print', 'dry-run', 'recon'], @@ -392,7 +397,7 @@ def options_init(): help = "Build dependencies in random order.") def opt_s(opt, arg): - scons.Builder.print_actions = None + SCons.Builder.print_actions = None Option(func = opt_s, short = 's', long = ['silent', 'quiet'], @@ -496,7 +501,7 @@ def main(): # XXX The commented-out code here adds any "scons" subdirs in anything # along sys.path to sys.path. This was an attempt at setting up things - # so we can import "node.FS" instead of "scons.Node.FS". This doesn't + # so we can import "node.FS" instead of "SCons.Node.FS". This doesn't # quite fit our testing methodology, though, so save it for now until # the right solutions pops up. # @@ -512,7 +517,7 @@ def main(): sys.path = include_dirs + sys.path # initialize node factory - init() + SCons.Node.FS.init() while Scripts: file, Scripts = Scripts[0], Scripts[1:] @@ -532,9 +537,11 @@ def main(): PrintUsage() sys.exit(0) - taskmaster = Taskmaster(map(lambda x: lookup(File, x), targets)) + taskmaster = Taskmaster(map( + lambda x: SCons.Node.FS.lookup(SCons.Node.FS.File, x), + targets)) - jobs = scons.Job.Jobs(num_jobs, taskmaster) + jobs = SCons.Job.Jobs(num_jobs, taskmaster) jobs.start() jobs.wait() diff --git a/src/setup.py b/src/script/setup.py index ad93cac..8732e3b 100644 --- a/src/setup.py +++ b/src/script/setup.py @@ -10,5 +10,4 @@ setup(name = "scons", author = "Steven Knight", author_email = "knight@baldmt.com", url = "http://www.baldmt.com/scons", - packages = ["scons"], scripts = ["scons.py"]) diff --git a/test/exitfns.py b/test/exitfns.py index a13dd9b..d9a1019 100644 --- a/test/exitfns.py +++ b/test/exitfns.py @@ -8,7 +8,7 @@ import TestSCons test = TestSCons.TestSCons(match = TestCmd.match_exact) sconstruct = """ -from scons.exitfuncs import * +from SCons.exitfuncs import * def x1(): print "running x1" |