summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-11-20 20:45:07 (GMT)
committerSteven Knight <knight@baldmt.com>2004-11-20 20:45:07 (GMT)
commit56e544ee9af35d1bf9fb599809dbb9a9f576a641 (patch)
tree5eab4d2afb17727557b623e8ec7a25b614322912
parent464833f9a7c83d5b5cc4483c294861a6c9a3fc7e (diff)
downloadSCons-56e544ee9af35d1bf9fb599809dbb9a9f576a641.zip
SCons-56e544ee9af35d1bf9fb599809dbb9a9f576a641.tar.gz
SCons-56e544ee9af35d1bf9fb599809dbb9a9f576a641.tar.bz2
Add more customizability: , , , .
-rw-r--r--doc/man/scons.126
-rw-r--r--etc/TestCmd.py6
-rw-r--r--etc/TestCommon.py56
-rw-r--r--src/CHANGES.txt13
-rw-r--r--src/engine/SCons/Node/FS.py6
-rw-r--r--src/engine/SCons/Tool/BitKeeper.py4
-rw-r--r--src/engine/SCons/Tool/CVS.py4
-rw-r--r--src/engine/SCons/Tool/RCS.py4
-rw-r--r--src/engine/SCons/Tool/SCCS.py4
-rw-r--r--src/engine/SCons/Tool/Subversion.py4
-rw-r--r--test/BitKeeper.py352
-rw-r--r--test/CVS.py304
-rw-r--r--test/RCS.py325
-rw-r--r--test/SCCS.py265
14 files changed, 108 insertions, 1265 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index 08887fa..23e646b 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -4506,7 +4506,13 @@ The BitKeeper executable.
.IP BITKEEPERCOM
The command line for
-fetching source files using BitKEeper.
+fetching source files using BitKeeper.
+
+.IP BITKEEPERCOMSTR
+The string displayed when fetching
+a source file using BitKeeper.
+If this is not set, then $BITKEEPERCOM
+(the command line) is displayed.
.IP BITKEEPERGET
The command ($BITKEEPER) and subcommand
@@ -4781,6 +4787,12 @@ Options that are passed to the CVS checkout subcommand.
The command line used to
fetch source files from a CVS repository.
+.IP CVSCOMSTR
+The string displayed when fetching
+a source file from a CVS repository.
+If this is not set, then $CVSCOM
+(the command line) is displayed.
+
.IP CVSFLAGS
General options that are passed to CVS.
By default, this is set to
@@ -6217,6 +6229,12 @@ used to fetch source files from RCS.
The command line used to
fetch (checkout) source files from RCS.
+.IP RCS_COCOMSTR
+The string displayed when fetching
+a source file from RCS.
+If this is not set, then $RCS_COCOM
+(the command line) is displayed.
+
.IP RCS_COFLAGS
Options that are passed to the $RCS_CO command.
@@ -6299,6 +6317,12 @@ The SCCS executable.
The command line used to
fetch source files from SCCS.
+.IP SCCSCOMSTR
+The string displayed when fetching
+a source file from a CVS repository.
+If this is not set, then $SCCSCOM
+(the command line) is displayed.
+
.IP SCCSFLAGS
General options that are passed to SCCS.
diff --git a/etc/TestCmd.py b/etc/TestCmd.py
index b90e653..e12aa4c 100644
--- a/etc/TestCmd.py
+++ b/etc/TestCmd.py
@@ -158,7 +158,7 @@ version.
TestCmd.where_is('foo', 'PATH1;PATH2', '.suffix3;.suffix4')
"""
-# Copyright 2000, 2001, 2002, 2003 Steven Knight
+# Copyright 2000, 2001, 2002, 2003, 2004 Steven Knight
# This module is free software, and you may redistribute it and/or modify
# it under the same terms as Python itself, so long as this copyright message
# and disclaimer are retained in their original form.
@@ -175,8 +175,8 @@ version.
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.12.D001 2004/10/21 14:00:53 knight"
-__version__ = "0.12"
+__revision__ = "TestCmd.py 0.13.D002 2004/11/20 08:34:16 knight"
+__version__ = "0.13"
import os
import os.path
diff --git a/etc/TestCommon.py b/etc/TestCommon.py
index 8ef9b3d..ae57f0c 100644
--- a/etc/TestCommon.py
+++ b/etc/TestCommon.py
@@ -32,12 +32,16 @@ TestCommon object; see the TestCmd documentation for details.
Here is an overview of the methods and keyword arguments that are
provided by the TestCommon class:
+ test.must_be_writable('file1', ['file2', ...])
+
test.must_contain('file', 'required text\n')
test.must_exist('file1', ['file2', ...])
test.must_match('file', "expected contents\n")
+ test.must_not_be_writable('file1', ['file2', ...])
+
test.must_not_exist('file1', ['file2', ...])
test.run(options = "options to be prepended to arguments",
@@ -76,11 +80,12 @@ The TestCommon module also provides the following variables
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCommon.py 0.12.D001 2004/10/21 14:00:53 knight"
-__version__ = "0.12"
+__revision__ = "TestCommon.py 0.13.D001 2004/11/20 08:30:40 knight"
+__version__ = "0.13"
import os
import os.path
+import stat
import string
import sys
import types
@@ -145,6 +150,20 @@ def is_List(e):
return type(e) is types.ListType \
or isinstance(e, UserList.UserList)
+def is_writable(f):
+ mode = os.stat(f)[stat.ST_MODE]
+ return mode & stat.S_IWUSR
+
+def separate_files(flist):
+ existing = []
+ missing = []
+ for f in flist:
+ if os.path.exists(f):
+ existing.append(f)
+ else:
+ missing.append(f)
+ return existing, missing
+
class TestFailed(Exception):
def __init__(self, args=None):
self.args = args
@@ -193,6 +212,22 @@ class TestCommon(TestCmd):
apply(TestCmd.__init__, [self], kw)
os.chdir(self.workdir)
+ def must_be_writable(self, *files):
+ """Ensures that the specified file(s) exist and are writable.
+ An individual file can be specified as a list of directory names,
+ in which case the pathname will be constructed by concatenating
+ them. Exits FAILED if any of the files does not exist or is
+ not writable.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ existing, missing = separate_files(files)
+ unwritable = filter(lambda x, iw=is_writable: not iw(x), existing)
+ if missing:
+ print "Missing files: `%s'" % string.join(missing, "', `")
+ if unwritable:
+ print "Unwritable files: `%s'" % string.join(unwritable, "', `")
+ self.fail_test(missing + unwritable)
+
def must_contain(self, file, required, mode = 'rb'):
"""Ensures that the specified file contains the required text.
"""
@@ -247,6 +282,23 @@ class TestCommon(TestCmd):
print "Unexpected files exist: `%s'" % string.join(existing, "', `")
self.fail_test(existing)
+
+ def must_not_be_writable(self, *files):
+ """Ensures that the specified file(s) exist and are not writable.
+ An individual file can be specified as a list of directory names,
+ in which case the pathname will be constructed by concatenating
+ them. Exits FAILED if any of the files does not exist or is
+ writable.
+ """
+ files = map(lambda x: is_List(x) and apply(os.path.join, x) or x, files)
+ existing, missing = separate_files(files)
+ writable = filter(is_writable, existing)
+ if missing:
+ print "Missing files: `%s'" % string.join(missing, "', `")
+ if writable:
+ print "Writable files: `%s'" % string.join(writable, "', `")
+ self.fail_test(missing + writable)
+
def run(self, options = None, arguments = None,
stdout = None, stderr = '', status = 0, **kw):
"""Runs the program under test, checking that the test succeeded.
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 80f4ed7..2159249 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -130,12 +130,13 @@ RELEASE 0.97 - XXX
- Fix expansion of env.Command() overrides within target and
source file names.
- - Support easier customization of what's displayed by various
- default actions by adding new construction variables: $ARCOMSTR,
- $ASCOMSTR, $ASPPCOMSTR, $CCCOMSTR, $CXXCOMSTR, $F77COMSTR,
- $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $LEXCOMSTR, $LINKCOMSTR,
- $SHCCCOMSTR, $SHCXXCOMSTR, $SHF77COMSTR, $SHF90COMSTR, $SHF95COMSTR,
- $SHFORTRANCOMSTR, $SHLINKCOMSTR and $YACCCOMSTR.
+ - Support easier customization of what's displayed by various default
+ actions by adding new construction variables: $ARCOMSTR, $ASCOMSTR,
+ $ASPPCOMSTR, $BITKEEPERCOMSTR, $CCCOMSTR, $CVSCOMSTR, $CXXCOMSTR,
+ $F77COMSTR, $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $LEXCOMSTR,
+ $LINKCOMSTR, $RCSCOMSTR, $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR,
+ $SHF77COMSTR, $SHF90COMSTR, $SHF95COMSTR, $SHFORTRANCOMSTR,
+ $SHLINKCOMSTR and $YACCCOMSTR.
From Wayne Lee:
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 541e42a..c5d10bc 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -263,7 +263,8 @@ def get_DefaultSCCSBuilder():
import SCons.Builder
# "env" will get filled in by Executor.get_build_env()
# calling SCons.Defaults.DefaultEnvironment() when necessary.
- DefaultSCCSBuilder = SCons.Builder.Builder(action = '$SCCSCOM',
+ act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR')
+ DefaultSCCSBuilder = SCons.Builder.Builder(action = act,
env = None,
name = "DefaultSCCSBuilder")
return DefaultSCCSBuilder
@@ -274,7 +275,8 @@ def get_DefaultRCSBuilder():
import SCons.Builder
# "env" will get filled in by Executor.get_build_env()
# calling SCons.Defaults.DefaultEnvironment() when necessary.
- DefaultRCSBuilder = SCons.Builder.Builder(action = '$RCS_COCOM',
+ act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR')
+ DefaultRCSBuilder = SCons.Builder.Builder(action = act,
env = None,
name = "DefaultRCSBuilder")
return DefaultRCSBuilder
diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py
index c4c1940..2c2bfdd 100644
--- a/src/engine/SCons/Tool/BitKeeper.py
+++ b/src/engine/SCons/Tool/BitKeeper.py
@@ -36,6 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import SCons.Action
import SCons.Builder
import SCons.Util
@@ -45,7 +46,8 @@ def generate(env):
def BitKeeperFactory(env=env):
""" """
- return SCons.Builder.Builder(action = "$BITKEEPERCOM", env = env)
+ act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR")
+ return SCons.Builder.Builder(action = act, env = env)
#setattr(env, 'BitKeeper', BitKeeperFactory)
env.BitKeeper = BitKeeperFactory
diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py
index 3822b3b..bc18615 100644
--- a/src/engine/SCons/Tool/CVS.py
+++ b/src/engine/SCons/Tool/CVS.py
@@ -33,6 +33,7 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Builder
import SCons.Util
@@ -48,7 +49,8 @@ def generate(env):
# be across a network and must use POSIX slashes as separators.
module = module + '/'
env['CVSCOM'] = '$CVS $CVSFLAGS co $CVSCOFLAGS -d ${TARGET.dir} $CVSMODULE${TARGET.posix}'
- return SCons.Builder.Builder(action = '$CVSCOM',
+ act = SCons.Action.Action('$CVSCOM', '$CVSCOMSTR')
+ return SCons.Builder.Builder(action = act,
env = env,
CVSREPOSITORY = repos,
CVSMODULE = module)
diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py
index ce7ba3a..9cc20f5 100644
--- a/src/engine/SCons/Tool/RCS.py
+++ b/src/engine/SCons/Tool/RCS.py
@@ -33,6 +33,7 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Builder
import SCons.Util
@@ -42,7 +43,8 @@ def generate(env):
def RCSFactory(env=env):
""" """
- return SCons.Builder.Builder(action = '$RCS_COCOM', env = env)
+ act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR')
+ return SCons.Builder.Builder(action = act, env = env)
#setattr(env, 'RCS', RCSFactory)
env.RCS = RCSFactory
diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py
index d15b49f..a9a595d 100644
--- a/src/engine/SCons/Tool/SCCS.py
+++ b/src/engine/SCons/Tool/SCCS.py
@@ -33,6 +33,7 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.Action
import SCons.Builder
import SCons.Util
@@ -42,7 +43,8 @@ def generate(env):
def SCCSFactory(env=env):
""" """
- return SCons.Builder.Builder(action = '$SCCSCOM', env = env)
+ act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR')
+ return SCons.Builder.Builder(action = act, env = env)
#setattr(env, 'SCCS', SCCSFactory)
env.SCCS = SCCSFactory
diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py
index 23dbd97..4bb37f7 100644
--- a/src/engine/SCons/Tool/Subversion.py
+++ b/src/engine/SCons/Tool/Subversion.py
@@ -35,6 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import SCons.Action
import SCons.Builder
import SCons.Util
@@ -47,7 +48,8 @@ def generate(env):
# fail if repos is not an absolute path name?
if module != '':
module = os.path.join(module, '')
- return SCons.Builder.Builder(action = '$SVNCOM',
+ act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR')
+ return SCons.Builder.Builder(action = act,
env = env,
SVNREPOSITORY = repos,
SVNMODULE = module)
diff --git a/test/BitKeeper.py b/test/BitKeeper.py
deleted file mode 100644
index 73cd47f..0000000
--- a/test/BitKeeper.py
+++ /dev/null
@@ -1,352 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# 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.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Test fetching source files from BitKeeper.
-"""
-
-import os
-import stat
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-bk = test.where_is('bk')
-if not bk:
- print "Could not find BitKeeper, skipping test(s)."
- test.pass_test(1)
-
-def is_writable(file):
- mode = os.stat(file)[stat.ST_MODE]
- return mode & stat.S_IWUSR
-
-try:
- login = os.getlogin()
-except (AttributeError, OSError):
- try:
- login = os.environ['USER']
- except KeyError:
- login = 'USER'
-
-host = os.uname()[1]
-
-email = "%s@%s" % (login, host)
-
-test.subdir('BK', 'import', ['import', 'sub'])
-
-# Test using BitKeeper to fetch from SCCS/s.file files.
-sccs = test.where_is('sccs')
-if not sccs:
- print "Could not find SCCS, skipping sub-test of BitKeeper using SCCS files."
-else:
- test.subdir('work1',
- ['work1', 'SCCS'],
- ['work1', 'sub'],
- ['work1', 'sub', 'SCCS'])
-
- for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work1', file], "work1/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work1', program = sccs, arguments = args, stderr = None)
- test.unlink(['work1', file])
- test.unlink(['work1', ','+file])
-
- test.write(['work1', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
- args = "create SConscript"
- test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
- test.unlink(['work1', 'sub', 'SConscript'])
- test.unlink(['work1', 'sub', ',SConscript'])
-
- for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work1', 'sub', file], "work1/sub/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
- test.unlink(['work1', 'sub', file])
- test.unlink(['work1', 'sub', ','+file])
-
- test.write(['work1', 'SConstruct'], """
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)},
- BITKEEPERGETFLAGS='-e')
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.BitKeeper())
-SConscript('sub/SConscript', "env")
-""")
-
- test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n")
-
- test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n")
-
- test.run(chdir = 'work1',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-bk get -e sub/SConscript
-""",
- build_str = """\
-bk get -e aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-bk get -e ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-bk get -e sub/ddd.in
-cat(["sub/ddd.out"], ["sub/ddd.in"])
-cat(["sub/eee.out"], ["sub/eee.in"])
-bk get -e sub/fff.in
-cat(["sub/fff.out"], ["sub/fff.in"])
-cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""),
- stderr = """\
-sub/SConscript 1.1 -> 1.2: 5 lines
-aaa.in 1.1 -> 1.2: 1 lines
-ccc.in 1.1 -> 1.2: 1 lines
-sub/ddd.in 1.1 -> 1.2: 1 lines
-sub/fff.in 1.1 -> 1.2: 1 lines
-""")
-
- test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n")
-
- test.fail_test(not is_writable(test.workpath('work1', 'sub', 'SConscript')))
- test.fail_test(not is_writable(test.workpath('work1', 'aaa.in')))
- test.fail_test(not is_writable(test.workpath('work1', 'ccc.in')))
- test.fail_test(not is_writable(test.workpath('work1', 'sub', 'ddd.in')))
- test.fail_test(not is_writable(test.workpath('work1', 'sub', 'fff.in')))
-
-# Test using BitKeeper to fetch from RCS/file,v files.
-rcs = test.where_is('rcs')
-ci = test.where_is('ci')
-if not rcs:
- print "Could not find RCS,\nskipping sub-test of BitKeeper using RCS files."
-elif not ci:
- print "Could not find the RCS ci command,\nskipping sub-test of BitKeeper using RCS files."
-else:
- test.subdir('work2',
- ['work2', 'RCS'],
- ['work2', 'sub'],
- ['work2', 'sub', 'RCS'])
-
- for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work2', file], "work2/%s\n" % file)
- args = "-f -t%s %s" % (file, file)
- test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
- test.write(['work2', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
- args = "-f -tsub/SConscript sub/SConscript"
- test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
- for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work2', 'sub', file], "work2/sub/%s\n" % file)
- args = "-f -tsub/%s sub/%s" % (file, file)
- test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
- test.no_result(os.path.exists(test.workpath('work2', 'aaa.in')))
- test.no_result(os.path.exists(test.workpath('work2', 'bbb.in')))
- test.no_result(os.path.exists(test.workpath('work2', 'ccc.in')))
-
- test.no_result(os.path.exists(test.workpath('work2', 'sub', 'SConscript')))
-
- test.no_result(os.path.exists(test.workpath('work2', 'sub', 'ddd.in')))
- test.no_result(os.path.exists(test.workpath('work2', 'sub', 'eee.in')))
- test.no_result(os.path.exists(test.workpath('work2', 'sub', 'fff.in')))
-
- test.write(['work2', 'SConstruct'], """\
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)},
- BITKEEPERGET='$BITKEEPER co',
- BITKEEPERGETFLAGS='-q')
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.BitKeeper())
-SConscript('sub/SConscript', "env")
-""")
-
- test.write(['work2', 'bbb.in'], "checked-out work2/bbb.in\n")
-
- test.write(['work2', 'sub', 'eee.in'], "checked-out work2/sub/eee.in\n")
-
- test.run(chdir = 'work2',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-bk co -q sub/SConscript
-""",
- build_str = """\
-bk co -q aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-bk co -q ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-bk co -q sub/ddd.in
-cat(["sub/ddd.out"], ["sub/ddd.in"])
-cat(["sub/eee.out"], ["sub/eee.in"])
-bk co -q sub/fff.in
-cat(["sub/fff.out"], ["sub/fff.in"])
-cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""))
-
- test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n")
-
- test.must_match(['work2', 'sub', 'all'], "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n")
-
- test.fail_test(is_writable(test.workpath('work2', 'sub', 'SConscript')))
- test.fail_test(is_writable(test.workpath('work2', 'aaa.in')))
- test.fail_test(is_writable(test.workpath('work2', 'ccc.in')))
- test.fail_test(is_writable(test.workpath('work2', 'sub', 'ddd.in')))
- test.fail_test(is_writable(test.workpath('work2', 'sub', 'fff.in')))
-
-# Set up a "pure" BitKeeper hierarchy.
-# BitKeeper's licensing restrictions require a configuration file that
-# specifies you're not using it multi-user. This seems to be the
-# minimal configuration that satisfies these requirements.
-test.write('bk.conf', """\
-description:test project 'foo'
-logging:none
-email:%s
-single_user:%s
-single_host:%s
-""" % (email, login, host))
-
-# Plus, we need to set the external environment variable that gets it to
-# shut up and not prompt us to accept the license.
-os.environ['BK_LICENSE'] = 'ACCEPTED'
-
-test.write(['import', 'aaa.in'], "import/aaa.in\n")
-test.write(['import', 'bbb.in'], "import/bbb.in\n")
-test.write(['import', 'ccc.in'], "import/ccc.in\n")
-
-test.write(['import', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-
-test.write(['import', 'sub', 'ddd.in'], "import/sub/ddd.in\n")
-test.write(['import', 'sub', 'eee.in'], "import/sub/eee.in\n")
-test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
-
-# Test transparent source file checkouts using BitKeeper, by overriding
-# the 'SCCS' construction variable in the default Environment.
-work3 = test.workpath('work3')
-
-test.run(program = bk,
- arguments = 'setup -f -c bk.conf work3')
-
-test.run(chdir = 'import',
- program = bk,
- arguments = 'import -q -f -tplain . %s' % test.workpath('work3'))
-
-test.write(['work3', 'SConstruct'], """
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-DefaultEnvironment(tools=['SCCS'])['SCCS'] = r'%s'
-env = Environment(BUILDERS={'Cat':Builder(action=cat)})
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-SConscript('sub/SConscript', "env")
-""" % bk)
-
-test.write(['work3', 'bbb.in'], "work3/bbb.in\n")
-
-test.subdir(['work3', 'sub'])
-test.write(['work3', 'sub', 'eee.in'], "work3/sub/eee.in\n")
-
-test.run(chdir = 'work3',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-%s get sub/SConscript
-""" % bk,
- build_str = """\
-%s get aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-%s get ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-%s get sub/ddd.in
-cat(["sub/ddd.out"], ["sub/ddd.in"])
-cat(["sub/eee.out"], ["sub/eee.in"])
-%s get sub/fff.in
-cat(["sub/fff.out"], ["sub/fff.in"])
-cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-""" % (bk, bk, bk, bk)),
- stderr = """\
-sub/SConscript 1.1: 5 lines
-aaa.in 1.1: 1 lines
-ccc.in 1.1: 1 lines
-sub/ddd.in 1.1: 1 lines
-sub/fff.in 1.1: 1 lines
-""")
-
-test.must_match(['work3', 'all'], "import/aaa.in\nwork3/bbb.in\nimport/ccc.in\n")
-
-test.must_match(['work3', 'sub', 'all'], "import/sub/ddd.in\nwork3/sub/eee.in\nimport/sub/fff.in\n")
-
-test.fail_test(is_writable(test.workpath('work3', 'sub', 'SConscript')))
-test.fail_test(is_writable(test.workpath('work3', 'aaa.in')))
-test.fail_test(is_writable(test.workpath('work3', 'ccc.in')))
-test.fail_test(is_writable(test.workpath('work3', 'sub', 'ddd.in')))
-test.fail_test(is_writable(test.workpath('work3', 'sub', 'fff.in')))
-
-test.pass_test()
diff --git a/test/CVS.py b/test/CVS.py
deleted file mode 100644
index 59384c9..0000000
--- a/test/CVS.py
+++ /dev/null
@@ -1,304 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# 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.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Test fetching source files from CVS.
-"""
-
-import os
-import os.path
-import stat
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-cvs = test.where_is('cvs')
-if not cvs:
- print "Could not find CVS, skipping test(s)."
- test.pass_test(1)
-
-def is_writable(file):
- mode = os.stat(file)[stat.ST_MODE]
- return mode & stat.S_IWUSR
-
-test.subdir('CVS', 'import', ['import', 'sub'], 'work1', 'work2')
-
-foo_aaa_in = os.path.join('foo', 'aaa.in')
-foo_bbb_in = os.path.join('foo', 'bbb.in')
-foo_ccc_in = os.path.join('foo', 'ccc.in')
-foo_sub_ddd_in = os.path.join('foo', 'sub', 'ddd.in')
-foo_sub_ddd_out = os.path.join('foo', 'sub', 'ddd.out')
-foo_sub_eee_in = os.path.join('foo', 'sub', 'eee.in')
-foo_sub_eee_out = os.path.join('foo', 'sub', 'eee.out')
-foo_sub_fff_in = os.path.join('foo', 'sub', 'fff.in')
-foo_sub_fff_out = os.path.join('foo', 'sub', 'fff.out')
-foo_sub_all = os.path.join('foo', 'sub', 'all')
-
-sub_SConscript = os.path.join('sub', 'SConscript')
-sub_ddd_in = os.path.join('sub', 'ddd.in')
-sub_ddd_out = os.path.join('sub', 'ddd.out')
-sub_eee_in = os.path.join('sub', 'eee.in')
-sub_eee_out = os.path.join('sub', 'eee.out')
-sub_fff_in = os.path.join('sub', 'fff.in')
-sub_fff_out = os.path.join('sub', 'fff.out')
-sub_all = os.path.join('sub', 'all')
-
-# Set up the CVS repository.
-cvsroot = test.workpath('CVS')
-
-os.environ['CVSROOT'] = cvsroot
-test.run(program = cvs, arguments = 'init')
-
-test.write(['import', 'aaa.in'], "import/aaa.in\n")
-test.write(['import', 'bbb.in'], "import/bbb.in\n")
-test.write(['import', 'ccc.in'], "import/ccc.in\n")
-
-test.write(['import', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-
-test.write(['import', 'sub', 'ddd.in'], "import/sub/ddd.in\n")
-test.write(['import', 'sub', 'eee.in'], "import/sub/eee.in\n")
-test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
-
-test.run(chdir = 'import',
- program = cvs,
- arguments = '-q import -m import foo v v-r')
-
-# Test the most straightforward CVS checkouts, using the module name.
-test.write(['work1', 'SConstruct'], """
-import os
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
- BUILDERS={'Cat':Builder(action=cat)})
-env.Prepend(CVSFLAGS='-Q')
-env.Cat('aaa.out', 'foo/aaa.in')
-env.Cat('bbb.out', 'foo/bbb.in')
-env.Cat('ccc.out', 'foo/ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.CVS(r'%(cvsroot)s'))
-SConscript('foo/sub/SConscript', "env")
-""" % locals())
-
-test.subdir(['work1', 'foo'])
-test.write(['work1', 'foo', 'bbb.in'], "work1/foo/bbb.in\n")
-
-test.subdir(['work1', 'foo', 'sub',])
-test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n")
-
-test.run(chdir = 'work1',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-cvs -Q -d %(cvsroot)s co foo/sub/SConscript
-""" % locals(),
- build_str = """\
-cvs -Q -d %(cvsroot)s co foo/aaa.in
-cat(["aaa.out"], ["%(foo_aaa_in)s"])
-cat(["bbb.out"], ["%(foo_bbb_in)s"])
-cvs -Q -d %(cvsroot)s co foo/ccc.in
-cat(["ccc.out"], ["%(foo_ccc_in)s"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-cvs -Q -d %(cvsroot)s co foo/sub/ddd.in
-cat(["%(foo_sub_ddd_out)s"], ["%(foo_sub_ddd_in)s"])
-cat(["%(foo_sub_eee_out)s"], ["%(foo_sub_eee_in)s"])
-cvs -Q -d %(cvsroot)s co foo/sub/fff.in
-cat(["%(foo_sub_fff_out)s"], ["%(foo_sub_fff_in)s"])
-cat(["%(foo_sub_all)s"], ["%(foo_sub_ddd_out)s", "%(foo_sub_eee_out)s", "%(foo_sub_fff_out)s"])
-""" % locals()))
-
-# Checking things back out of CVS apparently messes with the line
-# endings, so read the result files in non-binary mode.
-
-test.must_match(['work1', 'all'],
- "import/aaa.in\nwork1/foo/bbb.in\nimport/ccc.in\n",
- mode='r')
-
-test.must_match(['work1', 'foo', 'sub', 'all'],
- "import/sub/ddd.in\nwork1/foo/sub/eee.in\nimport/sub/fff.in\n",
- mode='r')
-
-test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'SConscript')))
-test.fail_test(not is_writable(test.workpath('work1', 'foo', 'aaa.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'foo', 'ccc.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'ddd.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'fff.in')))
-
-# Test CVS checkouts when the module name is specified.
-test.write(['work2', 'SConstruct'], """
-import os
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
- BUILDERS={'Cat':Builder(action=cat)})
-env.Prepend(CVSFLAGS='-q')
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.CVS(r'%(cvsroot)s', 'foo'))
-SConscript('sub/SConscript', "env")
-""" % locals())
-
-test.write(['work2', 'bbb.in'], "work2/bbb.in\n")
-
-test.subdir(['work2', 'sub'])
-test.write(['work2', 'sub', 'eee.in'], "work2/sub/eee.in\n")
-
-test.run(chdir = 'work2',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-cvs -q -d %(cvsroot)s co -d sub foo/sub/SConscript
-U sub/SConscript
-""" % locals(),
- build_str = """\
-cvs -q -d %(cvsroot)s co -d . foo/aaa.in
-U ./aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-cvs -q -d %(cvsroot)s co -d . foo/ccc.in
-U ./ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-cvs -q -d %(cvsroot)s co -d sub foo/sub/ddd.in
-U sub/ddd.in
-cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
-cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
-cvs -q -d %(cvsroot)s co -d sub foo/sub/fff.in
-U sub/fff.in
-cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
-cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
-""" % locals()))
-
-# Checking things back out of CVS apparently messes with the line
-# endings, so read the result files in non-binary mode.
-
-test.must_match(['work2', 'all'],
- "import/aaa.in\nwork2/bbb.in\nimport/ccc.in\n",
- mode='r')
-
-test.must_match(['work2', 'sub', 'all'],
- "import/sub/ddd.in\nwork2/sub/eee.in\nimport/sub/fff.in\n",
- mode='r')
-
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'SConscript')))
-test.fail_test(not is_writable(test.workpath('work2', 'aaa.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'ccc.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'ddd.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in')))
-
-# Test checking out specific file name(s), and expanding
-# the repository name with a variable.
-test.subdir(['work3'])
-
-test.write(['work3', 'SConstruct'], """\
-import os
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(ENV = { 'PATH' : os.environ['PATH'] },
- BUILDERS={'Cat':Builder(action=cat)},
- CVSROOT=r'%s')
-env.Prepend(CVSFLAGS='-q')
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-cvs = env.CVS('$CVSROOT', 'foo')
-#env.SourceCode('.', cvs)
-env.SourceCode('aaa.in', cvs)
-env.SourceCode('bbb.in', cvs)
-env.SourceCode('ccc.in', cvs)
-""" % cvsroot)
-
-test.run(chdir = 'work3',
- arguments = '.',
- stdout = test.wrap_stdout(build_str = """\
-cvs -q -d %(cvsroot)s co -d . foo/aaa.in
-U ./aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cvs -q -d %(cvsroot)s co -d . foo/bbb.in
-U ./bbb.in
-cat(["bbb.out"], ["bbb.in"])
-cvs -q -d %(cvsroot)s co -d . foo/ccc.in
-U ./ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-""" % locals()))
-
-test.must_match(['work3', 'aaa.out'],
- "import/aaa.in\n",
- mode='r')
-test.must_match(['work3', 'bbb.out'],
- "import/bbb.in\n",
- mode='r')
-test.must_match(['work3', 'ccc.out'],
- "import/ccc.in\n",
- mode='r')
-test.must_match(['work3', 'all'],
- "import/aaa.in\nimport/bbb.in\nimport/ccc.in\n",
- mode='r')
-
-# Test CVS checkouts from a remote server (Tigris.org).
-test.subdir(['work4'])
-
-test.write(['work4', 'SConstruct'], """\
-import os
-env = Environment(ENV = { 'PATH' : os.environ['PATH'] })
-# We used to use the SourceForge server, but SourceForge has restrictions
-# that make them deny access on occasion. Leave the incantation here
-# in case we need to use it again some day.
-#cvs = env.CVS(':pserver:anonymous@cvs.sourceforge.net:/cvsroot/scons')
-cvs = env.CVS(':pserver:anoncvs@cvs.tigris.org:/cvs')
-env.SourceCode('.', cvs)
-env.Install('install', 'scons/SConstruct')
-""")
-
-test.run(chdir = 'work4', arguments = '.')
-
-test.must_exist(test.workpath('work4', 'install', 'SConstruct'))
-
-
-test.pass_test()
diff --git a/test/RCS.py b/test/RCS.py
deleted file mode 100644
index 50d353f..0000000
--- a/test/RCS.py
+++ /dev/null
@@ -1,325 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# 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.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Test fetching source files from RCS.
-"""
-
-import os.path
-import stat
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-rcs = test.where_is('rcs')
-if not rcs:
- print "Could not find RCS, skipping test(s)."
- test.pass_test(1)
-
-ci = test.where_is('ci')
-if not ci:
- print "Could not find `ci' command, skipping test(s)."
- test.pass_test(1)
-
-def is_writable(file):
- mode = os.stat(file)[stat.ST_MODE]
- return mode & stat.S_IWUSR
-
-
-
-# Test explicit checkouts from local RCS files.
-test.subdir('work1', ['work1', 'sub'])
-
-sub_RCS = os.path.join('sub', 'RCS')
-sub_SConscript = os.path.join('sub', 'SConscript')
-sub_all = os.path.join('sub', 'all')
-sub_ddd_in = os.path.join('sub', 'ddd.in')
-sub_ddd_out = os.path.join('sub', 'ddd.out')
-sub_eee_in = os.path.join('sub', 'eee.in')
-sub_eee_out = os.path.join('sub', 'eee.out')
-sub_fff_in = os.path.join('sub', 'fff.in')
-sub_fff_out = os.path.join('sub', 'fff.out')
-
-for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work1', file], "work1/%s\n" % file)
- args = "-f -t%s %s" % (file, file)
- test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
-
-test.write(['work1', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-args = "-f -tsub/SConscript sub/SConscript"
-test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
-
-for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work1', 'sub', file], "work1/sub/%s\n" % file)
- args = "-f -tsub/%s sub/%s" % (file, file)
- test.run(chdir = 'work1', program = ci, arguments = args, stderr = None)
-
-test.no_result(os.path.exists(test.workpath('work1', 'aaa.in')))
-test.no_result(os.path.exists(test.workpath('work1', 'bbb.in')))
-test.no_result(os.path.exists(test.workpath('work1', 'ccc.in')))
-
-test.no_result(os.path.exists(test.workpath('work1', 'sub', 'SConscript')))
-
-test.no_result(os.path.exists(test.workpath('work1', 'sub', 'ddd.in')))
-test.no_result(os.path.exists(test.workpath('work1', 'sub', 'eee.in')))
-test.no_result(os.path.exists(test.workpath('work1', 'sub', 'fff.in')))
-
-test.write(['work1', 'SConstruct'], """
-import os
-for key in ['LOGNAME', 'USERNAME', 'USER']:
- logname = os.environ.get(key)
- if logname: break
-ENV = {'PATH' : os.environ['PATH'],
- 'LOGNAME' : logname}
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(ENV=ENV,
- BUILDERS={'Cat':Builder(action=cat)},
- RCS_COFLAGS='-q')
-DefaultEnvironment()['ENV'] = ENV
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.RCS())
-SConscript('sub/SConscript', "env")
-""")
-
-test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n")
-
-test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n")
-
-test.run(chdir = 'work1',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-co -q %(sub_SConscript)s
-""" % locals(),
- build_str = """\
-co -q aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-co -q ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-co -q %(sub_ddd_in)s
-cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
-cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
-co -q %(sub_fff_in)s
-cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
-cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
-""" % locals()))
-
-# Checking things back out of RCS apparently messes with the line
-# endings, so read the result files in non-binary mode.
-
-test.must_match(['work1', 'all'],
- "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n",
- mode='r')
-
-test.must_match(['work1', 'sub', 'all'],
- "work1/sub/ddd.in\nchecked-out work1/sub/eee.in\nwork1/sub/fff.in\n",
- mode='r')
-
-test.fail_test(is_writable(test.workpath('work1', 'sub', 'SConscript')))
-test.fail_test(is_writable(test.workpath('work1', 'aaa.in')))
-test.fail_test(is_writable(test.workpath('work1', 'ccc.in')))
-test.fail_test(is_writable(test.workpath('work1', 'sub', 'ddd.in')))
-test.fail_test(is_writable(test.workpath('work1', 'sub', 'fff.in')))
-
-
-
-# Test transparent RCS checkouts from an RCS subdirectory.
-test.subdir('work2', ['work2', 'RCS'],
- ['work2', 'sub'], ['work2', 'sub', 'RCS'])
-
-for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work2', file], "work2/%s\n" % file)
- args = "-f -t%s %s" % (file, file)
- test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
-for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work2', 'sub', file], "work2/sub/%s\n" % file)
- args = "-f -tsub/%s sub/%s" % (file, file)
- test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
-test.write(['work2', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-args = "-f -tsub/SConscript sub/SConscript"
-test.run(chdir = 'work2', program = ci, arguments = args, stderr = None)
-
-test.no_result(os.path.exists(test.workpath('work2', 'aaa.in')))
-test.no_result(os.path.exists(test.workpath('work2', 'bbb.in')))
-test.no_result(os.path.exists(test.workpath('work2', 'ccc.in')))
-
-test.no_result(os.path.exists(test.workpath('work2', 'sub', 'SConscript')))
-
-test.no_result(os.path.exists(test.workpath('work2', 'sub', 'aaa.in')))
-test.no_result(os.path.exists(test.workpath('work2', 'sub', 'bbb.in')))
-test.no_result(os.path.exists(test.workpath('work2', 'sub', 'ccc.in')))
-
-test.write(['work2', 'SConstruct'], """
-import os
-for key in ['LOGNAME', 'USERNAME', 'USER']:
- logname = os.environ.get(key)
- if logname: break
-ENV = {'PATH' : os.environ['PATH'],
- 'LOGNAME' : logname}
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-DefaultEnvironment()['ENV'] = ENV
-DefaultEnvironment()['RCS_COFLAGS'] = '-l'
-env = Environment(ENV=ENV, BUILDERS={'Cat':Builder(action=cat)})
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-SConscript('sub/SConscript', "env")
-""")
-
-test.write(['work2', 'bbb.in'], "checked-out work2/bbb.in\n")
-
-test.write(['work2', 'sub', 'eee.in'], "checked-out work2/sub/eee.in\n")
-
-test.run(chdir = 'work2',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-co -l %(sub_SConscript)s
-""" % locals(),
- build_str = """\
-co -l aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-co -l ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-co -l %(sub_ddd_in)s
-cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
-cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
-co -l %(sub_fff_in)s
-cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
-cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
-""" % locals()),
- stderr = """\
-%(sub_RCS)s/SConscript,v --> %(sub_SConscript)s
-revision 1.1 (locked)
-done
-RCS/aaa.in,v --> aaa.in
-revision 1.1 (locked)
-done
-RCS/ccc.in,v --> ccc.in
-revision 1.1 (locked)
-done
-%(sub_RCS)s/ddd.in,v --> %(sub_ddd_in)s
-revision 1.1 (locked)
-done
-%(sub_RCS)s/fff.in,v --> %(sub_fff_in)s
-revision 1.1 (locked)
-done
-""" % locals())
-
-# Checking things back out of RCS apparently messes with the line
-# endings, so read the result files in non-binary mode.
-
-test.must_match(['work2', 'all'],
- "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n",
- mode='r')
-
-test.must_match(['work2', 'sub', 'all'],
- "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n",
- mode='r')
-
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'SConscript')))
-test.fail_test(not is_writable(test.workpath('work2', 'aaa.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'ccc.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'ddd.in')))
-test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in')))
-
-
-
-# Test transparent RCS checkouts of implicit dependencies.
-test.subdir('work3', ['work3', 'RCS'])
-
-test.write(['work3', 'foo.c'], """\
-#include "foo.h"
-int
-main(int argc, char *argv[]) {
- printf(STR);
- printf("work3/foo.c\\n");
-}
-""")
-test.run(chdir = 'work3',
- program = ci,
- arguments = "-f -tfoo.c foo.c",
- stderr = None)
-
-test.write(['work3', 'foo.h'], """\
-#define STR "work3/foo.h\\n"
-""")
-test.run(chdir = 'work3',
- program = ci,
- arguments = "-f -tfoo.h foo.h",
- stderr = None)
-
-test.write(['work3', 'SConstruct'], """
-env = Environment()
-env.Program('foo.c')
-""")
-
-test.run(chdir='work3', stderr="""\
-RCS/foo.c,v --> foo.c
-revision 1.1
-done
-RCS/foo.h,v --> foo.h
-revision 1.1
-done
-""")
-
-
-
-#
-test.pass_test()
diff --git a/test/SCCS.py b/test/SCCS.py
deleted file mode 100644
index 52ee0db..0000000
--- a/test/SCCS.py
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# 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.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-"""
-Test fetching source files from SCCS.
-"""
-
-import os
-import stat
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-sccs = test.where_is('sccs')
-if not sccs:
- print "Could not find SCCS, skipping test(s)."
- test.pass_test(1)
-
-def is_writable(file):
- mode = os.stat(file)[stat.ST_MODE]
- return mode & stat.S_IWUSR
-
-
-
-# Test explicit checkouts from local SCCS files.
-test.subdir('work1', ['work1', 'sub'])
-
-for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work1', file], "work1/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work1', program = sccs, arguments = args, stderr = None)
- test.unlink(['work1', file])
- test.unlink(['work1', ','+file])
-
-test.write(['work1', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-args = "create SConscript"
-test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
-test.unlink(['work1', 'sub', 'SConscript'])
-test.unlink(['work1', 'sub', ',SConscript'])
-
-for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work1', 'sub', file], "work1/sub/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None)
- test.unlink(['work1', 'sub', file])
- test.unlink(['work1', 'sub', ','+file])
-
-test.write(['work1', 'SConstruct'], """
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)},
- SCCSGETFLAGS='-e')
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-env.SourceCode('.', env.SCCS())
-SConscript('sub/SConscript', "env")
-""")
-
-test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n")
-
-test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n")
-
-test.run(chdir = 'work1',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-sccs get -e sub/SConscript
-""",
- build_str = """\
-sccs get -e aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-sccs get -e ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-sccs get -e sub/ddd.in
-cat(["sub/ddd.out"], ["sub/ddd.in"])
-cat(["sub/eee.out"], ["sub/eee.in"])
-sccs get -e sub/fff.in
-cat(["sub/fff.out"], ["sub/fff.in"])
-cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""),
- stderr = """\
-sub/SConscript 1.1 -> 1.2: 5 lines
-aaa.in 1.1 -> 1.2: 1 lines
-ccc.in 1.1 -> 1.2: 1 lines
-sub/ddd.in 1.1 -> 1.2: 1 lines
-sub/fff.in 1.1 -> 1.2: 1 lines
-""")
-
-test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n")
-
-test.fail_test(not is_writable(test.workpath('work1', 'sub', 'SConscript')))
-test.fail_test(not is_writable(test.workpath('work1', 'aaa.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'ccc.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'sub', 'ddd.in')))
-test.fail_test(not is_writable(test.workpath('work1', 'sub', 'fff.in')))
-
-
-
-# Test transparent checkouts from SCCS files in an SCCS subdirectory.
-test.subdir('work2', ['work2', 'SCCS'],
- ['work2', 'sub'], ['work2', 'sub', 'SCCS'])
-
-for file in ['aaa.in', 'bbb.in', 'ccc.in']:
- test.write(['work2', file], "work2/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work2', program = sccs, arguments = args, stderr = None)
- test.unlink(['work2', file])
- test.unlink(['work2', ','+file])
-
-test.write(['work2', 'sub', 'SConscript'], """\
-Import("env")
-env.Cat('ddd.out', 'ddd.in')
-env.Cat('eee.out', 'eee.in')
-env.Cat('fff.out', 'fff.in')
-env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
-""")
-args = "create SConscript"
-test.run(chdir = 'work2/sub', program = sccs, arguments = args, stderr = None)
-test.unlink(['work2', 'sub', 'SConscript'])
-test.unlink(['work2', 'sub', ',SConscript'])
-
-for file in ['ddd.in', 'eee.in', 'fff.in']:
- test.write(['work2', 'sub', file], "work2/sub/%s\n" % file)
- args = "create %s" % file
- test.run(chdir = 'work2/sub', program = sccs, arguments = args, stderr = None)
- test.unlink(['work2', 'sub', file])
- test.unlink(['work2', 'sub', ','+file])
-
-test.write(['work2', 'SConstruct'], """
-def cat(env, source, target):
- target = str(target[0])
- source = map(str, source)
- f = open(target, "wb")
- for src in source:
- f.write(open(src, "rb").read())
- f.close()
-env = Environment(BUILDERS={'Cat':Builder(action=cat)})
-env.Cat('aaa.out', 'aaa.in')
-env.Cat('bbb.out', 'bbb.in')
-env.Cat('ccc.out', 'ccc.in')
-env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
-SConscript('sub/SConscript', "env")
-""")
-
-test.write(['work2', 'bbb.in'], "checked-out work2/bbb.in\n")
-
-test.write(['work2', 'sub', 'eee.in'], "checked-out work2/sub/eee.in\n")
-
-test.run(chdir = 'work2',
- arguments = '.',
- stdout = test.wrap_stdout(read_str = """\
-sccs get sub/SConscript
-""",
- build_str = """\
-sccs get aaa.in
-cat(["aaa.out"], ["aaa.in"])
-cat(["bbb.out"], ["bbb.in"])
-sccs get ccc.in
-cat(["ccc.out"], ["ccc.in"])
-cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
-sccs get sub/ddd.in
-cat(["sub/ddd.out"], ["sub/ddd.in"])
-cat(["sub/eee.out"], ["sub/eee.in"])
-sccs get sub/fff.in
-cat(["sub/fff.out"], ["sub/fff.in"])
-cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-"""),
- stderr = """\
-sub/SConscript 1.1: 5 lines
-aaa.in 1.1: 1 lines
-ccc.in 1.1: 1 lines
-sub/ddd.in 1.1: 1 lines
-sub/fff.in 1.1: 1 lines
-""")
-
-test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n")
-
-test.fail_test(is_writable(test.workpath('work2', 'sub', 'SConscript')))
-test.fail_test(is_writable(test.workpath('work2', 'aaa.in')))
-test.fail_test(is_writable(test.workpath('work2', 'ccc.in')))
-test.fail_test(is_writable(test.workpath('work2', 'sub', 'ddd.in')))
-test.fail_test(is_writable(test.workpath('work2', 'sub', 'fff.in')))
-
-
-
-
-# Test transparent SCCS checkouts of implicit dependencies.
-test.subdir('work3', ['work3', 'SCCS'])
-
-test.write(['work3', 'foo.c'], """\
-#include "foo.h"
-int
-main(int argc, char *argv[]) {
- printf(STR);
- printf("work3/foo.c\\n");
-}
-""")
-test.run(chdir = 'work3',
- program = sccs,
- arguments = "create foo.c",
- stderr = None)
-test.unlink(['work3', 'foo.c'])
-test.unlink(['work3', ',foo.c'])
-
-test.write(['work3', 'foo.h'], """\
-#define STR "work3/foo.h\\n"
-""")
-test.run(chdir = 'work3',
- program = sccs,
- arguments = "create foo.h",
- stderr = None)
-test.unlink(['work3', 'foo.h'])
-test.unlink(['work3', ',foo.h'])
-
-test.write(['work3', 'SConstruct'], """
-env = Environment()
-env.Program('foo.c')
-""")
-
-test.run(chdir='work3', stderr = """\
-foo.c 1.1: 6 lines
-foo.h 1.1: 1 lines
-""")
-
-
-
-test.pass_test()