From: Michael Tremer Date: Sun, 6 Apr 2008 21:22:25 +0000 (+0200) Subject: Fixes on pyfire. X-Git-Tag: v3.0-alpha1~1058 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8548a654b1b84f2e782b0e8fbf585b217f68fc71;p=ipfire-3.x.git Fixes on pyfire. --- diff --git a/src/pyfire/src/executil.py b/src/pyfire/src/executil.py index 1e8114012..c36f1e94a 100644 --- a/src/pyfire/src/executil.py +++ b/src/pyfire/src/executil.py @@ -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) diff --git a/src/pyfire/src/translate.py b/src/pyfire/src/translate.py index 11aa58881..b0b61e643 100644 --- a/src/pyfire/src/translate.py +++ b/src/pyfire/src/translate.py @@ -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