1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Fix performance bug in xml2po whcih may save users a few hours of

build time.

Approved by:	portmgr (marcus)
This commit is contained in:
Alexander Nedotsukov 2006-10-19 16:30:20 +00:00
parent 55b920778d
commit 5667504a84
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=175406
2 changed files with 42 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= gnome-doc-utils
PORTVERSION= 0.7.2
PORTREVISION= 1
CATEGORIES= textproc gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-doc-utils/0.7

View File

@ -0,0 +1,41 @@
--- xml2po/xml2po.py.orig Sun Apr 2 03:47:17 2006
+++ xml2po/xml2po.py Fri Oct 20 00:57:46 2006
@@ -242,14 +242,10 @@
text = normalizeString(text, not spacepreserve)
if (text.strip() == ''):
return text
- file = open(mofile, "rb")
- if file:
- myfallback = NoneTranslations()
- gt = gettext.GNUTranslations(file)
- gt.add_fallback(myfallback)
- if gt:
- res = gt.ugettext(text.decode('utf-8'))
- return res
+ global gt
+ if gt:
+ res = gt.ugettext(text.decode('utf-8'))
+ return res
return text
@@ -648,6 +644,7 @@
filename = ''
origxml = ''
mofile = ''
+gt = None
ultimate = [ ]
ignored = [ ]
filenames = [ ]
@@ -763,6 +760,11 @@
if mode=='merge' and mofile=='':
print >> sys.stderr, "Error: You must specify MO file when merging translations."
sys.exit(3)
+
+file = open(mofile, "rb")
+if file:
+ gt = gettext.GNUTranslations(file)
+ gt.add_fallback(NoneTranslations())
ultimate_tags = read_finaltags(ultimate)
ignored_tags = read_ignoredtags(ignored)