Issue 2255: Handle scanning of UTF-8 and UTF-16 files. (Greg Spencer)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 12 Dec 2008 06:16:31 +0000 (06:16 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 12 Dec 2008 06:16:31 +0000 (06:16 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@3829 fdb21ef1-2011-0410-befe-b5e4ea1792b1

28 files changed:
SConstruct
doc/SConscript
doc/man/scons.1
doc/user/scanners.in
doc/user/scanners.xml
src/CHANGES.txt
src/engine/SCons/Environment.py
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py
src/engine/SCons/SConfTests.py
src/engine/SCons/Scanner/D.py
src/engine/SCons/Scanner/Fortran.py
src/engine/SCons/Scanner/LaTeX.py
src/engine/SCons/Scanner/ScannerTests.py
src/engine/SCons/Scanner/__init__.py
src/engine/SCons/Tool/FortranCommon.py
src/engine/SCons/Tool/jar.py
src/engine/SCons/Tool/qt.py
src/engine/SCons/Tool/tex.py
test/Scanner/FindPathDirs.py
test/Scanner/Scanner.py
test/Scanner/dictionary.py
test/Scanner/exception.py
test/Scanner/multi-env.py
test/Scanner/source_scanner-dict.py
test/explain/basic.py
test/explain/save-info.py
test/srcchange.py

index 21c5d6f83534afc2201fd3494124cb3f0c785fa1..fbd00a259f8185bc60559a622325a705c753211e 100644 (file)
@@ -377,7 +377,7 @@ def soelim(target, source, env):
     tfp.close()
 
 def soscan(node, env, path):
-    c = node.get_contents()
+    c = node.get_text_contents()
     return re.compile(r"^[\.']so\s+(\S+)", re.M).findall(c)
 
 soelimbuilder = Builder(action = Action(soelim),
index e010ebf9f9ed80475c5dca8339b3c4f438cdc108..e4668fcd01ee44c6b7a959766f1aaa22bca519de 100644 (file)
@@ -76,7 +76,7 @@ format_re = re.compile(r'<(?:graphic|imagedata)\s+fileref="([^"]*)"(?:\s+format=
 def scanxml(node, env, target):
     includes = []
 
-    contents = node.get_contents()
+    contents = node.get_text_contents()
 
     includes.extend(entity_re.findall(contents))
 
index 300e14ce1af79524797ce41c6e1eb23174231273..5526c5e41193641b4453bd4f022f19cc2bd1b337 100644 (file)
@@ -9391,7 +9391,7 @@ source files of different types:
 
 .ES
 def xyz_scan(node, env, path):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     # Scan the contents and return the included files.
 
 XYZScanner = Scanner(xyz_scan)
@@ -9663,7 +9663,7 @@ import re
 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
 
 def kfile_scan(node, env, path, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include_re.findall(contents)
     return includes
 
@@ -9692,7 +9692,7 @@ for files that actually exist:
 include_re = re.compile(r'^include\\s+(\\S+)$', re.M)
 
 def my_scan(node, env, path, arg):
-   contents = node.get_contents()
+   contents = node.get_text_contents()
    includes = include_re.findall(contents)
    if includes == []:
         return []
index 63c07227f7114c9d2b789c6abe7804a77881b810..c585230cbd7f51a2a1fb1f29ebe783fedefc2656 100644 (file)
@@ -170,7 +170,7 @@ over the file scanning rather than being called for each input line:
       include_re = re.compile(r'^include\s+(\S+)$', re.M)
       
       def kfile_scan(node, env, path, arg):
-          contents = node.get_contents()
+          contents = node.get_text_contents()
           return include_re.findall(contents)
     </programlisting>
 
@@ -199,7 +199,7 @@ over the file scanning rather than being called for each input line:
       The path name to the file can be
       used by converting the node to a string
       using the <literal>str()</literal> function,
-      or an internal &SCons; <literal>get_contents()</literal>
+      or an internal &SCons; <literal>get_text_contents()</literal>
       object method can be used to fetch the contents.
 
       </para>
@@ -281,7 +281,7 @@ over the file scanning rather than being called for each input line:
         include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
         def kfile_scan(node, env, path):
-            contents = node.get_contents()
+            contents = node.get_text_contents()
             includes = include_re.findall(contents)
             return includes
 
index c068d037529592d486e9acb47bd13e52b90b414a..0fa4d2e260b4de47c4231f091fe6d209ab1c32de 100644 (file)
@@ -170,7 +170,7 @@ over the file scanning rather than being called for each input line:
       include_re = re.compile(r'^include\s+(\S+)$', re.M)
       
       def kfile_scan(node, env, path, arg):
-          contents = node.get_contents()
+          contents = node.get_text_contents()
           return include_re.findall(contents)
     </programlisting>
 
@@ -199,7 +199,7 @@ over the file scanning rather than being called for each input line:
       The path name to the file can be
       used by converting the node to a string
       using the <literal>str()</literal> function,
-      or an internal &SCons; <literal>get_contents()</literal>
+      or an internal &SCons; <literal>get_text_contents()</literal>
       object method can be used to fetch the contents.
 
       </para>
@@ -280,7 +280,7 @@ over the file scanning rather than being called for each input line:
         include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
         def kfile_scan(node, env, path):
-            contents = node.get_contents()
+            contents = node.get_text_contents()
             includes = include_re.findall(contents)
             return includes
 
index d8ab3c0d8e9a9c517459a9b2439e0132b2a0c08b..8249d82523e1bac742c8f25490012c74ef7d5d21 100644 (file)
@@ -22,6 +22,11 @@ RELEASE 1.X - XXX
 
     - Add detection of Microsoft Visual Studio 9.
 
+  From Greg Spencer:
+
+    - Support implicit dependency scanning of files encoded in utf-8
+      and utf-16.
+
   From Matthew Wesley:
 
     - Copy file attributes so we identify, and can link a shared library
index f6123b918833f556431596f56afb7960410c3a70..2304f2f0971026b998f888be4f9322a26ba432b1 100644 (file)
@@ -429,7 +429,7 @@ class SubstitutionEnvironment:
             self._dict[key] = value
 
     def get(self, key, default=None):
-        "Emulates the get() method of dictionaries."""
+        """Emulates the get() method of dictionaries."""
         return self._dict.get(key, default)
 
     def has_key(self, key):
index 98efc7aa6663fe3cb504f7ba6eea754ea17f38ee..bdc1bfd2cc2d1aa40b2a117285b04464976c3683 100644 (file)
@@ -35,8 +35,9 @@ that can be used by scripts or modules looking for the canonical default.
 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
-import fnmatch
 from itertools import izip
+import cStringIO
+import fnmatch
 import os
 import os.path
 import re
@@ -45,7 +46,11 @@ import stat
 import string
 import sys
 import time
-import cStringIO
+
+try:
+    import codecs
+except ImportError:
+    pass
 
 import SCons.Action
 from SCons.Debug import logInstanceCreation
@@ -876,11 +881,8 @@ class Entry(Base):
         return self.get_suffix()
 
     def get_contents(self):
-        """Fetch the contents of the entry.
-
-        Since this should return the real contents from the file
-        system, we check to see into what sort of subclass we should
-        morph this Entry."""
+        """Fetch the contents of the entry.  Returns the exact binary
+        contents of the file."""
         try:
             self = self.disambiguate(must_exist=1)
         except SCons.Errors.UserError:
@@ -893,6 +895,24 @@ class Entry(Base):
         else:
             return self.get_contents()
 
+    def get_text_contents(self):
+        """Fetch the decoded text contents of a Unicode encoded Entry.
+
+        Since this should return the text contents from the file
+        system, we check to see into what sort of subclass we should
+        morph this Entry."""
+        try:
+            self = self.disambiguate(must_exist=1)
+        except SCons.Errors.UserError:
+            # There was nothing on disk with which to disambiguate
+            # this entry.  Leave it as an Entry, but return a null
+            # string so calls to get_text_contents() in emitters and
+            # the like (e.g. in qt.py) don't have to disambiguate by
+            # hand or catch the exception.
+            return ''
+        else:
+            return self.get_text_contents()
+
     def must_be_same(self, klass):
         """Called to make sure a Node is a Dir.  Since we're an
         Entry, we can morph into one."""
@@ -1598,13 +1618,18 @@ class Dir(Base):
         """A directory does not get scanned."""
         return None
 
+    def get_text_contents(self):
+        """We already emit things in text, so just return the binary
+        version."""
+        return self.get_contents()
+
     def get_contents(self):
         """Return content signatures and names of all our children
         separated by new-lines. Ensure that the nodes are sorted."""
         contents = []
         name_cmp = lambda a, b: cmp(a.name, b.name)
         sorted_children = self.children()[:]
-        sorted_children.sort(name_cmp)        
+        sorted_children.sort(name_cmp)
         for node in sorted_children:
             contents.append('%s %s\n' % (node.get_csig(), node.name))
         return string.join(contents, '')
@@ -2236,12 +2261,28 @@ class File(Base):
             return ''
         fname = self.rfile().abspath
         try:
-            r = open(fname, "rb").read()
+            contents = open(fname, "rb").read()
         except EnvironmentError, e:
             if not e.filename:
                 e.filename = fname
             raise
-        return r
+        return contents
+
+    try:
+        import codecs
+    except ImportError:
+        get_text_contents = get_contents
+    else:
+        # This attempts to figure out what the encoding of the text is
+        # based upon the BOM bytes, and then decodes the contents so that
+        # it's a valid python string.
+        def get_text_contents(self):
+            contents = self.get_contents()
+            if contents.startswith(codecs.BOM_UTF8):
+                contents = contents.decode('utf-8')
+            elif contents.startswith(codecs.BOM_UTF16):
+                contents = contents.decode('utf-16')
+            return contents
 
     def get_content_hash(self):
         """
index bf6a300fe8beca7cfeb69f772f941f4ce3d664f4..424aa5eafe21e5cdddb45061338de10002568ef0 100644 (file)
@@ -1192,6 +1192,18 @@ class FSTestCase(_tempdirTestCase):
         f1 = fs.File(test.workpath("binary_file"))
         assert f1.get_contents() == "Foo\x1aBar", f1.get_contents()
 
+        try:
+            # TODO(1.5)
+            eval('test_string = u"Foo\x1aBar"')
+        except SyntaxError:
+            pass
+        else:
+            # This tests to make sure we can decode UTF-8 text files.
+            test.write("utf8_file", test_string.encode('utf-8'))
+            f1 = fs.File(test.workpath("utf8_file"))
+            assert eval('f1.get_text_contents() == u"Foo\x1aBar"'), \
+                   f1.get_text_contents()
+
         def nonexistent(method, s):
             try:
                 x = method(s, create = 0)
@@ -1257,18 +1269,44 @@ class FSTestCase(_tempdirTestCase):
         finally:
             test.unlink("file")
 
+        # test Entry.get_text_contents()
+        e = fs.Entry('does_not_exist')
+        c = e.get_text_contents()
+        assert c == "", c
+        assert e.__class__ == SCons.Node.FS.Entry
+
+        test.write("file", "file\n")
+        try:
+            e = fs.Entry('file')
+            c = e.get_text_contents()
+            assert c == "file\n", c
+            assert e.__class__ == SCons.Node.FS.File
+        finally:
+            test.unlink("file")
+
         test.subdir("dir")
         e = fs.Entry('dir')
         c = e.get_contents()
         assert c == "", c
         assert e.__class__ == SCons.Node.FS.Dir
 
+        c = e.get_text_contents()
+        try:
+            eval('assert c == u"", c')
+        except SyntaxError:
+            assert c == ""
+
         if hasattr(os, 'symlink'):
             os.symlink('nonexistent', test.workpath('dangling_symlink'))
             e = fs.Entry('dangling_symlink')
             c = e.get_contents()
             assert e.__class__ == SCons.Node.FS.Entry, e.__class__
             assert c == "", c
+            c = e.get_text_contents()
+            try:
+                eval('assert c == u"", c')
+            except SyntaxError:
+                assert c == "", c
 
         test.write("tstamp", "tstamp\n")
         try:
@@ -1712,6 +1750,7 @@ class DirTestCase(_tempdirTestCase):
         files = string.split(d.get_contents(), '\n')
 
         assert e.get_contents() == '', e.get_contents()
+        assert e.get_text_contents() == '', e.get_text_contents()
         assert e.get_csig()+" empty" == files[0], files
         assert f.get_csig()+" f" == files[1], files
         assert g.get_csig()+" g" == files[2], files
@@ -2758,6 +2797,48 @@ class RepositoryTestCase(_tempdirTestCase):
         finally:
             test.unlink(["rep3", "contents"])
 
+    def test_get_text_contents(self):
+        """Ensure get_text_contents() returns text contents from
+        Repositories"""
+        fs = self.fs
+        test = self.test
+
+        # Use a test string that has a file terminator in it to make
+        # sure we read the entire file, regardless of its contents.
+        try:
+            eval('test_string = u"Con\x1aTents\n"')
+        except SyntaxError:
+            import UserString
+            class FakeUnicodeString(UserString.UserString):
+                def encode(self, encoding):
+                    return str(self)
+            test_string = FakeUnicodeString("Con\x1aTents\n")
+
+
+        # Test with ASCII.
+        test.write(["rep3", "contents"], test_string.encode('ascii'))
+        try:
+            c = fs.File("contents").get_text_contents()
+            assert test_string == c, "got %s" % repr(c)
+        finally:
+            test.unlink(["rep3", "contents"])
+
+        # Test with utf-8
+        test.write(["rep3", "contents"], test_string.encode('utf-8'))
+        try:
+            c = fs.File("contents").get_text_contents()
+            assert test_string == c, "got %s" % repr(c)
+        finally:
+            test.unlink(["rep3", "contents"])
+
+        # Test with utf-16
+        test.write(["rep3", "contents"], test_string.encode('utf-16'))
+        try:
+            c = fs.File("contents").get_text_contents()
+            assert test_string == c, "got %s" % repr(c)
+        finally:
+            test.unlink(["rep3", "contents"])
+
     #def test_is_up_to_date(self):
 
 
index cef38893cb3c0cdba5741fcc2794519cc2823ce3..99744850e4d2c08dff6ad36e39e39d1b36c424b1 100644 (file)
@@ -335,7 +335,7 @@ int main() {
         self.scons_env[comp] = oldcomp
         self.scons_env['%sFLAGS' % comp] = 'qwertyuiop'
         r = func()
-        assert not r, "%s worked with %sFLAGS = qwertyuiop ?" % name
+        assert not r, "%s worked with %sFLAGS = qwertyuiop ?" % (name, comp)
 
     def test_CheckCC(self):
         """Test SConf.CheckCC()
index bfbcd5de390a8c904ca3eac6521fb5c7a82f1a8b..dc3478a49e7a4416886aaf6d4c78dee3218ca158 100644 (file)
@@ -63,6 +63,6 @@ class D(SCons.Scanner.Classic):
 
     def find_include_names(self, node):
         includes = []
-        for i in self.cre.findall(node.get_contents()):
+        for i in self.cre.findall(node.get_text_contents()):
             includes = includes + self.cre2.findall(i)
         return includes
index 31a1e169f86eca5cbec0d9238637831fb02f48d3..d2358ba7053b75b81166f85a7d159db35390b0fa 100644 (file)
@@ -84,11 +84,11 @@ class F90Scanner(SCons.Scanner.Classic):
             mods_and_includes = node.includes
         else:
             # retrieve all included filenames
-            includes = self.cre_incl.findall(node.get_contents())
+            includes = self.cre_incl.findall(node.get_text_contents())
             # retrieve all USE'd module names
-            modules = self.cre_use.findall(node.get_contents())
+            modules = self.cre_use.findall(node.get_text_contents())
             # retrieve all defined module names
-            defmodules = self.cre_def.findall(node.get_contents())
+            defmodules = self.cre_def.findall(node.get_text_contents())
 
             # Remove all USE'd module names that are defined in the same file
             d = {}
index c499ea581080467fee5db474c4174d58bb9a48ae..db7f555d246b028086241684f2b3adb76a3cfedd 100644 (file)
@@ -285,7 +285,7 @@ class LaTeX(SCons.Scanner.Base):
         if node.includes != None:
             includes = node.includes
         else:
-            includes = self.cre.findall(node.get_contents())
+            includes = self.cre.findall(node.get_text_contents())
             # 1. Split comma-separated lines, e.g.
             #      ('bibliography', 'phys,comp')
             #    should become two entries
index 6e9286a4b2640d9eed4d88ae054f58222b9c4aa7..f6750dcece86b10a4ae8b084702de7edc2c275d3 100644 (file)
@@ -481,6 +481,8 @@ class ClassicTestCase(unittest.TestCase):
                 return self._exists
             def get_contents(self):
                 return self._contents
+            def get_text_contents(self):
+                return self._contents
             def get_dir(self):
                 return self._dir
 
index 924b2716be1e127fd5d1d2f9a917e6f5aa6015b2..2d53cad264ec69daaa2164804875a58aef1e35b7 100644 (file)
@@ -347,7 +347,7 @@ class Classic(Current):
         return SCons.Node.FS._my_normcase(include)
 
     def find_include_names(self, node):
-        return self.cre.findall(node.get_contents())
+        return self.cre.findall(node.get_text_contents())
 
     def scan(self, node, path=()):
 
index 825cbe53d1d4e004bdff0b6da3f47a5bbd1c4f6b..bf32ffae05ce9a39aad6bda301e60d5a724394e7 100644 (file)
@@ -67,7 +67,7 @@ def _fortranEmitter(target, source, env):
     mod_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)"""
     cre = re.compile(mod_regex,re.M)
     # Retrieve all USE'd module names
-    modules = cre.findall(node.get_contents())
+    modules = cre.findall(node.get_text_contents())
     # Remove unique items from the list
     modules = SCons.Util.unique(modules)
     # Convert module name to a .mod filename
index 6594ecc51fe917e4067b5bc0b9c16df562d1a56a..7018c37d6645f3070b37b81c3a908313793e01e5 100644 (file)
@@ -49,7 +49,7 @@ def jarSources(target, source, env, for_signature):
             jarchdir = env.fs.Dir(jarchdir)
     result = []
     for src in source:
-        contents = src.get_contents()
+        contents = src.get_text_contents()
         if contents[:16] != "Manifest-Version":
             if jarchdir_set:
                 _chdir = jarchdir
@@ -70,7 +70,7 @@ def jarSources(target, source, env, for_signature):
 def jarManifest(target, source, env, for_signature):
     """Look in sources for a manifest file, if any."""
     for src in source:
-        contents = src.get_contents()
+        contents = src.get_text_contents()
         if contents[:16] == "Manifest-Version":
             return src
     return ''
@@ -80,7 +80,7 @@ def jarFlags(target, source, env, for_signature):
     flag is specified."""
     jarflags = env.subst('$JARFLAGS', target=target, source=source)
     for src in source:
-        contents = src.get_contents()
+        contents = src.get_text_contents()
         if contents[:16] == "Manifest-Version":
             if not 'm' in jarflags:
                 return jarflags + 'm'
index d67cddb77cf7e973e7cac9fa275b132181289928..e2aa4415d7e6c8a70e3f22d5871ee89d526c76ab 100644 (file)
@@ -138,8 +138,8 @@ class _Automoc:
                     print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) 
                 # c or fortran source
                 continue
-            #cpp_contents = comment.sub('', cpp.get_contents())
-            cpp_contents = cpp.get_contents()
+            #cpp_contents = comment.sub('', cpp.get_text_contents())
+            cpp_contents = cpp.get_text_contents()
             h=None
             for h_ext in header_extensions:
                 # try to find the header file in the corresponding source
@@ -149,8 +149,8 @@ class _Automoc:
                 if h:
                     if debug:
                         print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
-                    #h_contents = comment.sub('', h.get_contents())
-                    h_contents = h.get_contents()
+                    #h_contents = comment.sub('', h.get_text_contents())
+                    h_contents = h.get_text_contents()
                     break
             if not h and debug:
                 print "scons: qt: no header for '%s'." % (str(cpp))
@@ -221,7 +221,7 @@ def uicScannerFunc(node, env, path):
     lookout = []
     lookout.extend(env['CPPPATH'])
     lookout.append(str(node.rfile().dir))
-    includes = re.findall("<include.*?>(.*?)</include>", node.get_contents())
+    includes = re.findall("<include.*?>(.*?)</include>", node.get_text_contents())
     result = []
     for incFile in includes:
         dep = env.FindFile(incFile,lookout)
index 49da3d0dbf934323266cf81681c12f2f43b82c22..15e2d3e58f38818e15d366093c0a98bcfef57aa8 100644 (file)
@@ -198,7 +198,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
     # we have to run makeindex at least once to keep the build
     # happy even if there is no index.
     # Same for glossaries and nomenclature
-    src_content = source[0].get_contents()
+    src_content = source[0].get_text_contents()
     run_makeindex = makeindex_re.search(src_content) and not os.path.exists(targetbase + '.idx')
     run_nomenclature = makenomenclature_re.search(src_content) and not os.path.exists(targetbase + '.nlo')
     run_glossary = makeglossary_re.search(src_content) and not os.path.exists(targetbase + '.glo')
@@ -373,7 +373,7 @@ LaTeX_re = re.compile("\\\\document(style|class)")
 def is_LaTeX(flist):
     # Scan a file list to decide if it's TeX- or LaTeX-flavored.
     for f in flist:
-        content = f.get_contents()
+        content = f.get_text_contents()
         if LaTeX_re.search(content):
             return 1
     return 0
@@ -422,7 +422,7 @@ def tex_pdf_emitter(target, source, env):
 def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir):
     # for theFile (a Node) update any file_tests and search for graphics files
     # then find all included files and call ScanFiles for each of them
-    content = theFile.get_contents()
+    content = theFile.get_text_contents()
     if Verbose:
         print " scanning ",str(theFile)
 
@@ -498,7 +498,7 @@ def tex_emitter_core(target, source, env, graphics_extensions):
     env.Clean(target[0],auxfilename)
     env.Clean(target[0],logfilename)
 
-    content = source[0].get_contents()
+    content = source[0].get_text_contents()
 
     idx_exists = os.path.exists(targetbase + '.idx')
     nlo_exists = os.path.exists(targetbase + '.nlo')
index 901d757fa0209a3cf4dd2ee3b243d7a94ffe98c7..bb8f929694981802da36757e05d2b8f987d2bdd8 100644 (file)
@@ -79,7 +79,7 @@ import re
 include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
 def kfile_scan(node, env, path, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include_re.findall(contents)
     if includes == []:
          return []
index 16f3d196bae143d929957faabed6b8f6e013d30a..80eab03a7770414a6ed9d0183edd9675f331f3ec 100644 (file)
@@ -65,7 +65,7 @@ import re
 include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
 def kfile_scan(node, env, scanpaths, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include_re.findall(contents)
     return includes
 
@@ -117,7 +117,7 @@ import string
 
 def blork(env, target, source):
     open(str(target[0]), 'wb').write(
-        string.replace(source[0].get_contents(), 'getfile', 'MISSEDME'))
+        string.replace(source[0].get_text_contents(), 'getfile', 'MISSEDME'))
 
 kbld = Builder(action=r'%(_python_)s build.py $SOURCES $TARGET',
                src_suffix='.lork',
index 62fda9b09c5b6eba5ebb6821b905f2b0caab3675..b3baaa3252059fd6de582f08774ebdcc3a2447ba 100644 (file)
@@ -69,17 +69,17 @@ include2_re = re.compile(r'^include2\s+(\S+)$', re.M)
 include3_re = re.compile(r'^include3\s+(\S+)$', re.M)
 
 def kfile_scan1(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include1_re.findall(contents)
     return includes
 
 def kfile_scan2(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include2_re.findall(contents)
     return includes
 
 def kfile_scan3(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include3_re.findall(contents)
     return includes
 
index 5d10fd735e957d13fe963659632af407935ef393..31e571d6bff7c41a41ce739dd86eddc51a43263b 100644 (file)
@@ -46,7 +46,7 @@ include_re = re.compile(r'^include\s+(\S+)$', re.M)
 exception_re = re.compile(r'^exception\s+(.+)$', re.M)
 
 def kfile_scan(node, env, target, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     exceptions = exception_re.findall(contents)
     if exceptions:
         raise Exception, "kfile_scan error:  %s" % exceptions[0]
index 514fbca6c63d0be8e1e03d25f645a9d90a51c52e..c64f970dff0c3346ccc225c2005144c503e86cfc 100644 (file)
@@ -44,12 +44,12 @@ include_re = re.compile(r'^include\s+(\S+)$', re.M)
 input_re = re.compile(r'^input\s+(\S+)$', re.M)
 
 scan1 = Scanner(name = 'Include',
-                function = lambda N,E,P,A: A.findall(N.get_contents()),
+                function = lambda N,E,P,A: A.findall(N.get_text_contents()),
                 argument = include_re,
                 skeys = ['.inp'])
 
 scan2 = Scanner(name = 'Input',
-                function = lambda N,E,P,A: A.findall(N.get_contents()),
+                function = lambda N,E,P,A: A.findall(N.get_text_contents()),
                 argument = input_re,
                 skeys = ['.inp'])
 
index 1ac15a8279a823adcf387fd2940075487e019a10..5c0a89f9661d7ab12c0dfb36e6f10e92f326e640 100644 (file)
@@ -73,17 +73,17 @@ include2_re = re.compile(r'^include2\s+(\S+)$', re.M)
 include3_re = re.compile(r'^include3\s+(\S+)$', re.M)
 
 def k1_scan(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include1_re.findall(contents)
     return includes
 
 def k2_scan(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include2_re.findall(contents)
     return includes
 
 def k3_scan(node, env, scanpaths, arg=None):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include3_re.findall(contents)
     return includes
 
index e1198d5aacb95738e3cf1ab6948fbed321b47dab..b30e60436c7eeeccb215366bdf04d098010afd84 100644 (file)
@@ -83,7 +83,7 @@ import re
 include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
 def kfile_scan(node, env, target, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include_re.findall(contents)
     return includes
 
index 0d8f5c79f76390f5b0875dfc2355fa649ba397a2..b72b3fb82d84036c8b8667688beaf7f82702401a 100644 (file)
@@ -75,7 +75,7 @@ import re
 include_re = re.compile(r'^include\s+(\S+)$', re.M)
 
 def kfile_scan(node, env, target, arg):
-    contents = node.get_contents()
+    contents = node.get_text_contents()
     includes = include_re.findall(contents)
     return includes
 
index 0b56442bf358553c04d07839b19a8b8f9a6015c1..6cda3dd429c8ef5d140904fff08eec457665e33a 100644 (file)
@@ -53,10 +53,10 @@ import re
 import string
 
 def subrevision(target, source ,env):
-    orig = target[0].get_contents()
+    orig = target[0].get_text_contents()
     new = re.sub('\$REV.*?\$',
-                 '$REV: %%s$'%%string.strip(source[0].get_contents()),
-                 target[0].get_contents())
+                 '$REV: %%s$'%%string.strip(source[0].get_text_contents()),
+                 target[0].get_text_contents())
     outf = open(str(target[0]),'wb')
     outf.write(new)
     outf.close()