diff options
author | jakub <jakub> | 2000-01-10 13:56:56 +0000 |
---|---|---|
committer | jakub <jakub> | 2000-01-10 13:56:56 +0000 |
commit | 79b4b003cb0a88b4577cd249a61fd684bf3f4f48 (patch) | |
tree | 8d0f5a7b196fc269c1ca9e87f1795ebe7a09e573 /gettext_rh.py | |
parent | e72e153e1211696c216eb6f421aa25f8da717131 (diff) | |
download | anaconda-79b4b003cb0a88b4577cd249a61fd684bf3f4f48.tar.gz anaconda-79b4b003cb0a88b4577cd249a61fd684bf3f4f48.tar.xz anaconda-79b4b003cb0a88b4577cd249a61fd684bf3f4f48.zip |
Misc sparc fixes.
Use stripped down gzread to uncompress .mo files when loading them, so
we don't have to gunzip them in the filesystem.
Diffstat (limited to 'gettext_rh.py')
-rw-r--r-- | gettext_rh.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/gettext_rh.py b/gettext_rh.py index 4c7d38030..a9b44a156 100644 --- a/gettext_rh.py +++ b/gettext_rh.py @@ -40,7 +40,7 @@ compile it into a .mo file, ready for use with this module. Note that you will have to use C style strings (ie. use double quotes) for proper string extraction. """ -import os, string, iutil +import os, string, iutil, gzread prefix = '/usr/local' localedir = prefix + '/share/locale' @@ -145,33 +145,22 @@ class Catalog: self.localedir = localedir self.cat = {} if not domain: return - import os for self.lang in lang: if self.lang == 'C': - del os return - catalog = "%s//%s/LC_MESSAGES/%s.mo" % ( + catalog = "%s/%s/LC_MESSAGES/%s.mo" % ( localedir, self.lang, domain) - if not os.access (catalog, os.R_OK) and os.access (catalog + ".gz", os.R_OK): - os.system ("/usr/bin/gunzip < %s.gz > %s " % (catalog, catalog)) - try: - f = open(catalog, "rb") + f = gzread.open(catalog) buffer = f.read() + f.close() del f - if os.access (catalog + ".gz", os.R_OK): - try: - os.remove (catalog) - except: - pass break except IOError: pass else: - del os return # assume C locale - del os if _StrToInt(buffer[:4]) != 0x950412de: # magic number doesn't match raise error, 'Bad magic number in %s' % (catalog,) |