[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    l10n-kde4/scripts/pology
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2008-01-30 13:32:31
Message-ID: 1201699951.928259.11863.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 768616 by ilic:

Hooks on scatter for the whole catalog.

 M  +18 -3     posummit.py  


--- trunk/l10n-kde4/scripts/pology/posummit.py #768615:768616
@@ -134,6 +134,7 @@
             "branches_split_tags" : True,
 
             "hook_on_scatter_msgstr" : [],
+            "hook_on_scatter_cat" : [],
             "hook_on_scatter_file" : [],
             "hook_on_gather_file" : [],
         })
@@ -311,9 +312,9 @@
                 p.full_inverse_map[summit_name][branch_id].append(summit_name)
 
     # Fill in defaults for missing fields in hook specs.
-    p.hook_on_scatter_msgstr = hook_fill_defaults(p.hook_on_scatter_msgstr)
-    p.hook_on_scatter_file = hook_fill_defaults(p.hook_on_scatter_file)
-    p.hook_on_gather_file = hook_fill_defaults(p.hook_on_gather_file)
+    for attr in p.__dict__:
+        if attr.startswith("hook_"):
+            p.__dict__[attr] = hook_fill_defaults(p.__dict__[attr])
 
     return p
 
@@ -921,6 +922,10 @@
                 # Summit catalog didn't contain this field, append it.
                 branch_cat.header.field.append(field)
 
+    # Apply hooks to the branch catalog.
+    exec_hook_cat(branch_id, branch_name, branch_cat,
+                  project.hook_on_scatter_cat)
+
     # Commit changes to the branch catalog.
     if branch_cat.sync():
 
@@ -949,6 +954,16 @@
     return piped_msgstr
 
 
+# Pipe catalog through hook calls,
+# for which branch id and catalog name match hook specification.
+def exec_hook_cat (branch_id, branch_name, cat, hooks):
+
+    # Apply all hooks to the catalog.
+    for call, branch_rx, name_rx in hooks:
+        if re.search(branch_rx, branch_id) and re.search(name_rx, branch_name):
+            call(cat)
+
+
 # Pipe catalog file through hook calls,
 # for which branch id and catalog name match hook specification.
 def exec_hook_file (branch_id, branch_name, filepath, hooks):
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic