import "f3.idl";
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring("IBarObject Interface"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring("IBarObject Interface"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
import <f3.idl>;
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
const char* x = \"#include <never.idl>\"
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
#include <fb.idl>
[
- object,
- uuid(22995106-CE26-4561-AF1B-C71C6934B840),
- dual,
- helpstring(\"IBarObject Interface\"),
- pointer_default(unique)
+ object,
+ uuid(22995106-CE26-4561-AF1B-C71C6934B840),
+ dual,
+ helpstring(\"IBarObject Interface\"),
+ pointer_default(unique)
]
interface IBarObject : IDispatch
{
class DummyEnvironment:
def __init__(self, listCppPath):
self.path = listCppPath
+ self.fs = SCons.Node.FS.FS(test.workpath(''))
def Dictionary(self, *args):
if not args:
else:
raise KeyError, "Dummy environment only has CPPPATH attribute."
- def subst(self, arg):
+ def subst(self, arg, target=None, source=None, conv=None):
return arg
- def subst_path(self, path, target=None):
- if type(path) != type([]):
+ def subst_path(self, path, target=None, source=None, conv=None):
+ if not isinstance(path, list):
path = [path]
- return map(self.subst, path)
+ return list(map(self.subst, path))
def has_key(self, key):
- return self.Dictionary().has_key(key)
+ return key in self.Dictionary()
def __getitem__(self,key):
return self.Dictionary()[key]
def get_calculator(self):
return None
+ def get_factory(self, factory):
+ return factory or self.fs.File
+
+ def Dir(self, filename):
+ return self.fs.Dir(filename)
+
+ def File(self, filename):
+ return self.fs.File(filename)
+
global my_normpath
my_normpath = os.path.normpath
my_normpath = os.path.normcase
def deps_match(self, deps, headers):
- scanned = map(my_normpath, map(str, deps))
- expect = map(my_normpath, headers)
+ scanned = list(map(my_normpath, list(map(str, deps))))
+ expect = list(map(my_normpath, headers))
self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
-def make_node(filename, fs=SCons.Node.FS.default_fs):
- return fs.File(test.workpath(filename))
-
# define some tests:
class IDLScannerTestCase1(unittest.TestCase):
env = DummyEnvironment([])
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(make_node('t1.idl'), env, path)
+ deps = s(env.File('t1.idl'), env, path)
headers = ['f1.idl', 'f3.idl', 'f2.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
class IDLScannerTestCase2(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1")])
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(make_node('t1.idl'), env, path)
+ deps = s(env.File('t1.idl'), env, path)
headers = ['f1.idl', 'f3.idl', 'd1/f2.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
class IDLScannerTestCase3(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1")])
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(make_node('t2.idl'), env, path)
+ deps = s(env.File('t2.idl'), env, path)
headers = ['d1/f1.idl', 'f1.idl', 'd1/d2/f1.idl', 'f3.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
class IDLScannerTestCase4(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1"), test.workpath("d1/d2")])
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(make_node('t2.idl'), env, path)
+ deps = s(env.File('t2.idl'), env, path)
headers = ['d1/f1.idl', 'f1.idl', 'd1/d2/f1.idl', 'f3.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
class IDLScannerTestCase5(unittest.TestCase):
def runTest(self):
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- n = make_node('t3.idl')
+ n = env.File('t3.idl')
def my_rexists(s=n):
s.rexists_called = 1
return s.old_rexists()
deps = s(n, env, path)
# Make sure rexists() got called on the file node being
- # scanned, essential for cooperation with BuildDir functionality.
+ # scanned, essential for cooperation with VariantDir functionality.
assert n.rexists_called
headers = ['d1/f1.idl', 'd1/f2.idl',
'f1.idl', 'f2.idl', 'f3-test.idl',
'd1/f1.idl', 'd1/f2.idl', 'd1/f3-test.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
class IDLScannerTestCase6(unittest.TestCase):
def runTest(self):
s = SCons.Scanner.IDL.IDLScan()
path1 = s.path(env1)
path2 = s.path(env2)
- deps1 = s(make_node('t1.idl'), env1, path1)
- deps2 = s(make_node('t1.idl'), env2, path2)
+ deps1 = s(env1.File('t1.idl'), env1, path1)
+ deps2 = s(env2.File('t1.idl'), env2, path2)
headers1 = ['f1.idl', 'f3.idl', 'd1/f2.idl']
headers2 = ['f1.idl', 'f3.idl', 'd1/d2/f2.idl']
- deps_match(self, deps1, map(test.workpath, headers1))
- deps_match(self, deps2, map(test.workpath, headers2))
+ deps_match(self, deps1, headers1)
+ deps_match(self, deps2, headers2)
class IDLScannerTestCase7(unittest.TestCase):
def runTest(self):
- fs = SCons.Node.FS.FS(test.workpath(''))
env = DummyEnvironment(["include"])
- s = SCons.Scanner.IDL.IDLScan(fs = fs)
+ s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps1 = s(fs.File('t4.idl'), env, path)
- fs.chdir(fs.Dir('subdir'))
- dir = fs.getcwd()
- fs.chdir(fs.Dir('..'))
+ deps1 = s(env.File('t4.idl'), env, path)
+ env.fs.chdir(env.Dir('subdir'))
+ dir = env.fs.getcwd()
+ env.fs.chdir(env.Dir(''))
path = s.path(env, dir)
- deps2 = s(fs.File('#t4.idl'), env, path)
- headers1 = ['include/fa.idl', 'include/fb.idl']
- headers2 = ['subdir/include/fa.idl', 'subdir/include/fb.idl']
+ deps2 = s(env.File('#t4.idl'), env, path)
+ headers1 = list(map(test.workpath, ['include/fa.idl', 'include/fb.idl']))
+ headers2 = ['include/fa.idl', 'include/fb.idl']
deps_match(self, deps1, headers1)
deps_match(self, deps2, headers2)
to.out = None
SCons.Warnings._warningOut = to
test.write('fa.idl','\n')
- fs = SCons.Node.FS.FS(test.workpath(''))
env = DummyEnvironment([])
- s = SCons.Scanner.IDL.IDLScan(fs=fs)
+ s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(fs.File('t4.idl'), env, path)
+ deps = s(env.File('t4.idl'), env, path)
# Did we catch the warning associated with not finding fb.idl?
assert to.out
class IDLScannerTestCase9(unittest.TestCase):
def runTest(self):
- fs = SCons.Node.FS.FS(test.workpath(''))
- fs.chdir(fs.Dir('include'))
env = DummyEnvironment([])
- s = SCons.Scanner.IDL.IDLScan(fs=fs)
+ env.fs.chdir(env.Dir('include'))
+ s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
test.write('include/t4.idl', test.read('t4.idl'))
- deps = s(fs.File('#include/t4.idl'), env, path)
- fs.chdir(fs.Dir('..'))
- deps_match(self, deps, [ 'include/fa.idl', 'include/fb.idl' ])
+ deps = s(env.File('#include/t4.idl'), env, path)
+ env.fs.chdir(env.Dir(''))
+ deps_match(self, deps, [ 'fa.idl', 'fb.idl' ])
test.unlink('include/t4.idl')
class IDLScannerTestCase10(unittest.TestCase):
# Create a derived file in a directory that does not exist yet.
# This was a bug at one time.
- f1=fs.File('include2/jjj.idl')
- f1.builder=1
env = DummyEnvironment(['include', 'include2'])
- s = SCons.Scanner.IDL.IDLScan(fs=fs)
+ env.fs = fs
+ f1 = fs.File('include2/jjj.idl')
+ f1.builder = 1
+ s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
deps = s(fs.File('src/fff.c'), env, path)
- deps_match(self, deps, [ test.workpath('repository/include/iii.idl'), 'include2/jjj.idl' ])
+ deps_match(self, deps, [ test.workpath('repository/include/iii.idl'),
+ 'include2/jjj.idl' ])
os.chdir(test.workpath(''))
class IDLScannerTestCase11(unittest.TestCase):
def runTest(self):
os.chdir(test.workpath('work'))
fs = SCons.Node.FS.FS(test.workpath('work'))
- fs.BuildDir('build1', 'src', 1)
- fs.BuildDir('build2', 'src', 0)
+ fs.VariantDir('build1', 'src', 1)
+ fs.VariantDir('build2', 'src', 0)
fs.Repository(test.workpath('repository'))
env = DummyEnvironment([])
- s = SCons.Scanner.IDL.IDLScan(fs = fs)
+ env.fs = fs
+ s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
deps1 = s(fs.File('build1/aaa.c'), env, path)
deps_match(self, deps1, [ 'build1/bbb.idl' ])
class IDLScannerTestCase12(unittest.TestCase):
def runTest(self):
class SubstEnvironment(DummyEnvironment):
- def subst(self, arg, test=test):
- return test.workpath("d1")
- env = SubstEnvironment(["blah"])
+ def subst(self, arg, target=None, source=None, conv=None, test=test):
+ if arg == "$blah":
+ return test.workpath("d1")
+ else:
+ return arg
+ env = SubstEnvironment(["$blah"])
s = SCons.Scanner.IDL.IDLScan()
path = s.path(env)
- deps = s(make_node('t1.idl'), env, path)
+ deps = s(env.File('t1.idl'), env, path)
headers = ['f1.idl', 'f3.idl', 'd1/f2.idl']
- deps_match(self, deps, map(test.workpath, headers))
+ deps_match(self, deps, headers)
def suite():
result = runner.run(suite())
if not result.wasSuccessful():
sys.exit(1)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: