Package: linda
Version: 0.3.15

Hi,

This is a workaround patch to work around limitations in python2.3


When you are going to move over to python 2.4, 
you can replace this piece with 

_ = gettext.translation('linda').lgettext

regards,
        junichi


diff -ur linda-0.3.15-orig/bootstrap.py linda-0.3.15/bootstrap.py
--- linda-0.3.15-orig/bootstrap.py      2005-04-23 22:49:19.000000000 +0900
+++ linda-0.3.15/bootstrap.py   2005-07-16 15:42:51.741468792 +0900
@@ -1,4 +1,4 @@
-import os, sys, re, gettext, linda
+import os, sys, re, gettext, linda, locale
 from linda import clparser
 from linda.debug import dprint
 from linda.eggs import LindaEasterEggs
@@ -6,8 +6,11 @@
 from linda.output import OutputFormats
 from linda.parser.changes import ChangesParser
 from linda.parser.config import ConfigFileParser, ConfigFileParserException
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 try:
     ConfigFileParser()
 except ConfigFileParserException, e:
diff -ur linda-0.3.15-orig/checker.py linda-0.3.15/checker.py
--- linda-0.3.15-orig/checker.py        2005-04-02 21:46:40.000000000 +0900
+++ linda-0.3.15/checker.py     2005-07-16 15:43:16.827655112 +0900
@@ -1,4 +1,4 @@
-import os, linda, gettext
+import os, linda, gettext, locale
 from linda import clparser
 from linda.debug import dprint, vprint
 from linda.err_print import PrintErrors, ErrorPrintingException
@@ -7,8 +7,11 @@
 from linda.unpack import Unpacker, UnpackException
 from linda.parser.data import DataFileParser
 from linda.parser.override import OverrideParser
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 class Checker:
     def __init__(self):
         self.mapping = {'deb': 'binary', 'dsc': 'source', 'changes': 'changes'}
linda-0.3.15/debianだけに発見: copyright
linda-0.3.15/debianだけに発見: files
linda-0.3.15/debianだけに発見: linda
linda-0.3.15/debianだけに発見: linda.postinst.debhelper
linda-0.3.15/debianだけに発見: linda.prerm.debhelper
linda-0.3.15/debianだけに発見: linda.substvars
diff -ur linda-0.3.15-orig/debug.py linda-0.3.15/debug.py
--- linda-0.3.15-orig/debug.py  2005-03-25 18:44:59.000000000 +0900
+++ linda-0.3.15/debug.py       2005-07-16 15:43:56.897563560 +0900
@@ -1,7 +1,11 @@
-import gettext
+import gettext, locale
 from linda import clparser
-_ = gettext.gettext
 
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext 
 def dprint(msg, level=1, slashn=1, printd=1):
     if clparser['debug'] >= level:
         if printd:
diff -ur linda-0.3.15-orig/eggs.py linda-0.3.15/eggs.py
--- linda-0.3.15-orig/eggs.py   2005-03-25 18:44:59.000000000 +0900
+++ linda-0.3.15/eggs.py        2005-07-16 15:44:08.190846720 +0900
@@ -1,5 +1,9 @@
-import time, gettext
-_ = gettext.gettext
+import time, gettext, locale
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 
 class LindaEasterEggs:
     def __init__(self):
diff -ur linda-0.3.15-orig/err_print.py linda-0.3.15/err_print.py
--- linda-0.3.15-orig/err_print.py      2005-04-23 22:49:19.000000000 +0900
+++ linda-0.3.15/err_print.py   2005-07-16 15:45:06.932916568 +0900
@@ -1,10 +1,13 @@
-import os, linda, gettext
+import os, linda, gettext, locale
 from linda import clparser
 from linda.debug import dprint
 from linda.output import OutputException
 from linda.parser.debfilename import DebFilenameParser
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 class PrintErrors:
     def __init__(self, file):
         debfn = DebFilenameParser(file)
diff -ur linda-0.3.15-orig/libchecks.py linda-0.3.15/libchecks.py
--- linda-0.3.15-orig/libchecks.py      2005-04-23 22:49:19.000000000 +0900
+++ linda-0.3.15/libchecks.py   2005-07-16 15:44:24.563357720 +0900
@@ -1,10 +1,13 @@
-import sys, os, re, string, traceback, gettext, linda
+import sys, os, re, string, traceback, gettext, linda, locale
 from linda import root, clparser, outputobj
 from linda.debug import dprint
 from linda.parser.datavalidator import DataValidator
 from linda.parser.debfilename import DebFilenameParser
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 class LindaChecker:
     def __init__(self, lab, file, information):
         self.lab = lab
diff -ur linda-0.3.15-orig/linda linda-0.3.15/linda
--- linda-0.3.15-orig/linda     2005-05-15 11:30:56.000000000 +0900
+++ linda-0.3.15/linda  2005-07-16 15:44:35.196741200 +0900
@@ -29,12 +29,18 @@
 
 ###########################################################
 
-import sys, traceback, gettext
-gettext.bindtextdomain('linda')
-gettext.textdomain('linda')
-_ = gettext.gettext
+import sys, traceback, gettext, locale
+
+# This is for python 2.3 compatibility.
+# Replace with "_ = gettext.translation('linda').lgettext" line.
+#
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 try:
-    import os, pwd, gettext, locale, linda
+    import os, pwd, gettext, linda
     from linda import clparser, root
     from linda.debug import dprint, vprint
     from linda.checker import Checker, CheckerException
diff -ur linda-0.3.15-orig/mygettext.py linda-0.3.15/mygettext.py
--- linda-0.3.15-orig/mygettext.py      2005-05-09 13:25:43.000000000 +0900
+++ linda-0.3.15/mygettext.py   2005-07-16 15:44:44.732291576 +0900
@@ -1,9 +1,12 @@
 # Copyright 2003 Steve Kowalik. Heavily based on gettext.py from Python 2.3.
