packages: pynapi/pynapi.py - destdir support from Kamil Jakubowski

arekm arekm at pld-linux.org
Wed Nov 11 20:23:56 CET 2009


Author: arekm                        Date: Wed Nov 11 19:23:56 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- destdir support from Kamil Jakubowski

---- Files affected:
packages/pynapi:
   pynapi.py (1.31 -> 1.32) 

---- Diffs:

================================================================
Index: packages/pynapi/pynapi.py
diff -u packages/pynapi/pynapi.py:1.31 packages/pynapi/pynapi.py:1.32
--- packages/pynapi/pynapi.py:1.31	Sun Sep 27 10:58:53 2009
+++ packages/pynapi/pynapi.py	Wed Nov 11 20:23:51 2009
@@ -66,6 +66,7 @@
     print >> sys.stderr, "     -l, --lang=LANG       subtitles language"
     print >> sys.stderr, "     -n, --nobackup        make no backup when in update mode"
     print >> sys.stderr, "     -u, --update          fetch new and also update existing subtitles"
+    print >> sys.stderr, "     -d, --dest=DIR        destination directory"
     print >> sys.stderr
     print >> sys.stderr, "pynapi $Revision$"
     print >> sys.stderr
@@ -89,7 +90,7 @@
 def main(argv=sys.argv):
 
     try:
-        opts, args = getopt.getopt(argv[1:], "hl:nu", ["help", "lang", "nobackup", "update"])
+        opts, args = getopt.getopt(argv[1:], "d:hl:nu", ["dest", "help", "lang", "nobackup", "update"])
     except getopt.GetoptError, err:
         print str(err)
         usage()
@@ -100,6 +101,7 @@
     nobackup = False
     update = False
     lang = 'pl'
+    dest = None
     for o, a in opts:
         if o == "-v":
             verbose = True
@@ -116,6 +118,8 @@
             nobackup = True
         elif o in ("-u", "--update"):
             update = True
+        elif o in ("-d", "--dest"):
+            dest = a
         else:
             print >> sys.stderr, "%s: unhandled option" % prog
             return 1
@@ -147,6 +151,8 @@
         vfile = file + '.txt'
         if len(file) > 4:
             vfile = file[:-4] + '.txt'
+        if dest:
+            vfile = os.path.join(dest, os.path.split(vfile)[1])
 
         if not update and os.path.exists(vfile):
             continue
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/pynapi/pynapi.py?r1=1.31&r2=1.32&f=u



More information about the pld-cvs-commit mailing list