[Python-modules-commits] r19088 - in packages/django-countries/trunk/debian (7 files)

fladi-guest at users.alioth.debian.org fladi-guest at users.alioth.debian.org
Sat Oct 29 14:21:56 UTC 2011


    Date: Saturday, October 29, 2011 @ 14:21:55
  Author: fladi-guest
Revision: 19088

Symlink creation and workaround for Metadata-Version diversion.

Added:
  packages/django-countries/trunk/debian/python-django-countries.dirs
  packages/django-countries/trunk/debian/python-django-countries.lintian-overrides
  packages/django-countries/trunk/debian/python-django-countries.postinst
  packages/django-countries/trunk/debian/python-django-countries.triggers
Modified:
  packages/django-countries/trunk/debian/changelog
  packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch
  packages/django-countries/trunk/debian/rules

Modified: packages/django-countries/trunk/debian/changelog
===================================================================
--- packages/django-countries/trunk/debian/changelog	2011-10-28 19:15:19 UTC (rev 19087)
+++ packages/django-countries/trunk/debian/changelog	2011-10-29 14:21:55 UTC (rev 19088)
@@ -8,8 +8,14 @@
   * Update dont_include_flag_icons patch.
   * Fix patch descriptions to match DEP3.
   * Add suffix .patch to all patches.
+  * Use Django's lazy translation on country names by symlinking iso-
+    codes translations to django.mo files in our own directory
+    structure.
+  * Add lintian override as the locale directory is initially empty and
+    populated by postinst.
+  * Temporary fix for Metadata-Version in PKG-INFO.
 
- -- Fladischer Michael <FladischerMichael at fladi.at>  Fri, 21 Oct 2011 18:46:14 +0200
+ -- Fladischer Michael <FladischerMichael at fladi.at>  Sat, 29 Oct 2011 16:21:20 +0200
 
 django-countries (1.0.5-1) unstable; urgency=low
 

Modified: packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch
===================================================================
--- packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch	2011-10-28 19:15:19 UTC (rev 19087)
+++ packages/django-countries/trunk/debian/patches/use_iso_codes_package.patch	2011-10-29 14:21:55 UTC (rev 19088)
@@ -28,9 +28,9 @@
 +ISO_XML = _build_iso_xml()
 --- a/django_countries/countries.py
 +++ b/django_countries/countries.py
-@@ -1,3 +1,23 @@
-+from gettext import dgettext as _
-+
+@@ -1,5 +1,25 @@
+ from django.utils.translation import ugettext_lazy as _
+ 
 +from xml.dom.minidom import parse
 +
 +from django_countries import settings
@@ -42,19 +42,31 @@
 +
 +for node in parse(settings.ISO_XML).getElementsByTagName('iso_3166_entry'):
 +    _code = node.getAttribute('alpha_2_code')
-+    _name = _('iso_3166', node.getAttribute('name'))
++    _name = _(node.getAttribute('name'))
 +    COUNTRIES.append((_code, _name))
 +    COUNTRIES_PLUS.append((_code, _name))
 +    OFFICIAL_COUNTRIES[_code.upper()] = _name.upper()
 +
 +'''
 +# Upstream shipped static lists of countries.
- from django.utils.translation import ugettext_lazy as _
- 
++from django.utils.translation import ugettext_lazy as _
++
  # Nicely titled (and translatable) country names.
+ COUNTRIES = (
+     ('AF', _(u'Afghanistan')),
 @@ -775,3 +795,5 @@
      'ZM': u'ZAMBIA',
      'ZW': u'ZIMBABWE',
  }
 +'''
 +
+--- a/setup.py
++++ b/setup.py
+@@ -28,7 +28,6 @@
+     packages=find_packages(),
+     zip_safe=False,
+     package_data={'django_countries': [
+-        'locale/*/LC_MESSAGES/*',
+     ]},
+     # titlecase PYPI is broken, copied the module directly for now (in /bin)
+     #      requires=['titlecase'],

