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

List:       kde-commits
Subject:    l10n-support/pology
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2009-12-26 23:00:13
Message-ID: 1261868413.340559.2756.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1066380 by ilic:

Equipped some scripts with option to get files to process from another file.

 M  +18 -2     l10n/sr/scripts/pohybdl.py  
 M  +19 -1     scripts/poascribe.py  


--- trunk/l10n-support/pology/l10n/sr/scripts/pohybdl.py #1066379:1066380
@@ -40,6 +40,11 @@
         action="store_true", dest="accept_changes", default=False,
         help="Accept messages which have some changes between initial "
              "and reconstructed Ekavian translation.")
+    opars.add_option(
+        "-f", "--files-from", metavar="FILE",
+        action="append", dest="files_from", default=[],
+        help="get list of input files from FILE, which contains one file path "
+             "per line; can be repeated to collect paths from several files")
 
     (options, free_args) = opars.parse_args(str_to_unicode(sys.argv[1:]))
 
@@ -60,15 +65,26 @@
         error("Unknown version control system '%s'." % vcskey)
     vcs = make_vcs(vcskey)
 
+    # Collect list of raw paths supplied through command line.
+    # If none supplied, assume current working directory.
+    paths = None
+    if free_args:
+        paths = free_args
+    if options.files_from:
+        if paths is None:
+            paths = []
+        for fpath in options.files_from:
+            paths.extend(open(fpath).read().rstrip("\n").split("\n"))
+    if paths is None:
+        paths = ["."]
+
     # Sanity checks on paths.
-    paths = free_args or ["."] # default to CWD if no paths given
     for path in paths:
         if not os.path.exists(path):
             error("Path '%s' does not exist." % path)
         if not vcs.is_versioned(path):
             error("Path '%s' is not under version control." % path)
 
-
     # Collect modified PO files in given paths.
     modpaths = []
     for path in paths:
--- trunk/l10n-support/pology/scripts/poascribe.py #1066379:1066380
@@ -128,6 +128,11 @@
         help="write paths of all original catalogs modified by "
              "ascription operations into the given file")
     opars.add_option(
+        "-f", "--files-from", metavar="FILE",
+        action="append", dest="files_from", default=[],
+        help="get list of input files from FILE, which contains one file path "
+             "per line; can be repeated to collect paths from several files")
+    opars.add_option(
         "-v", "--verbose",
         action="store_true", dest="verbose", default=False,
         help="output more detailed progress info")
@@ -222,8 +227,21 @@
     if not canaselect and aselector:
         error("operation mode does not accept history selectors")
 
+    # Collect list of raw paths supplied through command line.
+    # If none supplied, assume current working directory.
+    rawpaths = None
+    if free_args:
+        rawpaths = free_args
+    if options.files_from:
+        if rawpaths is None:
+            rawpaths = []
+        for fpath in options.files_from:
+            rawpaths.extend(open(fpath).read().rstrip("\n").split("\n"))
+    if rawpaths is None:
+        rawpaths = ["."]
+
     # Collect the config which covers each path, and all catalogs inside it.
-    configs_catpaths = collect_configs_catpaths(free_args or ["."])
+    configs_catpaths = collect_configs_catpaths(rawpaths)
 
     # Execute operation.
     mode.execute(options, configs_catpaths, mode)
[prev in list] [next in list] [prev in thread] [next in thread] 

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