summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Scanner
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r--src/engine/SCons/Scanner/C.py4
-rw-r--r--src/engine/SCons/Scanner/CTests.py20
-rw-r--r--src/engine/SCons/Scanner/D.py6
-rw-r--r--src/engine/SCons/Scanner/DTests.py16
-rw-r--r--src/engine/SCons/Scanner/Dir.py4
-rw-r--r--src/engine/SCons/Scanner/DirTests.py13
-rw-r--r--src/engine/SCons/Scanner/Fortran.py42
-rw-r--r--src/engine/SCons/Scanner/FortranTests.py141
-rw-r--r--src/engine/SCons/Scanner/IDL.py4
-rw-r--r--src/engine/SCons/Scanner/IDLTests.py12
-rw-r--r--src/engine/SCons/Scanner/LaTeX.py36
-rw-r--r--src/engine/SCons/Scanner/LaTeXTests.py37
-rw-r--r--src/engine/SCons/Scanner/Prog.py4
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py7
-rw-r--r--src/engine/SCons/Scanner/RC.py10
-rw-r--r--src/engine/SCons/Scanner/RCTests.py9
-rw-r--r--src/engine/SCons/Scanner/SWIG.py6
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py62
-rw-r--r--src/engine/SCons/Scanner/__init__.py6
-rw-r--r--src/engine/SCons/Scanner/__init__.xml2
20 files changed, 215 insertions, 226 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index 6cdab4a..206de5f 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -5,7 +5,7 @@ This module implements the dependency scanner for C/C++ code.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -27,7 +27,7 @@ This module implements the dependency scanner for C/C++ code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/C.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/C.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Node.FS
import SCons.Scanner
diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py
index f7b2b16..8e1e3b3 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/CTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/CTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.compat
@@ -48,7 +48,7 @@ test.write('f1.cpp',"""
#include \"f1.h\"
#include <f2.h>
-int main()
+int main(void)
{
return 0;
}
@@ -60,7 +60,7 @@ test.write('f2.cpp',"""
#include \"f1.h\"
#import <f4.h>
-int main()
+int main(void)
{
return 0;
}
@@ -79,7 +79,7 @@ test.write('f3.cpp',"""
const char* x = "#include <never.h>"
-int main()
+int main(void)
{
return 0;
}
@@ -113,7 +113,7 @@ test.write('fa.cpp',"""
#include \"fa.h\"
#include <fb.h>
-int main()
+int main(void)
{
return 0;
}
@@ -135,7 +135,7 @@ test.write(['work', 'src', 'fff.c'], """
#include <iii.h>
#include <jjj.h>
-int main()
+int main(void)
{
return 0;
}
@@ -144,7 +144,7 @@ int main()
test.write([ 'work', 'src', 'aaa.c'], """
#include "bbb.h"
-int main()
+int main(void)
{
return 0;
}
@@ -155,7 +155,7 @@ test.write([ 'work', 'src', 'bbb.h'], "\n")
test.write([ 'repository', 'src', 'ccc.c'], """
#include "ddd.h"
-int main()
+int main(void)
{
return 0;
}
@@ -218,7 +218,7 @@ def deps_match(self, deps, headers):
global my_normpath
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))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
# define some tests:
diff --git a/src/engine/SCons/Scanner/D.py b/src/engine/SCons/Scanner/D.py
index 3b6f2f9..1ad9e89 100644
--- a/src/engine/SCons/Scanner/D.py
+++ b/src/engine/SCons/Scanner/D.py
@@ -8,7 +8,7 @@ Coded by Andy Friesen
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -30,7 +30,7 @@ Coded by Andy Friesen
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/D.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/D.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Scanner
@@ -46,7 +46,7 @@ class D(SCons.Scanner.Classic):
name = "DScanner",
suffixes = '$DSUFFIXES',
path_variable = 'DPATH',
- regex = '(?:import\s+)([\w\s=,.]+)(?:\s*:[\s\w,=]+)?(?:;)'
+ regex = r'(?:import\s+)([\w\s=,.]+)(?:\s*:[\s\w,=]+)?(?:;)'
)
def find_include(self, include, source_dir, path):
diff --git a/src/engine/SCons/Scanner/DTests.py b/src/engine/SCons/Scanner/DTests.py
index 58fbe76..f115eb0 100644
--- a/src/engine/SCons/Scanner/DTests.py
+++ b/src/engine/SCons/Scanner/DTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,12 +21,11 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/DTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/DTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import unittest
import TestCmd
-import TestUnit
import SCons.Scanner.D
@@ -80,7 +79,7 @@ def deps_match(self, deps, headers):
global my_normpath
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))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
"""
Examples from https://dlang.org/spec/module.html
@@ -266,14 +265,7 @@ class DScannerTestCase(unittest.TestCase):
self.helper('multiline.d', ['A.d'])
if __name__ == "__main__":
- suite = unittest.TestSuite()
- tclasses = [
- DScannerTestCase,
- ]
- for tclass in tclasses:
- names = unittest.getTestCaseNames(tclass, 'test_')
- suite.addTests(list(map(tclass, names)))
- TestUnit.run(suite)
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/Dir.py b/src/engine/SCons/Scanner/Dir.py
index 66d5b6d..be8ae6c 100644
--- a/src/engine/SCons/Scanner/Dir.py
+++ b/src/engine/SCons/Scanner/Dir.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 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,7 +20,7 @@
# 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__ = "src/engine/SCons/Scanner/Dir.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/Dir.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Node.FS
import SCons.Scanner
diff --git a/src/engine/SCons/Scanner/DirTests.py b/src/engine/SCons/Scanner/DirTests.py
index 12f1844..71e527f 100644
--- a/src/engine/SCons/Scanner/DirTests.py
+++ b/src/engine/SCons/Scanner/DirTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,14 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/DirTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/DirTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os.path
import sys
import unittest
import TestCmd
-import TestUnit
import SCons.Node.FS
import SCons.Scanner.Dir
@@ -121,14 +120,8 @@ class DirEntryScannerTestCase(DirScannerTestBase):
sss = list(map(str, deps))
assert sss == [], sss
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(DirScannerTestCase())
- suite.addTest(DirEntryScannerTestCase())
- return suite
-
if __name__ == "__main__":
- TestUnit.run(suite())
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py
index 8a8f3eb..d315bc9 100644
--- a/src/engine/SCons/Scanner/Fortran.py
+++ b/src/engine/SCons/Scanner/Fortran.py
@@ -5,7 +5,7 @@ This module implements the dependency scanner for Fortran code.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -26,7 +26,7 @@ This module implements the dependency scanner for Fortran code.
# 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__ = "src/engine/SCons/Scanner/Fortran.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/Fortran.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import re
@@ -78,7 +78,7 @@ class F90Scanner(SCons.Scanner.Classic):
def scan(self, node, env, path=()):
# cache the includes list in node so we only scan it once:
- if node.includes != None:
+ if node.includes is not None:
mods_and_includes = node.includes
else:
# retrieve all included filenames
@@ -187,7 +187,7 @@ def FortranScan(path_variable="FORTRANPATH"):
# (\w+) : match the module name that is being USE'd
#
#
- use_regex = "(?i)(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"
+ use_regex = r"(?i)(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"
# The INCLUDE statement regex matches the following:
@@ -275,7 +275,7 @@ def FortranScan(path_variable="FORTRANPATH"):
# set of semicolon-separated INCLUDE statements
# (as allowed by the F2003 standard)
- include_regex = """(?i)(?:^|['">]\s*;)\s*INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])"""
+ include_regex = r"""(?i)(?:^|['">]\s*;)\s*INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])"""
# The MODULE statement regex finds module definitions by matching
# the following:
@@ -285,21 +285,29 @@ def FortranScan(path_variable="FORTRANPATH"):
# but *not* the following:
#
# MODULE PROCEDURE procedure_name
+# MODULE SUBROUTINE subroutine_name
+# MODULE FUNCTION function_name
+# MODULE PURE SUBROUTINE|FUNCTION subroutine_name|function_name
+# MODULE ELEMENTAL SUBROUTINE|FUNCTION subroutine_name|function_name
#
# Here is a breakdown of the regex:
#
-# (?i) : regex is case insensitive
-# ^\s* : any amount of white space
-# MODULE : match the string MODULE, case insensitive
-# \s+ : match one or more white space characters
-# (?!PROCEDURE) : but *don't* match if the next word matches
-# PROCEDURE (negative lookahead assertion),
-# case insensitive
-# (\w+) : match one or more alphanumeric characters
-# that make up the defined module name and
-# save it in a group
-
- def_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)"""
+# (?i) : regex is case insensitive
+# ^\s* : any amount of white space
+# MODULE : match the string MODULE, case
+# insensitive
+# \s+ : match one or more white space
+# characters
+# (?!PROCEDURE|SUBROUTINE|FUNCTION|PURE|ELEMENTAL)
+# : but *don't* match if the next word
+# matches PROCEDURE, SUBROUTINE,
+# FUNCTION, PURE or ELEMENTAL (negative
+# lookahead assertion), case insensitive
+# (\w+) : match one or more alphanumeric
+# characters that make up the defined
+# module name and save it in a group
+
+ def_regex = r"""(?i)^\s*MODULE\s+(?!PROCEDURE|SUBROUTINE|FUNCTION|PURE|ELEMENTAL)(\w+)"""
scanner = F90Scanner("FortranScan",
"$FORTRANSUFFIXES",
diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py
index 4194018..5bf4be6 100644
--- a/src/engine/SCons/Scanner/FortranTests.py
+++ b/src/engine/SCons/Scanner/FortranTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,11 +21,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/FortranTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/FortranTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import os.path
-import sys
import unittest
import SCons.Scanner.Fortran
@@ -33,17 +32,16 @@ import SCons.Node.FS
import SCons.Warnings
import TestCmd
-import TestUnit
original = os.getcwd()
-test = TestCmd.TestCmd(workdir = '')
+test = TestCmd.TestCmd(workdir='')
os.chdir(test.workpath(''))
# create some source files and headers:
-test.write('fff1.f',"""
+test.write('fff1.f', """
PROGRAM FOO
INCLUDE 'f1.f'
include 'f2.f'
@@ -51,7 +49,7 @@ test.write('fff1.f',"""
END
""")
-test.write('fff2.f',"""
+test.write('fff2.f', """
PROGRAM FOO
INCLUDE 'f2.f'
include 'd1/f2.f'
@@ -60,30 +58,28 @@ test.write('fff2.f',"""
END
""")
-test.write('fff3.f',"""
+test.write('fff3.f', """
PROGRAM FOO
INCLUDE 'f3.f' ; INCLUDE\t'd1/f3.f'
STOP
END
""")
-
# for Emacs -> "
test.subdir('d1', ['d1', 'd2'])
-headers = ['fi.f', 'never.f',
- 'd1/f1.f', 'd1/f2.f', 'd1/f3.f', 'd1/fi.f',
- 'd1/d2/f1.f', 'd1/d2/f2.f', 'd1/d2/f3.f',
- 'd1/d2/f4.f', 'd1/d2/fi.f']
+test_headers = ['fi.f', 'never.f',
+ 'd1/f1.f', 'd1/f2.f', 'd1/f3.f', 'd1/fi.f',
+ 'd1/d2/f1.f', 'd1/d2/f2.f', 'd1/d2/f3.f',
+ 'd1/d2/f4.f', 'd1/d2/fi.f']
-for h in headers:
+for h in test_headers:
test.write(h, "\n")
-
test.subdir('include', 'subdir', ['subdir', 'include'])
-test.write('fff4.f',"""
+test.write('fff4.f', """
PROGRAM FOO
INCLUDE 'f4.f'
STOP
@@ -93,7 +89,7 @@ test.write('fff4.f',"""
test.write('include/f4.f', "\n")
test.write('subdir/include/f4.f', "\n")
-test.write('fff5.f',"""
+test.write('fff5.f', """
PROGRAM FOO
INCLUDE 'f5.f'
INCLUDE 'not_there.f'
@@ -104,7 +100,7 @@ test.write('fff5.f',"""
test.write('f5.f', "\n")
test.subdir('repository', ['repository', 'include'],
- [ 'repository', 'src' ])
+ ['repository', 'src'])
test.subdir('work', ['work', 'src'])
test.write(['repository', 'include', 'iii.f'], "\n")
@@ -117,26 +113,25 @@ test.write(['work', 'src', 'fff.f'], """
END
""")
-test.write([ 'work', 'src', 'aaa.f'], """
+test.write(['work', 'src', 'aaa.f'], """
PROGRAM FOO
INCLUDE 'bbb.f'
STOP
END
""")
-test.write([ 'work', 'src', 'bbb.f'], "\n")
+test.write(['work', 'src', 'bbb.f'], "\n")
-test.write([ 'repository', 'src', 'ccc.f'], """
+test.write(['repository', 'src', 'ccc.f'], """
PROGRAM FOO
INCLUDE 'ddd.f'
STOP
END
""")
-test.write([ 'repository', 'src', 'ddd.f'], "\n")
+test.write(['repository', 'src', 'ddd.f'], "\n")
-
-test.write('fff90a.f90',"""
+test.write('fff90a.f90', """
PROGRAM FOO
! Test comments - these includes should NOT be picked up
@@ -194,18 +189,19 @@ USE mod25 ! Test USE statement at the beginning of line
END
""")
-modules = ['mod01.mod', 'mod02.mod', 'mod03.mod', 'mod04.mod', 'mod05.mod',
- 'mod06.mod', 'mod07.mod', 'mod08.mod', 'mod09.mod', 'mod10.mod',
- 'mod11.mod', 'mod12.mod', 'mod13.mod', 'mod14.mod', 'mod15.mod',
- 'mod16.mod', 'mod17.mod', 'mod18.mod', 'mod19.mod', 'mod20.mod',
- 'mod21.mod', 'mod22.mod', 'mod23.mod', 'mod24.mod', 'mod25.mod']
+test_modules = ['mod01.mod', 'mod02.mod', 'mod03.mod', 'mod04.mod', 'mod05.mod',
+ 'mod06.mod', 'mod07.mod', 'mod08.mod', 'mod09.mod', 'mod10.mod',
+ 'mod11.mod', 'mod12.mod', 'mod13.mod', 'mod14.mod', 'mod15.mod',
+ 'mod16.mod', 'mod17.mod', 'mod18.mod', 'mod19.mod', 'mod20.mod',
+ 'mod21.mod', 'mod22.mod', 'mod23.mod', 'mod24.mod', 'mod25.mod']
-for m in modules:
+for m in test_modules:
test.write(m, "\n")
test.subdir('modules')
test.write(['modules', 'use.mod'], "\n")
+
# define some helpers:
class DummyEnvironment(object):
@@ -215,7 +211,7 @@ class DummyEnvironment(object):
def Dictionary(self, *args):
if not args:
- return { 'FORTRANPATH': self.path, 'FORTRANMODSUFFIX' : ".mod" }
+ return {'FORTRANPATH': self.path, 'FORTRANMODSUFFIX': ".mod"}
elif len(args) == 1 and args[0] == 'FORTRANPATH':
return self.path
else:
@@ -224,13 +220,13 @@ class DummyEnvironment(object):
def has_key(self, key):
return key in self.Dictionary()
- def __getitem__(self,key):
+ def __getitem__(self, key):
return self.Dictionary()[key]
- def __setitem__(self,key,value):
+ def __setitem__(self, key, value):
self.Dictionary()[key] = value
- def __delitem__(self,key):
+ def __delitem__(self, key):
del self.Dictionary()[key]
def subst(self, arg, target=None, source=None, conv=None):
@@ -255,10 +251,12 @@ class DummyEnvironment(object):
def File(self, filename):
return self.fs.File(filename)
+
def deps_match(self, deps, headers):
scanned = list(map(os.path.normpath, list(map(str, deps))))
expect = list(map(os.path.normpath, headers))
- self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
+
# define some tests:
@@ -275,6 +273,7 @@ class FortranScannerTestCase1(unittest.TestCase):
test.unlink('f1.f')
test.unlink('f2.f')
+
class FortranScannerTestCase2(unittest.TestCase):
def runTest(self):
test.write('f1.f', "\n")
@@ -288,6 +287,7 @@ class FortranScannerTestCase2(unittest.TestCase):
test.unlink('f1.f')
test.unlink('f2.f')
+
class FortranScannerTestCase3(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1")])
@@ -297,6 +297,7 @@ class FortranScannerTestCase3(unittest.TestCase):
headers = ['d1/f1.f', 'd1/f2.f']
deps_match(self, deps, headers)
+
class FortranScannerTestCase4(unittest.TestCase):
def runTest(self):
test.write(['d1', 'f2.f'], " INCLUDE 'fi.f'\n")
@@ -308,6 +309,7 @@ class FortranScannerTestCase4(unittest.TestCase):
deps_match(self, deps, headers)
test.write(['d1', 'f2.f'], "\n")
+
class FortranScannerTestCase5(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1")])
@@ -317,6 +319,7 @@ class FortranScannerTestCase5(unittest.TestCase):
headers = ['d1/f2.f', 'd1/d2/f2.f', 'd1/f2.f']
deps_match(self, deps, headers)
+
class FortranScannerTestCase6(unittest.TestCase):
def runTest(self):
test.write('f2.f', "\n")
@@ -324,19 +327,21 @@ class FortranScannerTestCase6(unittest.TestCase):
s = SCons.Scanner.Fortran.FortranScan()
path = s.path(env)
deps = s(env.File('fff2.f'), env, path)
- headers = ['d1/f2.f', 'd1/d2/f2.f', 'f2.f']
+ headers = ['d1/f2.f', 'd1/d2/f2.f', 'f2.f']
deps_match(self, deps, headers)
test.unlink('f2.f')
+
class FortranScannerTestCase7(unittest.TestCase):
def runTest(self):
env = DummyEnvironment([test.workpath("d1/d2"), test.workpath("d1")])
s = SCons.Scanner.Fortran.FortranScan()
path = s.path(env)
deps = s(env.File('fff2.f'), env, path)
- headers = ['d1/f2.f', 'd1/d2/f2.f', 'd1/d2/f2.f']
+ headers = ['d1/f2.f', 'd1/d2/f2.f', 'd1/d2/f2.f']
deps_match(self, deps, headers)
+
class FortranScannerTestCase8(unittest.TestCase):
def runTest(self):
test.write('f2.f', "\n")
@@ -344,10 +349,11 @@ class FortranScannerTestCase8(unittest.TestCase):
s = SCons.Scanner.Fortran.FortranScan()
path = s.path(env)
deps = s(env.File('fff2.f'), env, path)
- headers = ['d1/f2.f', 'd1/d2/f2.f', 'f2.f']
+ headers = ['d1/f2.f', 'd1/d2/f2.f', 'f2.f']
deps_match(self, deps, headers)
test.unlink('f2.f')
+
class FortranScannerTestCase9(unittest.TestCase):
def runTest(self):
test.write('f3.f', "\n")
@@ -356,9 +362,11 @@ class FortranScannerTestCase9(unittest.TestCase):
path = s.path(env)
n = env.File('fff3.f')
+
def my_rexists(s):
s.Tag('rexists_called', 1)
return SCons.Node._rexists_map[s.GetTag('old_rexists')](s)
+
n.Tag('old_rexists', n._func_rexists)
SCons.Node._rexists_map[3] = my_rexists
n._func_rexists = 3
@@ -369,10 +377,11 @@ class FortranScannerTestCase9(unittest.TestCase):
# scanned, essential for cooperation with VariantDir functionality.
assert n.GetTag('rexists_called')
- headers = ['d1/f3.f', 'f3.f']
+ headers = ['d1/f3.f', 'f3.f']
deps_match(self, deps, headers)
test.unlink('f3.f')
+
class FortranScannerTestCase10(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(["include"])
@@ -380,18 +389,20 @@ class FortranScannerTestCase10(unittest.TestCase):
path = s.path(env)
deps1 = s(env.File('fff4.f'), env, path)
env.fs.chdir(env.Dir('subdir'))
- dir = env.fs.getcwd()
+ test_dir = env.fs.getcwd()
env.fs.chdir(env.Dir(''))
- path = s.path(env, dir)
+ path = s.path(env, test_dir)
deps2 = s(env.File('#fff4.f'), env, path)
- headers1 = list(map(test.workpath, ['include/f4.f']))
- headers2 = ['include/f4.f']
+ headers1 = [test.workpath(f) for f in ['include/f4.f']]
+ headers2 = ['include/f4.f']
deps_match(self, deps1, headers1)
deps_match(self, deps2, headers2)
+
class FortranScannerTestCase11(unittest.TestCase):
def runTest(self):
SCons.Warnings.enableWarningClass(SCons.Warnings.DependencyWarning)
+
class TestOut(object):
def __call__(self, x):
self.out = x
@@ -407,7 +418,8 @@ class FortranScannerTestCase11(unittest.TestCase):
# Did we catch the warning from not finding not_there.f?
assert to.out
- deps_match(self, deps, [ 'f5.f' ])
+ deps_match(self, deps, ['f5.f'])
+
class FortranScannerTestCase12(unittest.TestCase):
def runTest(self):
@@ -421,6 +433,7 @@ class FortranScannerTestCase12(unittest.TestCase):
deps_match(self, deps, ['f4.f'])
test.unlink('include/fff4.f')
+
class FortranScannerTestCase13(unittest.TestCase):
def runTest(self):
os.chdir(test.workpath('work'))
@@ -429,9 +442,9 @@ class FortranScannerTestCase13(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.f')
- f1.builder=1
- env = DummyEnvironment(['include','include2'])
+ f1 = fs.File('include2/jjj.f')
+ f1.builder = 1
+ env = DummyEnvironment(['include', 'include2'])
env.fs = fs
s = SCons.Scanner.Fortran.FortranScan()
path = s.path(env)
@@ -439,6 +452,7 @@ class FortranScannerTestCase13(unittest.TestCase):
deps_match(self, deps, [test.workpath('repository/include/iii.f'), 'include2/jjj.f'])
os.chdir(test.workpath(''))
+
class FortranScannerTestCase14(unittest.TestCase):
def runTest(self):
os.chdir(test.workpath('work'))
@@ -451,15 +465,16 @@ class FortranScannerTestCase14(unittest.TestCase):
s = SCons.Scanner.Fortran.FortranScan()
path = s.path(env)
deps1 = s(fs.File('build1/aaa.f'), env, path)
- deps_match(self, deps1, [ 'build1/bbb.f' ])
+ deps_match(self, deps1, ['build1/bbb.f'])
deps2 = s(fs.File('build2/aaa.f'), env, path)
- deps_match(self, deps2, [ 'src/bbb.f' ])
+ deps_match(self, deps2, ['src/bbb.f'])
deps3 = s(fs.File('build1/ccc.f'), env, path)
- deps_match(self, deps3, [ 'build1/ddd.f' ])
+ deps_match(self, deps3, ['build1/ddd.f'])
deps4 = s(fs.File('build2/ccc.f'), env, path)
- deps_match(self, deps4, [ test.workpath('repository/src/ddd.f') ])
+ deps_match(self, deps4, [test.workpath('repository/src/ddd.f')])
os.chdir(test.workpath(''))
+
class FortranScannerTestCase15(unittest.TestCase):
def runTest(self):
class SubstEnvironment(DummyEnvironment):
@@ -468,6 +483,7 @@ class FortranScannerTestCase15(unittest.TestCase):
return test.workpath("d1")
else:
return arg
+
test.write(['d1', 'f2.f'], " INCLUDE 'fi.f'\n")
env = SubstEnvironment(["$junk"])
s = SCons.Scanner.Fortran.FortranScan()
@@ -477,6 +493,7 @@ class FortranScannerTestCase15(unittest.TestCase):
deps_match(self, deps, headers)
test.write(['d1', 'f2.f'], "\n")
+
class FortranScannerTestCase16(unittest.TestCase):
def runTest(self):
test.write('f1.f', "\n")
@@ -512,28 +529,10 @@ class FortranScannerTestCase16(unittest.TestCase):
test.unlink('f9.f')
test.unlink('f10.f')
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(FortranScannerTestCase1())
- suite.addTest(FortranScannerTestCase2())
- suite.addTest(FortranScannerTestCase3())
- suite.addTest(FortranScannerTestCase4())
- suite.addTest(FortranScannerTestCase5())
- suite.addTest(FortranScannerTestCase6())
- suite.addTest(FortranScannerTestCase7())
- suite.addTest(FortranScannerTestCase8())
- suite.addTest(FortranScannerTestCase9())
- suite.addTest(FortranScannerTestCase10())
- suite.addTest(FortranScannerTestCase11())
- suite.addTest(FortranScannerTestCase12())
- suite.addTest(FortranScannerTestCase13())
- suite.addTest(FortranScannerTestCase14())
- suite.addTest(FortranScannerTestCase15())
- suite.addTest(FortranScannerTestCase16())
- return suite
+
if __name__ == "__main__":
- TestUnit.run(suite())
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/IDL.py b/src/engine/SCons/Scanner/IDL.py
index 706ff41..88226e6 100644
--- a/src/engine/SCons/Scanner/IDL.py
+++ b/src/engine/SCons/Scanner/IDL.py
@@ -6,7 +6,7 @@ Definition Language) files.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/IDL.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/IDL.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Node.FS
import SCons.Scanner
diff --git a/src/engine/SCons/Scanner/IDLTests.py b/src/engine/SCons/Scanner/IDLTests.py
index f1b64c0..9bc4e5a 100644
--- a/src/engine/SCons/Scanner/IDLTests.py
+++ b/src/engine/SCons/Scanner/IDLTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/IDLTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/IDLTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import unittest
import sys
@@ -159,7 +159,7 @@ test.write(['work', 'src', 'fff.c'], """
#include <iii.idl>
#include <jjj.idl>
-int main()
+int main(void)
{
return 0;
}
@@ -168,7 +168,7 @@ int main()
test.write([ 'work', 'src', 'aaa.c'], """
#include "bbb.idl"
-int main()
+int main(void)
{
return 0;
}
@@ -179,7 +179,7 @@ test.write([ 'work', 'src', 'bbb.idl'], "\n")
test.write([ 'repository', 'src', 'ccc.c'], """
#include "ddd.idl"
-int main()
+int main(void)
{
return 0;
}
@@ -243,7 +243,7 @@ if os.path.normcase('foo') == os.path.normcase('FOO'):
def deps_match(self, deps, 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))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
# define some tests:
diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py
index 69154bd..8afe5b0 100644
--- a/src/engine/SCons/Scanner/LaTeX.py
+++ b/src/engine/SCons/Scanner/LaTeX.py
@@ -5,7 +5,7 @@ This module implements the dependency scanner for LaTeX code.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -27,7 +27,7 @@ This module implements the dependency scanner for LaTeX code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/LaTeX.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/LaTeX.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os.path
import re
@@ -128,8 +128,8 @@ class LaTeX(SCons.Scanner.Base):
Unlike most scanners, which use regular expressions that just
return the included file name, this returns a tuple consisting
of the keyword for the inclusion ("include", "includegraphics",
- "input", or "bibliography"), and then the file name itself.
- Based on a quick look at LaTeX documentation, it seems that we
+ "input", or "bibliography"), and then the file name itself.
+ Based on a quick look at LaTeX documentation, it seems that we
should append .tex suffix for the "include" keywords, append .tex if
there is no extension for the "input" keyword, and need to add .bib
for the "bibliography" keyword that does not accept extensions by itself.
@@ -137,7 +137,7 @@ class LaTeX(SCons.Scanner.Base):
Finally, if there is no extension for an "includegraphics" keyword
latex will append .ps or .eps to find the file, while pdftex may use .pdf,
.jpg, .tif, .mps, or .png.
-
+
The actual subset and search order may be altered by
DeclareGraphicsExtensions command. This complication is ignored.
The default order corresponds to experimentation with teTeX::
@@ -179,15 +179,7 @@ class LaTeX(SCons.Scanner.Base):
'inputfrom', 'subinputfrom']
def __init__(self, name, suffixes, graphics_extensions, *args, **kw):
-
- # We have to include \n with the % we exclude from the first part
- # part of the regex because the expression is compiled with re.M.
- # Without the \n, the ^ could match the beginning of a *previous*
- # line followed by one or more newline characters (i.e. blank
- # lines), interfering with a match on the next line.
- # add option for whitespace before the '[options]' or the '{filename}'
regex = r'''
- ^[^%\n]*
\\(
include
| includegraphics(?:\s*\[[^\]]+\])?
@@ -333,7 +325,7 @@ class LaTeX(SCons.Scanner.Base):
line_continues_a_comment = False
for line in text.splitlines():
line,comment = self.comment_re.findall(line)[0]
- if line_continues_a_comment == True:
+ if line_continues_a_comment:
out[-1] = out[-1] + line.lstrip()
else:
out.append(line)
@@ -348,8 +340,8 @@ class LaTeX(SCons.Scanner.Base):
# Cache the includes list in node so we only scan it once:
# path_dict = dict(list(path))
# add option for whitespace (\s) before the '['
- noopt_cre = re.compile('\s*\[.*$')
- if node.includes != None:
+ noopt_cre = re.compile(r'\s*\[.*$')
+ if node.includes is not None:
includes = node.includes
else:
text = self.canonical_text(node.get_text_contents())
@@ -372,9 +364,9 @@ class LaTeX(SCons.Scanner.Base):
inc_list = include[2].split(',')
else:
inc_list = include[1].split(',')
- for j in range(len(inc_list)):
- split_includes.append( (inc_type, inc_subdir, inc_list[j]) )
- #
+ for inc in inc_list:
+ split_includes.append((inc_type, inc_subdir, inc))
+
includes = split_includes
node.includes = includes
@@ -386,8 +378,8 @@ class LaTeX(SCons.Scanner.Base):
directory of the main file just as latex does"""
path_dict = dict(list(path))
-
- queue = []
+
+ queue = []
queue.extend( self.scan(node) )
seen = {}
@@ -402,7 +394,7 @@ class LaTeX(SCons.Scanner.Base):
source_dir = node.get_dir()
#for include in includes:
while queue:
-
+
include = queue.pop()
inc_type, inc_subdir, inc_filename = include
diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py
index 93729d4..8750000 100644
--- a/src/engine/SCons/Scanner/LaTeXTests.py
+++ b/src/engine/SCons/Scanner/LaTeXTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.compat
@@ -31,14 +31,13 @@ import sys
import unittest
import TestCmd
-import TestUnit
import SCons.Node.FS
import SCons.Scanner.LaTeX
test = TestCmd.TestCmd(workdir = '')
-test.write('test1.latex',"""
+test.write('test1.latex',r"""
\include{inc1}
\input{inc2}
include{incNO}
@@ -52,16 +51,22 @@ xyzzy \include{inc6}
\subinputfrom{subdir}{inc3e}
""")
-test.write('test2.latex',"""
+test.write('test2.latex',r"""
\include{inc1}
\include{inc3}
""")
-test.write('test3.latex',"""
+test.write('test3.latex',r"""
\includegraphics{inc4.eps}
\includegraphics[width=60mm]{inc5.xyz}
""")
+test.write('test4.latex',r"""
+\include{inc1}\include{inc2}
+\only<1>{\includegraphics{inc5.xyz}}%
+\only<2>{\includegraphics{inc7.png}}
+""")
+
test.subdir('subdir')
test.write('inc1.tex',"\n")
@@ -74,6 +79,7 @@ test.write(['subdir', 'inc3c.tex'], "\n")
test.write(['subdir', 'inc4.eps'], "\n")
test.write('inc5.xyz', "\n")
test.write('inc6.tex', "\n")
+test.write('inc7.png', "\n")
test.write('incNO.tex', "\n")
# define some helpers:
@@ -123,7 +129,7 @@ def deps_match(self, deps, headers):
global my_normpath
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))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
class LaTeXScannerTestCase1(unittest.TestCase):
@@ -156,16 +162,17 @@ class LaTeXScannerTestCase3(unittest.TestCase):
files = ['inc5.xyz', 'subdir/inc4.eps']
deps_match(self, deps, files)
-
-def suite():
- suite = unittest.TestSuite()
- suite.addTest(LaTeXScannerTestCase1())
- suite.addTest(LaTeXScannerTestCase2())
- suite.addTest(LaTeXScannerTestCase3())
- return suite
+class LaTeXScannerTestCase4(unittest.TestCase):
+ def runTest(self):
+ env = DummyEnvironment(TEXINPUTS=[test.workpath("subdir")],LATEXSUFFIXES = [".tex", ".ltx", ".latex"])
+ s = SCons.Scanner.LaTeX.LaTeXScanner()
+ path = s.path(env)
+ deps = s(env.File('test4.latex'), env, path)
+ files = ['inc1.tex', 'inc2.tex', 'inc5.xyz', 'inc7.png']
+ deps_match(self, deps, files)
if __name__ == "__main__":
- TestUnit.run(suite())
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py
index 63d5a38..2ae3c68 100644
--- a/src/engine/SCons/Scanner/Prog.py
+++ b/src/engine/SCons/Scanner/Prog.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/Prog.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/Prog.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Node
import SCons.Node.FS
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py
index 1f4dfb5..7dae37c 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,14 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/ProgTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/ProgTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os.path
import sys
import unittest
import TestCmd
-import TestUnit
import SCons.Node.FS
import SCons.Scanner.Prog
@@ -274,7 +273,7 @@ def suite():
return suite
if __name__ == "__main__":
- TestUnit.run(suite())
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/RC.py b/src/engine/SCons/Scanner/RC.py
index 4202362..4f0cee2 100644
--- a/src/engine/SCons/Scanner/RC.py
+++ b/src/engine/SCons/Scanner/RC.py
@@ -6,7 +6,7 @@ Definition Language) files.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/RC.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/RC.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import re
@@ -48,9 +48,9 @@ def RCScan():
"""Return a prototype Scanner instance for scanning RC source files"""
res_re= r'^(?:\s*#\s*(?:include)|' \
- '.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
- '\s*.*?)' \
- '\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
+ r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \
+ r'\s*.*?)' \
+ r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$'
resScanner = SCons.Scanner.ClassicCPP("ResourceScanner",
"$RCSUFFIXES",
"CPPPATH",
diff --git a/src/engine/SCons/Scanner/RCTests.py b/src/engine/SCons/Scanner/RCTests.py
index fa0a9b4..2915985 100644
--- a/src/engine/SCons/Scanner/RCTests.py
+++ b/src/engine/SCons/Scanner/RCTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/RCTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/RCTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import unittest
import sys
@@ -29,7 +29,6 @@ import collections
import os
import TestCmd
-import TestUnit
import SCons.Scanner.RC
import SCons.Node.FS
@@ -117,7 +116,7 @@ if os.path.normcase('foo') == os.path.normcase('FOO'):
def deps_match(self, deps, headers):
scanned = sorted(map(my_normpath, list(map(str, deps))))
expect = sorted(map(my_normpath, headers))
- self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
+ self.assertTrue(scanned == expect, "expect %s != scanned %s" % (expect, scanned))
# define some tests:
@@ -167,7 +166,7 @@ def suite():
return suite
if __name__ == "__main__":
- TestUnit.run(suite())
+ unittest.main()
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/Scanner/SWIG.py b/src/engine/SCons/Scanner/SWIG.py
index 048574c..5f2a3e3 100644
--- a/src/engine/SCons/Scanner/SWIG.py
+++ b/src/engine/SCons/Scanner/SWIG.py
@@ -5,7 +5,7 @@ This module implements the dependency scanner for SWIG code.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -27,14 +27,14 @@ This module implements the dependency scanner for SWIG code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/SWIG.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/SWIG.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.Scanner
SWIGSuffixes = [ '.i' ]
def SWIGScanner():
- expr = '^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)'
+ expr = r'^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)'
scanner = SCons.Scanner.ClassicCPP("SWIGScanner", ".i", "SWIGPATH", expr)
return scanner
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index a962a4c..64842d4 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 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,7 +20,7 @@
# 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__ = "src/engine/SCons/Scanner/ScannerTests.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/ScannerTests.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import SCons.compat
@@ -132,16 +132,16 @@ class BaseTestCase(unittest.TestCase):
scanned = scanner(filename, env, path)
scanned_strs = [str(x) for x in scanned]
- self.failUnless(self.filename == filename, "the filename was passed incorrectly")
- self.failUnless(self.env == env, "the environment was passed incorrectly")
- self.failUnless(scanned_strs == deps, "the dependencies were returned incorrectly")
+ self.assertTrue(self.filename == filename, "the filename was passed incorrectly")
+ self.assertTrue(self.env == env, "the environment was passed incorrectly")
+ self.assertTrue(scanned_strs == deps, "the dependencies were returned incorrectly")
for d in scanned:
- self.failUnless(not isinstance(d, str), "got a string in the dependencies")
+ self.assertTrue(not isinstance(d, str), "got a string in the dependencies")
if len(args) > 0:
- self.failUnless(self.arg == args[0], "the argument was passed incorrectly")
+ self.assertTrue(self.arg == args[0], "the argument was passed incorrectly")
else:
- self.failIf(hasattr(self, "arg"), "an argument was given when it shouldn't have been")
+ self.assertFalse(hasattr(self, "arg"), "an argument was given when it shouldn't have been")
def test___call__dict(self):
"""Test calling Scanner.Base objects with a dictionary"""
@@ -245,7 +245,7 @@ class BaseTestCase(unittest.TestCase):
dict[s] = 777
i = hash(id(s))
h = hash(list(dict.keys())[0])
- self.failUnless(h == i,
+ self.assertTrue(h == i,
"hash Scanner base class expected %s, got %s" % (i, h))
def test_scan_check(self):
@@ -260,7 +260,7 @@ class BaseTestCase(unittest.TestCase):
self.checked = {}
path = s.path(env)
scanned = s(DummyNode('x'), env, path)
- self.failUnless(self.checked['x'] == 1,
+ self.assertTrue(self.checked['x'] == 1,
"did not call check function")
def test_recursive(self):
@@ -269,42 +269,42 @@ class BaseTestCase(unittest.TestCase):
s = SCons.Scanner.Base(function = self.func)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [],
+ self.assertTrue(n == [],
"default behavior returned nodes: %s" % n)
s = SCons.Scanner.Base(function = self.func, recursive = None)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [],
+ self.assertTrue(n == [],
"recursive = None returned nodes: %s" % n)
s = SCons.Scanner.Base(function = self.func, recursive = 1)
n = s.recurse_nodes(nodes)
- self.failUnless(n == n,
+ self.assertTrue(n == n,
"recursive = 1 didn't return all nodes: %s" % n)
def odd_only(nodes):
return [n for n in nodes if n % 2]
s = SCons.Scanner.Base(function = self.func, recursive = odd_only)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [1, 3],
+ self.assertTrue(n == [1, 3],
"recursive = 1 didn't return all nodes: %s" % n)
def test_get_skeys(self):
"""Test the Scanner.Base get_skeys() method"""
s = SCons.Scanner.Base(function = self.func)
sk = s.get_skeys()
- self.failUnless(sk == [],
+ self.assertTrue(sk == [],
"did not initialize to expected []")
s = SCons.Scanner.Base(function = self.func, skeys = ['.1', '.2'])
sk = s.get_skeys()
- self.failUnless(sk == ['.1', '.2'],
+ self.assertTrue(sk == ['.1', '.2'],
"sk was %s, not ['.1', '.2']")
s = SCons.Scanner.Base(function = self.func, skeys = '$LIST')
env = DummyEnvironment(LIST = ['.3', '.4'])
sk = s.get_skeys(env)
- self.failUnless(sk == ['.3', '.4'],
+ self.assertTrue(sk == ['.3', '.4'],
"sk was %s, not ['.3', '.4']")
def test_select(self):
@@ -432,19 +432,19 @@ class CurrentTestCase(unittest.TestCase):
path = s.path(env)
hnb = HasNoBuilder()
s(hnb, env, path)
- self.failUnless(hnb.called_has_builder, "did not call has_builder()")
- self.failUnless(not hnb.called_is_up_to_date, "did call is_up_to_date()")
- self.failUnless(hnb.func_called, "did not call func()")
+ self.assertTrue(hnb.called_has_builder, "did not call has_builder()")
+ self.assertTrue(not hnb.called_is_up_to_date, "did call is_up_to_date()")
+ self.assertTrue(hnb.func_called, "did not call func()")
inc = IsNotCurrent()
s(inc, env, path)
- self.failUnless(inc.called_has_builder, "did not call has_builder()")
- self.failUnless(inc.called_is_up_to_date, "did not call is_up_to_date()")
- self.failUnless(not inc.func_called, "did call func()")
+ self.assertTrue(inc.called_has_builder, "did not call has_builder()")
+ self.assertTrue(inc.called_is_up_to_date, "did not call is_up_to_date()")
+ self.assertTrue(not inc.func_called, "did call func()")
ic = IsCurrent()
s(ic, env, path)
- self.failUnless(ic.called_has_builder, "did not call has_builder()")
- self.failUnless(ic.called_is_up_to_date, "did not call is_up_to_date()")
- self.failUnless(ic.func_called, "did not call func()")
+ self.assertTrue(ic.called_has_builder, "did not call has_builder()")
+ self.assertTrue(ic.called_is_up_to_date, "did not call is_up_to_date()")
+ self.assertTrue(ic.func_called, "did not call func()")
class ClassicTestCase(unittest.TestCase):
@@ -461,7 +461,7 @@ class ClassicTestCase(unittest.TestCase):
def test_find_include(self):
"""Test the Scanner.Classic find_include() method"""
env = DummyEnvironment()
- s = SCons.Scanner.Classic("t", ['.suf'], 'MYPATH', '^my_inc (\S+)')
+ s = SCons.Scanner.Classic("t", ['.suf'], 'MYPATH', r'^my_inc (\S+)')
def _find_file(filename, paths):
return paths[0]+'/'+filename
@@ -479,7 +479,7 @@ class ClassicTestCase(unittest.TestCase):
def test_name(self):
"""Test setting the Scanner.Classic name"""
- s = SCons.Scanner.Classic("my_name", ['.s'], 'MYPATH', '^my_inc (\S+)')
+ s = SCons.Scanner.Classic("my_name", ['.s'], 'MYPATH', r'^my_inc (\S+)')
assert s.name == "my_name", s.name
def test_scan(self):
@@ -505,7 +505,7 @@ class ClassicTestCase(unittest.TestCase):
return include, include
env = DummyEnvironment()
- s = MyScanner("t", ['.suf'], 'MYPATH', '^my_inc (\S+)')
+ s = MyScanner("t", ['.suf'], 'MYPATH', r'^my_inc (\S+)')
# This set of tests is intended to test the scanning operation
# of the Classic scanner.
@@ -566,7 +566,7 @@ class ClassicTestCase(unittest.TestCase):
s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=1)
n = s.recurse_nodes(nodes)
- self.failUnless(n == n,
+ self.assertTrue(n == n,
"recursive = 1 didn't return all nodes: %s" % n)
def odd_only(nodes):
@@ -574,7 +574,7 @@ class ClassicTestCase(unittest.TestCase):
s = SCons.Scanner.Classic("Test", [], None, "", function=self.func, recursive=odd_only)
n = s.recurse_nodes(nodes)
- self.failUnless(n == [1, 3],
+ self.assertTrue(n == [1, 3],
"recursive = 1 didn't return all nodes: %s" % n)
diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py
index 73e8c09..feff12a 100644
--- a/src/engine/SCons/Scanner/__init__.py
+++ b/src/engine/SCons/Scanner/__init__.py
@@ -5,7 +5,7 @@ The Scanner package for the SCons software construction utility.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/__init__.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "src/engine/SCons/Scanner/__init__.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import re
@@ -207,7 +207,7 @@ class Base(object):
self = self.select(node)
- if not self.argument is _null:
+ if self.argument is not _null:
node_list = self.function(node, env, path, self.argument)
else:
node_list = self.function(node, env, path)
diff --git a/src/engine/SCons/Scanner/__init__.xml b/src/engine/SCons/Scanner/__init__.xml
index db2d14b..436d806 100644
--- a/src/engine/SCons/Scanner/__init__.xml
+++ b/src/engine/SCons/Scanner/__init__.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2001 - 2017 The SCons Foundation
+Copyright (c) 2001 - 2019 The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.