Added: packages/django-countries/trunk/debian/python-django-countries.dirs
===================================================================
--- packages/django-countries/trunk/debian/python-django-countries.dirs	                        (rev 0)
+++ packages/django-countries/trunk/debian/python-django-countries.dirs	2011-10-29 14:21:55 UTC (rev 19088)
@@ -0,0 +1 @@
+/usr/share/pyshared/django_countries/locale

Added: packages/django-countries/trunk/debian/python-django-countries.lintian-overrides
===================================================================
--- packages/django-countries/trunk/debian/python-django-countries.lintian-overrides	                        (rev 0)
+++ packages/django-countries/trunk/debian/python-django-countries.lintian-overrides	2011-10-29 14:21:55 UTC (rev 19088)
@@ -0,0 +1,3 @@
+# This directory is intentionally empty as it is populated by postinst with 
+# the symlink farm.
+python-django-countries binary: package-contains-empty-directory usr/share/pyshared/django_countries/locale/

Added: packages/django-countries/trunk/debian/python-django-countries.postinst
===================================================================
--- packages/django-countries/trunk/debian/python-django-countries.postinst	                        (rev 0)
+++ packages/django-countries/trunk/debian/python-django-countries.postinst	2011-10-29 14:21:55 UTC (rev 19088)
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+set -eu
+
+build_locale_symlinks () 
+{
+    local path dest
+    for file in /usr/share/locale/*/LC_MESSAGES/iso_3166.mo; do
+        path=$(dirname /usr/share/pyshared/django_countries/locale/${file#/usr/share/locale/})
+        # See if the directory already exists otherwise create it.
+        if [ ! -d ${path} ]; then
+            mkdir -p ${path}
+        fi
+        dest=${path}/django.mo
+        # Is there a readable file. This also triggers if the is a dangling symlink.
+        if [ ! -e ${dest} ]; then
+            # Remove the file if it is a symlink as it is dangling.
+            if [ -h ${dest} ]; then
+                rm ${dest}
+            fi
+            # Create the symlink with an absolute target path.
+            ln -s ${file} ${dest}
+        fi
+    done
+}
+
+if [ "$1" = "configure" ]; then
+    # package has been updated and the symlink farm needs to be rebuilt.
+    build_locale_symlinks
+elif [ "$1" = "triggered" ]; then
+    for triggername in $2; do
+        # iso-codes has been updated
+        case "$triggername" in
+        "iso-codes-translation-update")
+            build_locale_symlinks  
+            ;;
+        *)
+            echo "unhandled/unknown trigger!"
+            exit 1
+            ;;
+        esac
+    done
+fi
+
+#DEBHELPER#

Added: packages/django-countries/trunk/debian/python-django-countries.triggers
===================================================================
--- packages/django-countries/trunk/debian/python-django-countries.triggers	                        (rev 0)
+++ packages/django-countries/trunk/debian/python-django-countries.triggers	2011-10-29 14:21:55 UTC (rev 19088)
@@ -0,0 +1,2 @@
+# activated by iso-codes
+interest iso-codes-translation-update

Modified: packages/django-countries/trunk/debian/rules
===================================================================
--- packages/django-countries/trunk/debian/rules	2011-10-28 19:15:19 UTC (rev 19087)
+++ packages/django-countries/trunk/debian/rules	2011-10-29 14:21:55 UTC (rev 19088)
@@ -24,4 +24,4 @@
 .PHONY: override_dh_auto_install
 override_dh_auto_install:
 	dh_auto_install
-	sed -i 's/Metadata-Version: 1\.0/Metadata-Version: 1\.1/' debian/python-django-countries/usr/lib/python2.6/dist-packages/django_countries-1.1.1.egg-info/PKG-INFO
+	sed -i 's/Metadata-Version: 1\.0/Metadata-Version: 1\.1/' debian/python-django-countries/usr/lib/python2.*/*-packages/django_countries-1.1.1.egg-info/PKG-INFO




More information about the Python-modules-commits mailing list