~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to debian/patches/langpack-gettext.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-07-06 16:52:42 UTC
  • mfrom: (1.2.1 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100706165242-2xv4i019r3et6c0j
Tags: 3.1.2+20100706-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.
  - Add debian/patches/overwrite-semaphore-check for Lucid buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh -e
2
 
## langpack-gettext.dpatch by  <michael.vogt@ubuntu.com>
3
 
#
4
 
# DP: Description: support alternative gettext tree in
5
 
# DP: /usr/share/locale-langpack; if a file is present in both trees,
6
 
# DP: prefer the newer one
7
 
# DP: Upstream status: Ubuntu-Specific
8
 
#! /bin/sh /usr/share/dpatch/dpatch-run
9
 
## langpack-gettext.dpatch by  <egon@localhost.localdomain>
10
 
##
11
 
## All lines beginning with `## DP:' are a description of the patch.
12
 
## DP: Support language packs with pythons gettext implementation
13
 
 
14
 
dir=
15
 
if [ $# -eq 3 -a "$2" = '-d' ]; then
16
 
    pdir="-d $3"
17
 
    dir="$3/"
18
 
elif [ $# -ne 1 ]; then
19
 
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
20
 
    exit 1
21
 
fi
22
 
case "$1" in
23
 
    -patch)
24
 
        patch $pdir -f --no-backup-if-mismatch -p1 < $0
25
 
        ;;
26
 
    -unpatch)
27
 
        patch $pdir -f --no-backup-if-mismatch -R -p1 < $0
28
 
        ;;
29
 
    *)
30
 
       echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
31
 
        exit 1
32
 
esac
33
 
exit 0
34
 
 
35
 
diff -urNad python2.4-2.4.3~/Lib/gettext.py python2.4-2.4.3/Lib/gettext.py
36
 
--- python2.4-2.4.3~/Lib/gettext.py     2004-07-22 20:44:01.000000000 +0200
37
 
+++ python2.4-2.4.3/Lib/gettext.py      2006-08-18 12:49:07.000000000 +0200
38
 
@@ -433,11 +433,26 @@
39
 
         if lang == 'C':
40
 
             break
41
 
         mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)
42
 
+        mofile_lp = os.path.join("/usr/share/locale-langpack", lang,
43
 
+                               'LC_MESSAGES', '%s.mo' % domain)
44
 
+
45
 
+       # first look into the standard locale dir, then into the 
46
 
+       # langpack locale dir
47
 
+
48
 
+       # standard mo file
49
 
         if os.path.exists(mofile):
50
 
             if all:
51
 
                 result.append(mofile)
52
 
             else:
53
 
                 return mofile
54
 
+        
55
 
+       # langpack mofile -> use it
56
 
+        if os.path.exists(mofile_lp): 
57
 
+            if all:
58
 
+                result.append(mofile_lp)
59
 
+            else:
60
 
+                return mofile_lp
61
 
+
62
 
     return result
63
 
 
64