]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Fixes on pyfire.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Apr 2008 21:22:25 +0000 (23:22 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Apr 2008 21:22:25 +0000 (23:22 +0200)
src/pyfire/src/executil.py
src/pyfire/src/translate.py

index 1e8114012be2429ddeb04637845fe74d2131aa81..c36f1e94a163d705bfab4186a4d1394f2e4976b9 100644 (file)
@@ -42,37 +42,37 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2,
        childpid = os.fork()
        if (not childpid):
                if (root and root != '/'): 
-                       os.chroot (root)
+                       os.chroot(root)
                        os.chdir("/")
 
-       if ignoreTermSigs:
-               signal.signal(signal.SIGTSTP, signal.SIG_IGN)
-               signal.signal(signal.SIGINT, signal.SIG_IGN)
-
-       if type(stdin) == type("a"):
-               stdin = os.open(stdin, os.O_RDONLY)
-       if type(stdout) == type("a"):
-               stdout = os.open(stdout, os.O_RDWR)
-       if type(stderr) == type("a"):
-               stderr = os.open(stderr, os.O_RDWR)
-
-       if stdin != 0:
-               os.dup2(stdin, 0)
-               os.close(stdin)
-       if stdout != 1:
-               os.dup2(stdout, 1)
-               if stdout != stderr:
-                       os.close(stdout)
-       if stderr != 2:
-               os.dup2(stderr, 2)
-               os.close(stderr)
-
-       if (searchPath):
-               os.execvp(command, argv)
-       else:
-               os.execv(command, argv)
+               if ignoreTermSigs:
+                       signal.signal(signal.SIGTSTP, signal.SIG_IGN)
+                       signal.signal(signal.SIGINT, signal.SIG_IGN)
+       
+               if type(stdin) == type("a"):
+                       stdin = os.open(stdin, os.O_RDONLY)
+               if type(stdout) == type("a"):
+                       stdout = os.open(stdout, os.O_RDWR)
+               if type(stderr) == type("a"):
+                       stderr = os.open(stderr, os.O_RDWR)
+       
+               if stdin != 0:
+                       os.dup2(stdin, 0)
+                       os.close(stdin)
+               if stdout != 1:
+                       os.dup2(stdout, 1)
+                       if stdout != stderr:
+                               os.close(stdout)
+               if stderr != 2:
+                       os.dup2(stderr, 2)
+                       os.close(stderr)
+       
+               if (searchPath):
+                       os.execvp(command, argv)
+               else:
+                       os.execv(command, argv)
 
-       sys.exit(1)
+               sys.exit(1)
 
        if newPgrp:
                os.setpgid(childpid, childpid)
@@ -105,19 +105,19 @@ def execWithCapture(command, argv, searchPath = 0, root = '/', stdin = 0,
                os.close(write)
                os.close(read)
 
-       if closefd != -1:
-               os.close(closefd)
-
-       if stdin:
-               os.dup2(stdin, 0)
-               os.close(stdin)
-
-       if (searchPath):
-               os.execvp(command, argv)
-       else:
-               os.execv(command, argv)
-
-       sys.exit(1)
+               if closefd != -1:
+                       os.close(closefd)
+       
+               if stdin:
+                       os.dup2(stdin, 0)
+                       os.close(stdin)
+       
+               if (searchPath):
+                       os.execvp(command, argv)
+               else:
+                       os.execv(command, argv)
+       
+               sys.exit(1)
 
        os.close(write)
 
index 11aa588811814e1625e534c3853438be488b9813..b0b61e64342d7437f818f79db9e60d2fa675b6e9 100644 (file)
@@ -93,7 +93,7 @@ class i18n:
                        for dom in domain:
                                if dom in self.domains:
                                        self.domains.pop(self.domains.index(dom))
-                                       self.domains.insert(0, dom)
+                               self.domains.insert(0, dom)
                else:
                        if domain in self.domains:
                                self.domains.pop(self.domains.index(domain))
@@ -149,18 +149,18 @@ class i18n:
                                        self.iconv = theiconv
                                break
        
-                       # now let's put None at the beginning of the list as it corresponds
-                       # to the "current" local po files for testing
-                       self.domains.insert(0, None)
+               # now let's put None at the beginning of the list as it corresponds
+               # to the "current" local po files for testing
+               self.domains.insert(0, None)
        
-                       if len(self.cats) == 0:
-                               encoding = locale.nl_langinfo (locale.CODESET)
-#                              sys.stderr.write("WARNING: Unable to find catalog, using %s for codeset, %s for encoding\n" %(self.codeset, encoding))
-                               try:
-                                       self.iconv = iconv.open(self.codeset, encoding)
-                               except:
-                                       sys.stderr.write("FAILED to create iconv with codeset %s and encoding %s\n" %(self.codeset, encoding));
-                               return
+               #if len(self.cats) == 0:
+               #       encoding = locale.nl_langinfo(locale.CODESET)
+               #       sys.stderr.write("WARNING: Unable to find catalog, using %s for codeset, %s for encoding\n" %(self.codeset, encoding))
+               #       try:
+               #               self.iconv = iconv.open(self.codeset, encoding)
+               #       except:
+               #               sys.stderr.write("FAILED to create iconv with codeset %s and encoding %s\n" %(self.codeset, encoding));
+               #       return
 
        def setDomainCodeset(self, domain, codeset):
                self.codeset = codeset