[ooo-build-commit] .: bin/parse-scp2.py

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Jul 13 15:41:46 PDT 2010


 bin/parse-scp2.py |   28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

New commits:
commit 4a865e1e42f9b4d5d1ee2db2e3300de062821161
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Jul 13 18:38:32 2010 -0400

    Catch all legitimate node types from .scp files.
    
    Also, skip files that contain malformed errors.  It seems that
    scp2/source/ooo/file_resource_ooo.scp contains a macro that's not
    defined anywhere.  Is that file even processed during the build,
    I wonder...
    
    * bin/parse-scp2.py:

diff --git a/bin/parse-scp2.py b/bin/parse-scp2.py
index 4686ad0..bca54dd 100755
--- a/bin/parse-scp2.py
+++ b/bin/parse-scp2.py
@@ -7,6 +7,9 @@ arg_desc = ""
 desc = """
 Run this script at the root of OOo source tree."""
 
+def error (msg):
+    sys.stderr.write(msg + "\n")
+
 class ErrorBase(Exception):
     
     def __init__ (self, name, msg):
@@ -28,6 +31,24 @@ class Scp2Parser(object):
         Directory  = 1
         FolderItem = 2
 
+    NodeTypes = [
+        'DataCarrier',
+        'Directory', 
+        'File', 
+        'Folder',
+        'FolderItem', 
+        'Installation', 
+        'Module',
+        'Profile',
+        'ProfileItem',
+        'RegistryItem', 
+        'ScpAction',
+        'Shortcut',
+        'StarRegistry',
+        'Unixlink',
+        'WindowsCustomAction'
+    ]
+
     def __init__ (self, content):
         self.content = content
 
@@ -58,7 +79,7 @@ class Scp2Parser(object):
         self.n = len(self.tokens)
         while self.i < self.n:
             t = self.token()
-            if t in ['File', 'Directory', 'FolderItem', 'RegistryItem', 'Installation', 'Module']:
+            if t in Scp2Parser.NodeTypes:
                 name, attrs = self.__parseEntity()
                 print name
                 print attrs
@@ -143,9 +164,8 @@ class Scp2Processor(object):
         try:
             parser.parse()
         except ParseError as e:
-            print (e.value)
-            print ("Error parsing %s"%scp)
-            sys.exit(1)
+            error (e.value)
+            error ("Error parsing %s"%scp)
 
     @staticmethod
     def visit (arg, dirname, names):


More information about the ooo-build-commit mailing list