summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2024-11-08 15:13:26 (GMT)
committerMats Wichmann <mats@linux.com>2024-12-15 20:43:39 (GMT)
commit9d5e76a42341596583924470feebcc637fcb8ac8 (patch)
treeec8d32faffd339e89d56194c7abc247d652b91b4 /test
parent8e216dae1c61f4303117e59cba7bf1f3a7d1049c (diff)
downloadSCons-9d5e76a42341596583924470feebcc637fcb8ac8.zip
SCons-9d5e76a42341596583924470feebcc637fcb8ac8.tar.gz
SCons-9d5e76a42341596583924470feebcc637fcb8ac8.tar.bz2
Modernize stat usage
Since Python 2.2, the object returned by an os.stat() call presents attributes matching the 10-tuple of stat values. Use these instead of indexing into the tuple. As usual for non-removed tests, minor tweaks made if needed - copyright header and DefautlEnvironment() call for performance. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r--test/Actions/append.py2
-rw-r--r--test/Actions/pre-post.py4
-rw-r--r--test/Chmod.py77
-rw-r--r--test/Decider/MD5-timestamp-Repository.py2
-rw-r--r--test/Decider/MD5-timestamp.py2
-rw-r--r--test/Decider/timestamp.py4
-rw-r--r--test/Removed/BuildDir/Old/BuildDir.py6
-rw-r--r--test/Removed/BuildDir/Old/SConscript-build_dir.py22
-rw-r--r--test/VariantDir/SConscript-variant_dir.py13
-rw-r--r--test/VariantDir/VariantDir.py10
-rw-r--r--test/VariantDir/errors.py13
-rw-r--r--test/ZIP/ZIP.py6
-rw-r--r--test/option/option--duplicate.py4
13 files changed, 83 insertions, 82 deletions
diff --git a/test/Actions/append.py b/test/Actions/append.py
index 01a9f23..8205e1b 100644
--- a/test/Actions/append.py
+++ b/test/Actions/append.py
@@ -63,7 +63,7 @@ after_exe = test.workpath('after' + _exe)
test.run(arguments='.')
test.must_match('before.txt', 'Bar\n')
-os.chmod(after_exe, os.stat(after_exe)[stat.ST_MODE] | stat.S_IXUSR)
+os.chmod(after_exe, os.stat(after_exe).st_mode | stat.S_IXUSR)
test.run(program=after_exe, stdout="Foo\n")
test.pass_test()
diff --git a/test/Actions/pre-post.py b/test/Actions/pre-post.py
index ac6a96f..0d9f36f 100644
--- a/test/Actions/pre-post.py
+++ b/test/Actions/pre-post.py
@@ -50,7 +50,7 @@ def before(env, target, source):
a=str(target[0])
with open(a, "wb") as f:
f.write(b"Foo\\n")
- os.chmod(a, os.stat(a)[stat.ST_MODE] | stat.S_IXUSR)
+ os.chmod(a, os.stat(a).st_mode | stat.S_IXUSR)
with open("before.txt", "ab") as f:
f.write((os.path.splitext(str(target[0]))[0] + "\\n").encode())
@@ -59,7 +59,7 @@ def after(env, target, source):
a = "after_" + t
with open(t, "rb") as fin, open(a, "wb") as fout:
fout.write(fin.read())
- os.chmod(a, os.stat(a)[stat.ST_MODE] | stat.S_IXUSR)
+ os.chmod(a, os.stat(a).st_mode | stat.S_IXUSR)
foo = env.Program(source='foo.c', target='foo')
AddPreAction(foo, before)
diff --git a/test/Chmod.py b/test/Chmod.py
index 7af95b4..87e7b15 100644
--- a/test/Chmod.py
+++ b/test/Chmod.py
@@ -51,6 +51,7 @@ def cat(env, source, target):
f.write(infp.read())
Cat = Action(cat)
+DefaultEnvironment(tools=[]) # test speedup
env = Environment()
env.Command(
'bar.out',
@@ -154,92 +155,92 @@ cat(["f8.out"], ["f8.in"])
""")
test.run(options = '-n', arguments = '.', stdout = expect)
-s = stat.S_IMODE(os.stat(test.workpath('f1'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f1')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f1-File'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f1-File')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('d2'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d2')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('d2-Dir'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d2-Dir')).st_mode)
test.fail_test(s != 0o555)
test.must_not_exist('bar.out')
-s = stat.S_IMODE(os.stat(test.workpath('f3'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f3')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('d4'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d4')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('f5'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f5')).st_mode)
test.fail_test(s != 0o444)
test.must_not_exist('f6.out')
test.must_not_exist('f7.out')
-s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod')).st_mode)
test.fail_test(s != 0o444)
test.must_not_exist('f8.out')
-s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f9')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f10')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d11')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d12')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('f13'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f13')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f14'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f14')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f15'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f15')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('d16'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d16')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('d17'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d17')).st_mode)
test.fail_test(s != 0o555)
-s = stat.S_IMODE(os.stat(test.workpath('d18'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d18')).st_mode)
test.fail_test(s != 0o555)
test.run()
-s = stat.S_IMODE(os.stat(test.workpath('f1'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f1')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('f1-File'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f1-File')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('d2'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d2')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('d2-Dir'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d2-Dir')).st_mode)
test.fail_test(s != 0o777)
test.must_match('bar.out', "bar.in\n")
-s = stat.S_IMODE(os.stat(test.workpath('f3'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f3')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('d4'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d4')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('f5'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f5')).st_mode)
test.fail_test(s != 0o666)
test.must_match('f6.out', "f6.in\n")
test.must_match('f7.out', "f7.in\n")
-s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('Chmod-f7.in')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f7.out-Chmod')).st_mode)
test.fail_test(s != 0o666)
test.must_match('f8.out', "f8.in\n")
-s = stat.S_IMODE(os.stat(test.workpath('f9'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f9')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('f10'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f10')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('d11'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d11')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('d12'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d12')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('f13'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f13')).st_mode)
test.fail_test(s != 0o444)
-s = stat.S_IMODE(os.stat(test.workpath('f14'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f14')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('f15'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('f15')).st_mode)
test.fail_test(s != 0o666)
-s = stat.S_IMODE(os.stat(test.workpath('d16'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d16')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('d17'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d17')).st_mode)
test.fail_test(s != 0o777)
-s = stat.S_IMODE(os.stat(test.workpath('d18'))[stat.ST_MODE])
+s = stat.S_IMODE(os.stat(test.workpath('d18')).st_mode)
test.fail_test(s != 0o777)
test.pass_test()
diff --git a/test/Decider/MD5-timestamp-Repository.py b/test/Decider/MD5-timestamp-Repository.py
index 201bdfe..35e24f4 100644
--- a/test/Decider/MD5-timestamp-Repository.py
+++ b/test/Decider/MD5-timestamp-Repository.py
@@ -58,7 +58,7 @@ test.up_to_date(chdir='work',arguments='.')
test.sleep() # delay for timestamps
test.write(['Repository','content1.in'], "content1.in 2\n")
test.touch(['Repository','content2.in'])
-time_content = os.stat(os.path.join(repository,'content3.in'))[stat.ST_MTIME]
+time_content = os.stat(os.path.join(repository,'content3.in')).st_mtime
test.write(['Repository','content3.in'], "content3.in 2\n")
test.touch(['Repository','content3.in'], time_content)
diff --git a/test/Decider/MD5-timestamp.py b/test/Decider/MD5-timestamp.py
index 3815639..b898840 100644
--- a/test/Decider/MD5-timestamp.py
+++ b/test/Decider/MD5-timestamp.py
@@ -54,7 +54,7 @@ test.sleep() # delay for timestamps
test.write('content1.in', "content1.in 2\n")
test.touch('content2.in')
-time_content = os.stat('content3.in')[stat.ST_MTIME]
+time_content = os.stat('content3.in').st_mtime
test.write('content3.in', "content3.in 2\n")
test.touch('content3.in', time_content)
diff --git a/test/Decider/timestamp.py b/test/Decider/timestamp.py
index d713a62..1fcb9e7 100644
--- a/test/Decider/timestamp.py
+++ b/test/Decider/timestamp.py
@@ -55,8 +55,8 @@ test.write('newer2.in', "newer2.in\n")
test.run(arguments = '.')
test.up_to_date(arguments = '.')
-time_match = os.stat('match2.out')[stat.ST_MTIME]
-time_newer = os.stat('newer2.out')[stat.ST_MTIME]
+time_match = os.stat('match2.out').st_mtime
+time_newer = os.stat('newer2.out').st_mtime
# Now make all the source files newer than (different timestamps from)
# the last time the targets were built, and touch the target files
diff --git a/test/Removed/BuildDir/Old/BuildDir.py b/test/Removed/BuildDir/Old/BuildDir.py
index 1a1ba02..7463f21 100644
--- a/test/Removed/BuildDir/Old/BuildDir.py
+++ b/test/Removed/BuildDir/Old/BuildDir.py
@@ -224,8 +224,8 @@ import stat
def equal_stats(x,y):
x = os.stat(x)
y = os.stat(y)
- return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and
- x[stat.ST_MTIME] == y[stat.ST_MTIME])
+ return (stat.S_IMODE(x.st_mode) == stat.S_IMODE(y.st_mode) and
+ x.st_mtime == y.st_mtime)
# Make sure we did duplicate the source files in build/var2,
# and that their stats are the same:
@@ -233,7 +233,7 @@ test.must_exist(['work1', 'build', 'var2', 'f1.c'])
test.must_exist(['work1', 'build', 'var2', 'f2.in'])
test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f1.c'), test.workpath('work1', 'src', 'f1.c')))
test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f2.in'), test.workpath('work1', 'src', 'f2.in')))
-
+
# Make sure we didn't duplicate the source files in build/var3.
test.must_not_exist(['work1', 'build', 'var3', 'f1.c'])
test.must_not_exist(['work1', 'build', 'var3', 'f2.in'])
diff --git a/test/Removed/BuildDir/Old/SConscript-build_dir.py b/test/Removed/BuildDir/Old/SConscript-build_dir.py
index 0d1ba6a..ed52037 100644
--- a/test/Removed/BuildDir/Old/SConscript-build_dir.py
+++ b/test/Removed/BuildDir/Old/SConscript-build_dir.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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__"
"""
Verify that specifying a build_dir argument to SConscript still works.
@@ -108,7 +107,7 @@ env.SConscript('src/SConscript', build_dir='../$BUILD/var8', duplicate=0)
# VariantDir('build/var9', '.')
# SConscript('build/var9/src/SConscript')
SConscript('src/SConscript', build_dir='build/var9', src_dir='.')
-""")
+""")
test.subdir(['test', 'src'], ['test', 'alt'])
@@ -152,8 +151,8 @@ import stat
def equal_stats(x,y):
x = os.stat(x)
y = os.stat(y)
- return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and
- x[stat.ST_MTIME] == y[stat.ST_MTIME])
+ return (stat.S_IMODE(x.st_mode) == stat.S_IMODE(y.st_mode) and
+ x.st_mtime == y.st_mtime)
# Make sure we did duplicate the source files in build/var1,
# and that their stats are the same:
@@ -168,12 +167,12 @@ for file in ['aaa.in', 'bbb.in', 'ccc.in']:
test.must_exist(test.workpath('test', 'build', 'var2', file))
test.fail_test(not equal_stats(test.workpath('test', 'build', 'var2', file),
test.workpath('test', 'src', file)))
-
+
# Make sure we didn't duplicate the source files in build/var3.
test.must_not_exist(test.workpath('test', 'build', 'var3', 'aaa.in'))
test.must_not_exist(test.workpath('test', 'build', 'var3', 'bbb.in'))
test.must_not_exist(test.workpath('test', 'build', 'var3', 'ccc.in'))
-
+
#XXX We can't support var4 and var5 yet, because our VariantDir linkage
#XXX is to an entire source directory. We haven't yet generalized our
#XXX infrastructure to be able to take the SConscript file from one source
@@ -200,12 +199,12 @@ for file in ['aaa.in', 'bbb.in', 'ccc.in']:
test.must_exist(test.workpath('build', 'var6', file))
test.fail_test(not equal_stats(test.workpath('build', 'var6', file),
test.workpath('test', 'src', file)))
-
+
# Make sure we didn't duplicate the source files in build/var7.
test.must_not_exist(test.workpath('build', 'var7', 'aaa.in'))
test.must_not_exist(test.workpath('build', 'var7', 'bbb.in'))
test.must_not_exist(test.workpath('build', 'var7', 'ccc.in'))
-
+
# Make sure we didn't duplicate the source files in build/var8.
test.must_not_exist(test.workpath('build', 'var8', 'aaa.in'))
test.must_not_exist(test.workpath('build', 'var8', 'bbb.in'))
@@ -219,6 +218,7 @@ SConscript('SConscript', build_dir='Build', src_dir='.', duplicate=0)
""")
test.write(['test2', 'SConscript'], """\
+DefaultEnvironment(tools=[]) # test speedup
env = Environment()
foo_obj = env.Object('foo.c')
env.Program('foo', [foo_obj, 'bar.c'])
diff --git a/test/VariantDir/SConscript-variant_dir.py b/test/VariantDir/SConscript-variant_dir.py
index 1e28c47..43c3638 100644
--- a/test/VariantDir/SConscript-variant_dir.py
+++ b/test/VariantDir/SConscript-variant_dir.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# 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__"
"""
Verify that specifying a variant_dir argument to SConscript works properly.
@@ -64,6 +63,7 @@ def cat(env, source, target):
with open(str(src), "rb") as ifp:
ofp.write(ifp.read())
+DefaultEnvironment(tools=[]) # test speedup
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
BUILD='build')
@@ -138,8 +138,8 @@ import stat
def equal_stats(x,y):
x = os.stat(x)
y = os.stat(y)
- return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and
- x[stat.ST_MTIME] == y[stat.ST_MTIME])
+ return (stat.S_IMODE(x.st_mode) == stat.S_IMODE(y.st_mode) and
+ x.st_mtime == y.st_mtime)
# Make sure we did duplicate the source files in build/var1,
# and that their stats are the same:
@@ -205,6 +205,7 @@ SConscript('SConscript', variant_dir='Build', src_dir='.', duplicate=0)
""")
test.write(['test2', 'SConscript'], """\
+DefaultEnvironment(tools=[]) # test speedup
env = Environment()
foo_obj = env.Object('foo.c')
env.Program('foo', [foo_obj, 'bar.c'])
diff --git a/test/VariantDir/VariantDir.py b/test/VariantDir/VariantDir.py
index bd329d8..a173b86 100644
--- a/test/VariantDir/VariantDir.py
+++ b/test/VariantDir/VariantDir.py
@@ -119,7 +119,7 @@ except:
if fortran and env.Detect(fortran):
if sys.platform =='win32':
- env_prog = Environment(tools=['mingw'],
+ env_prog = Environment(tools=['mingw'],
# BUILD = env['BUILD'], SRC = ENV['src'],
CPPPATH=env['CPPPATH'], FORTRANPATH=env['FORTRANPATH'] )
else:
@@ -276,8 +276,8 @@ import stat
def equal_stats(x,y):
x = os.stat(x)
y = os.stat(y)
- return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and
- x[stat.ST_MTIME] == y[stat.ST_MTIME])
+ return (stat.S_IMODE(x.st_mode) == stat.S_IMODE(y.st_mode) and
+ x.st_mtime == y.st_mtime)
# Make sure we did duplicate the source files in build/var2,
# and that their stats are the same:
@@ -285,7 +285,7 @@ test.must_exist(['work1', 'build', 'var2', 'f1.c'])
test.must_exist(['work1', 'build', 'var2', 'f2.in'])
test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f1.c'), test.workpath('work1', 'src', 'f1.c')))
test.fail_test(not equal_stats(test.workpath('work1', 'build', 'var2', 'f2.in'), test.workpath('work1', 'src', 'f2.in')))
-
+
# Make sure we didn't duplicate the source files in build/var3.
test.must_not_exist(['work1', 'build', 'var3', 'f1.c'])
test.must_not_exist(['work1', 'build', 'var3', 'f2.in'])
@@ -381,7 +381,7 @@ scons: `.' is up to date.
test.write( ['work3', 'SConstruct'], """\
SConscriptChdir(0)
-VariantDir('build', '.', duplicate=1 )
+VariantDir('build', '.', duplicate=1 )
SConscript( 'build/SConscript' )
""")
diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py
index 1ff3be3..7400056 100644
--- a/test/VariantDir/errors.py
+++ b/test/VariantDir/errors.py
@@ -65,6 +65,7 @@ def cat(env, source, target):
with open(str(src), "r") as f2:
f.write(f2.read())
+DefaultEnvironment(tools=[]) # test speedup
env = Environment(BUILDERS={'Build':Builder(action=cat)},
SCANNERS=[Scanner(fake_scan, skeys = ['.in'])])
@@ -88,7 +89,7 @@ test.must_match(['normal', 'build', 'file.out'], "normal/src/file.in\n", mode='r
if sys.platform != 'win32':
dir = os.path.join('ro-dir', 'build')
test.subdir(dir)
- os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR)
+ os.chmod(dir, os.stat(dir).st_mode & ~stat.S_IWUSR)
test.run(chdir = 'ro-dir',
arguments = ".",
@@ -103,16 +104,16 @@ dir = os.path.join('ro-SConscript', 'build')
test.subdir(dir)
SConscript = test.workpath(dir, 'SConscript')
test.write(SConscript, '')
-os.chmod(SConscript, os.stat(SConscript)[stat.ST_MODE] & ~stat.S_IWUSR)
+os.chmod(SConscript, os.stat(SConscript).st_mode & ~stat.S_IWUSR)
with open(SConscript, 'r'):
- os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR)
+ os.chmod(dir, os.stat(dir).st_mode & ~stat.S_IWUSR)
test.run(chdir = 'ro-SConscript',
arguments = ".",
status = 2,
stderr = "scons: *** Cannot duplicate `%s' in `build': Permission denied. Stop.\n" % os.path.join('src', 'SConscript'))
- os.chmod('ro-SConscript', os.stat('ro-SConscript')[stat.ST_MODE] | stat.S_IWUSR)
+ os.chmod('ro-SConscript', os.stat('ro-SConscript').st_mode | stat.S_IWUSR)
test.run(chdir = 'ro-SConscript',
arguments = ".",
@@ -130,9 +131,9 @@ test.subdir(dir)
test.write([dir, 'SConscript'], '')
file_in = test.workpath(dir, 'file.in')
test.write(file_in, '')
-os.chmod(file_in, os.stat(file_in)[stat.ST_MODE] & ~stat.S_IWUSR)
+os.chmod(file_in, os.stat(file_in).st_mode & ~stat.S_IWUSR)
with open(file_in, 'r'):
- os.chmod(dir, os.stat(dir)[stat.ST_MODE] & ~stat.S_IWUSR)
+ os.chmod(dir, os.stat(dir).st_mode & ~stat.S_IWUSR)
test.run(chdir = 'ro-src',
arguments = ".",
diff --git a/test/ZIP/ZIP.py b/test/ZIP/ZIP.py
index 09115fe..69f524e 100644
--- a/test/ZIP/ZIP.py
+++ b/test/ZIP/ZIP.py
@@ -118,9 +118,9 @@ test.fail_test(test.zipfile_files("f2.zip") != ['file13', 'file14', 'file15'])
test.fail_test(test.zipfile_files("f3.xyzzy") != ['file16', 'file17', 'file18'])
-f4_size = os.stat('f4.zip')[stat.ST_SIZE]
-f4stored_size = os.stat('f4stored.zip')[stat.ST_SIZE]
-f4deflated_size = os.stat('f4deflated.zip')[stat.ST_SIZE]
+f4_size = os.stat('f4.zip').st_size
+f4stored_size = os.stat('f4stored.zip').st_size
+f4deflated_size = os.stat('f4deflated.zip').st_size
test.fail_test(f4_size != f4deflated_size)
test.fail_test(f4stored_size == f4deflated_size)
diff --git a/test/option/option--duplicate.py b/test/option/option--duplicate.py
index 74de64b..927de86 100644
--- a/test/option/option--duplicate.py
+++ b/test/option/option--duplicate.py
@@ -28,8 +28,6 @@ This tests the --duplicate command line option, and the duplicate
SConscript settable option.
"""
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
import os
import sys
import stat
@@ -85,7 +83,7 @@ description = {
}
def testLink(file, type):
- nl = os.stat(file)[stat.ST_NLINK]
+ nl = os.stat(file).st_nlink
islink = os.path.islink(file)
assert criterion[type](nl, islink), \
"Expected %s to be %s (nl %d, islink %d)" \