-import os, copy, linda, gettext
+import os, copy, linda, gettext, locale
 from gettext import _translations
 from linda.debug import dprint
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 def translation(domain):
     mofiles = find(domain)
     dprint(_(".mo files found: %s") % mofiles, 2)
diff -ur linda-0.3.15-orig/output.py linda-0.3.15/output.py
--- linda-0.3.15-orig/output.py 2005-06-17 20:24:28.000000000 +0900
+++ linda-0.3.15/output.py      2005-07-16 15:44:52.268145952 +0900
@@ -1,9 +1,12 @@
-import sys, os, re, gettext, textwrap, traceback
+import sys, os, re, gettext, textwrap, traceback, locale
 from linda import clparser
 from linda.debug import dprint
 from linda.mygettext import translation
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 class Output:
     def __init__(self):
         self.check_type = self.tag = self.pkg_name = self.desc = ''
diff -ur linda-0.3.15-orig/overrides.py linda-0.3.15/overrides.py
--- linda-0.3.15-orig/overrides.py      2005-05-13 20:45:22.000000000 +0900
+++ linda-0.3.15/overrides.py   2005-07-16 15:45:05.991059752 +0900
@@ -1,11 +1,14 @@
-import os, re, commands, gettext
+import os, re, commands, gettext, locale
 from linda import root, clparser
 from linda.debug import dprint
 from linda.funcs import run_external_cmd, ExtCmdException
 from linda.parser.debfilename import DebFilenameParser
 from linda.parser.override import OverrideParser
-_ = gettext.gettext
-
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 class Overrides:
     def __init__(self, file, lab):
         self.file = file
diff -ur linda-0.3.15-orig/parser/clparser.py linda-0.3.15/parser/clparser.py
--- linda-0.3.15-orig/parser/clparser.py        2005-05-15 11:17:17.000000000 
+0900
+++ linda-0.3.15/parser/clparser.py     2005-07-16 15:46:38.592982120 +0900
@@ -1,5 +1,9 @@
-import os, sys, re, getopt, gettext
-_ = gettext.gettext
+import os, sys, re, getopt, gettext, locale
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 
 class CLParser:
     def __init__(self):
diff -ur linda-0.3.15-orig/parser/config.py linda-0.3.15/parser/config.py
--- linda-0.3.15-orig/parser/config.py  2005-03-25 20:26:58.000000000 +0900
+++ linda-0.3.15/parser/config.py       2005-07-16 15:46:58.872899104 +0900
@@ -1,7 +1,12 @@
-import os, re, gettext
+import os, re, gettext, locale
 from linda import clparser
 from linda.debug import dprint
-_ = gettext.gettext
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
+
 
 class ConfigFileParser:
     def __init__(self):
diff -ur linda-0.3.15-orig/parser/control.py linda-0.3.15/parser/control.py
--- linda-0.3.15-orig/parser/control.py 2005-03-26 17:35:54.000000000 +0900
+++ linda-0.3.15/parser/control.py      2005-07-16 15:47:07.388604520 +0900
@@ -1,7 +1,11 @@
-import re, gettext
+import re, gettext, locale
 from linda.debug import dprint
 from linda.parser.rfc822parser import RFC822Parser
-_ = gettext.gettext
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 
 class DebianControlParser(RFC822Parser):
     def parse(self):
diff -ur linda-0.3.15-orig/parser/data.py linda-0.3.15/parser/data.py
--- linda-0.3.15-orig/parser/data.py    2005-03-25 18:44:46.000000000 +0900
+++ linda-0.3.15/parser/data.py 2005-07-16 15:47:14.024595696 +0900
@@ -1,7 +1,11 @@
-import gettext
+import gettext, locale
 from linda.debug import dprint
 from linda.parser.rfc822parser import RFC822Parser
-_ = gettext.gettext
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 
 class DataFileParser(RFC822Parser):
     def parse(self):
diff -ur linda-0.3.15-orig/parser/rfc822parser.py 
linda-0.3.15/parser/rfc822parser.py
--- linda-0.3.15-orig/parser/rfc822parser.py    2005-03-25 20:29:29.000000000 
+0900
+++ linda-0.3.15/parser/rfc822parser.py 2005-07-16 15:47:29.037313416 +0900
@@ -1,6 +1,11 @@
-import gettext
+import gettext, locale
 from linda.debug import dprint
-_ = gettext.gettext
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
+
 
 class RFC822Parser:
     def __init__(self, file):
diff -ur linda-0.3.15-orig/unpack.py linda-0.3.15/unpack.py
--- linda-0.3.15-orig/unpack.py 2005-03-25 20:28:38.000000000 +0900
+++ linda-0.3.15/unpack.py      2005-07-16 15:42:11.782543472 +0900
@@ -1,4 +1,4 @@
-import os, sys, re, shutil, random, gettext
+import os, sys, re, shutil, random, gettext, locale
 from linda import clparser
 from linda.debug import dprint, vprint
 from linda.collector import Collector
@@ -6,7 +6,11 @@
 from linda.parser.control import DebianControlParser, DCPException
 from linda.parser.dsc import DSCParser, filter_for_src_dir, file_or_sym
 from linda.parser.unixperm import UnixPermParser
-_ = gettext.gettext
+gettext_encoding=locale.getpreferredencoding()
+my_ugettext = gettext.translation('linda').ugettext
+def lgettext(msgid):
+       return my_ugettext(msgid).encode(gettext_encoding)
+_ = lgettext
 
 class Unpacker:
     def __init__(self):


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to