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.py2
-rw-r--r--src/engine/SCons/Scanner/CTests.py2
-rw-r--r--src/engine/SCons/Scanner/D.py2
-rw-r--r--src/engine/SCons/Scanner/Dir.py2
-rw-r--r--src/engine/SCons/Scanner/DirTests.py2
-rw-r--r--src/engine/SCons/Scanner/Fortran.py8
-rw-r--r--src/engine/SCons/Scanner/FortranTests.py2
-rw-r--r--src/engine/SCons/Scanner/IDL.py2
-rw-r--r--src/engine/SCons/Scanner/IDLTests.py2
-rw-r--r--src/engine/SCons/Scanner/LaTeX.py30
-rw-r--r--src/engine/SCons/Scanner/LaTeXTests.py2
-rw-r--r--src/engine/SCons/Scanner/Prog.py2
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py2
-rw-r--r--src/engine/SCons/Scanner/RC.py2
-rw-r--r--src/engine/SCons/Scanner/RCTests.py2
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py2
-rw-r--r--src/engine/SCons/Scanner/__init__.py2
17 files changed, 45 insertions, 23 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index 598d3b1..3ac769a 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/C.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/C.py 5134 2010/08/16 23:02:40 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 f09333b..0b1d751 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/CTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/CTests.py 5134 2010/08/16 23:02:40 bdeegan"
import SCons.compat
diff --git a/src/engine/SCons/Scanner/D.py b/src/engine/SCons/Scanner/D.py
index 04bb5a7..2293ddd 100644
--- a/src/engine/SCons/Scanner/D.py
+++ b/src/engine/SCons/Scanner/D.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/D.py 5134 2010/08/16 23:02:40 bdeegan"
import re
diff --git a/src/engine/SCons/Scanner/Dir.py b/src/engine/SCons/Scanner/Dir.py
index 172aa62..df0de4e 100644
--- a/src/engine/SCons/Scanner/Dir.py
+++ b/src/engine/SCons/Scanner/Dir.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/Dir.py 5134 2010/08/16 23:02:40 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 debf213..e67d983 100644
--- a/src/engine/SCons/Scanner/DirTests.py
+++ b/src/engine/SCons/Scanner/DirTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/DirTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/DirTests.py 5134 2010/08/16 23:02:40 bdeegan"
import os.path
import sys
diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py
index 8d023e7..63d34e4 100644
--- a/src/engine/SCons/Scanner/Fortran.py
+++ b/src/engine/SCons/Scanner/Fortran.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/Fortran.py 5134 2010/08/16 23:02:40 bdeegan"
import re
@@ -89,11 +89,11 @@ class F90Scanner(SCons.Scanner.Classic):
defmodules = self.cre_def.findall(node.get_text_contents())
# Remove all USE'd module names that are defined in the same file
+ # (case-insensitively)
d = {}
for m in defmodules:
- d[m] = 1
- modules = [m for m in modules if m not in d]
- #modules = self.undefinedModules(modules, defmodules)
+ d[m.lower()] = 1
+ modules = [m for m in modules if m.lower() not in d]
# Convert module name to a .mod filename
suffix = env.subst('$FORTRANMODSUFFIX')
diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py
index 66eb057..92f6c21 100644
--- a/src/engine/SCons/Scanner/FortranTests.py
+++ b/src/engine/SCons/Scanner/FortranTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/FortranTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/FortranTests.py 5134 2010/08/16 23:02:40 bdeegan"
import os
import os.path
diff --git a/src/engine/SCons/Scanner/IDL.py b/src/engine/SCons/Scanner/IDL.py
index 507b9e1..8ccda1b 100644
--- a/src/engine/SCons/Scanner/IDL.py
+++ b/src/engine/SCons/Scanner/IDL.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/IDL.py 5134 2010/08/16 23:02:40 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 d434971..9e1cb8c 100644
--- a/src/engine/SCons/Scanner/IDLTests.py
+++ b/src/engine/SCons/Scanner/IDLTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/IDLTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/IDLTests.py 5134 2010/08/16 23:02:40 bdeegan"
import TestCmd
import SCons.Scanner.IDL
diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py
index 77be34c..ae542cf 100644
--- a/src/engine/SCons/Scanner/LaTeX.py
+++ b/src/engine/SCons/Scanner/LaTeX.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/LaTeX.py 5134 2010/08/16 23:02:40 bdeegan"
import os.path
import re
@@ -168,8 +168,11 @@ class LaTeX(SCons.Scanner.Base):
# 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.
- regex = r'^[^%\n]*\\(include|includegraphics(?:\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}'
+ # add option for whitespace before the '[options]' or the '{filename}'
+ regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage)\s*{([^}]*)}'
self.cre = re.compile(regex, re.M)
+ self.comment_re = re.compile(r'^((?:(?:\\%)|[^%\n])*)(.*)$', re.M)
+
self.graphics_extensions = graphics_extensions
def _scan(node, env, path=(), self=self):
@@ -274,6 +277,23 @@ class LaTeX(SCons.Scanner.Base):
return i, include
return i, include
+ def canonical_text(self, text):
+ """Standardize an input TeX-file contents.
+
+ Currently:
+ * removes comments, unwrapping comment-wrapped lines.
+ """
+ out = []
+ line_continues_a_comment = False
+ for line in text.splitlines():
+ line,comment = self.comment_re.findall(line)[0]
+ if line_continues_a_comment == True:
+ out[-1] = out[-1] + line.lstrip()
+ else:
+ out.append(line)
+ line_continues_a_comment = len(comment) > 0
+ return '\n'.join(out).rstrip()+'\n'
+
def scan(self, node):
# Modify the default scan function to allow for the regular
# expression to return a comma separated list of file names
@@ -281,11 +301,13 @@ class LaTeX(SCons.Scanner.Base):
# Cache the includes list in node so we only scan it once:
# path_dict = dict(list(path))
- noopt_cre = re.compile('\[.*$')
+ # add option for whitespace (\s) before the '['
+ noopt_cre = re.compile('\s*\[.*$')
if node.includes != None:
includes = node.includes
else:
- includes = self.cre.findall(node.get_text_contents())
+ text = self.canonical_text(node.get_text_contents())
+ includes = self.cre.findall(text)
# 1. Split comma-separated lines, e.g.
# ('bibliography', 'phys,comp')
# should become two entries
diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py
index 38c837f..2bbb9d6 100644
--- a/src/engine/SCons/Scanner/LaTeXTests.py
+++ b/src/engine/SCons/Scanner/LaTeXTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py 5134 2010/08/16 23:02:40 bdeegan"
import SCons.compat
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py
index 97f25b3..0312132 100644
--- a/src/engine/SCons/Scanner/Prog.py
+++ b/src/engine/SCons/Scanner/Prog.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/Prog.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/Prog.py 5134 2010/08/16 23:02:40 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 6e124e6..1d7a343 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/ProgTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/ProgTests.py 5134 2010/08/16 23:02:40 bdeegan"
import os.path
import sys
diff --git a/src/engine/SCons/Scanner/RC.py b/src/engine/SCons/Scanner/RC.py
index de7744b..9013a09 100644
--- a/src/engine/SCons/Scanner/RC.py
+++ b/src/engine/SCons/Scanner/RC.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/RC.py 5134 2010/08/16 23:02:40 bdeegan"
import SCons.Node.FS
import SCons.Scanner
diff --git a/src/engine/SCons/Scanner/RCTests.py b/src/engine/SCons/Scanner/RCTests.py
index 7da7e03..6f93413 100644
--- a/src/engine/SCons/Scanner/RCTests.py
+++ b/src/engine/SCons/Scanner/RCTests.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Scanner/RCTests.py 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/RCTests.py 5134 2010/08/16 23:02:40 bdeegan"
import TestCmd
import SCons.Scanner.RC
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index c70b8a6..140fc82 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/ScannerTests.py 5134 2010/08/16 23:02:40 bdeegan"
import SCons.compat
diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py
index 2a6f299..1a8dcbc 100644
--- a/src/engine/SCons/Scanner/__init__.py
+++ b/src/engine/SCons/Scanner/__init__.py
@@ -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 5023 2010/06/14 22:05:46 scons"
+__revision__ = "src/engine/SCons/Scanner/__init__.py 5134 2010/08/16 23:02:40 bdeegan"
import re