debian/0000755000000000000000000000000012253567265007203 5ustar debian/watch0000644000000000000000000000014311360573315010221 0ustar version=3 http://pypi.python.org/packages/source/d/django-countries/django-countries-(.*)\.tar\.gz debian/copyright0000644000000000000000000000321012253567021011120 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: django-countries Upstream-Contact: Chris Beaven Source: http://pypi.python.org/pypi/django-countries/ Files: * Copyright: 2010-2013, Chris Beaven License: Expat Files: django_countries/static/flags/* Copyright: Mark James License: Flag-Icon-License Files: debian/* Copyright: 2011-2013, Michael Fladischer License: Expat License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. License: Flag-Icon-License The flag icons are available for free use for any purpose with no requirement for attribution. debian/python-django-countries.postinst0000644000000000000000000000145112253567021015571 0ustar #!/bin/sh set -eu build_locale_symlinks () { local path dest file # Remove existing symlink farm. We will recreate it immediately. rm -rf /usr/share/python-django-countries/locale/* for file in /usr/share/locale/*/LC_MESSAGES/iso_3166.mo; do # Create the necessary directory structure for each language. path=$(dirname /usr/share/python-django-countries/locale/${file#/usr/share/locale/}) mkdir -p ${path} # Create the symlink with an absolute target path (iso_3166.mo -> django.mo). dest=${path}/django.mo ln -s ../../../../${file#/usr/share/} ${dest} done } if [ "$1" = "configure" ]; then build_locale_symlinks elif [ "$1" = "triggered" ]; then # iso-codes has been updated build_locale_symlinks exit 0 fi #DEBHELPER# debian/README.Debian0000644000000000000000000000245711360573315011243 0ustar django-countries for Debian --------------------------- Flag icon support: ------------------ This package does not include the flag icons. They are provided in separate packages: - famfamfam-flags-png - famfamfam-flags-gif To use them within your Django project you need to create a symlink in your media root. If your have your media root configured this way in settings.py: MEDIA_ROOT = '/home/media/media.example.com/' MEDIA_URL = '/media/' Create a symlink in your media root pointing to the famfamfam-flags-(png|gif) directory: ln -s /usr/share/flags/countries/16x11 /home/media/media.example.com/flags Now for PNG flag icons include this in settings.py: COUNTRIES_FLAG_URL = '/media/flags/%s.png' Or just change the suffix the use the GIF flags: COUNTRIES_FLAG_URL = '/media/flags/%s.gif' Translations: ------------- The package iso-codes comes with it's own translations of country names. django-countries has been patched to automatically use these translations. Custom country codes: --------------------- It is possible (but not encouraged because of missing translations) to use a modified iso_3166.xml file by adding this to your settings.py: COUNTRIES_ISO_XML = '/path/to/custom_iso_3166.xml' -- Fladischer Michael Sat, 02 Apr 2010 11:11:51 +0100 debian/python-django-countries.prerm0000644000000000000000000000026411653070364015036 0ustar #!/bin/sh set -eu # Remove directories and symlinks created during postinst. if [ "$1" = "remove" ]; then rm -rf /usr/share/python-django-countries/locale/* fi #DEBHELPER# debian/python-django-countries.triggers0000644000000000000000000000007711653006003015526 0ustar # activated by iso-codes interest iso-codes-translation-update debian/control0000644000000000000000000000215412245177043010600 0ustar Source: django-countries Section: python Priority: optional Maintainer: Debian Python Modules Team Uploaders: Michael Fladischer Build-Depends: debhelper (>= 7.0.50~), iso-codes, python-all, python-django, python-setuptools Standards-Version: 3.9.5 X-Python-Version: >= 2.5 Homepage: http://bitbucket.org/smileychris/django-countries/ Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/django-countries/trunk/ Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/django-countries/trunk/ Package: python-django-countries Architecture: all Depends: famfamfam-flag-png | famfamfam-flag-gif, iso-codes, python-django, ${misc:Depends}, ${python:Depends} Description: provides a country field for Django models A Django application which provides all ISO 3166-1 countries as choices for use with forms, and a country field for models. It also includes a small template filter for getting country flags by ISO 3166-1 alpha-2 country code. debian/clean0000644000000000000000000000024011360573315010173 0ustar django_countries.egg-info/dependency_links.txt django_countries.egg-info/PKG-INFO django_countries.egg-info/SOURCES.txt django_countries.egg-info/top_level.txt debian/compat0000644000000000000000000000000211360573315010370 0ustar 7 debian/changelog0000644000000000000000000000603412253567021011046 0ustar django-countries (1.5-1) unstable; urgency=low [ Jakub Wilk ] * Use canonical URIs for Vcs-* fields. [ Michael Fladischer ] * New upstream release. * Bump Standards version to 3.9.5. * README now installs as README.rst. * Make Build-Depends on python-all and python-django unversioned as no prior versions are available in Wheezy. * Drop temporary fix for Metadata-Version in PKG-INFO. * Rename MIT license to Expat. * Update years in d/copyright. -- Michael Fladischer Mon, 16 Dec 2013 13:10:35 +0100 django-countries (1.2-1) unstable; urgency=low * New upstream release. * Fix tests for django (>= 1.4) FTBFS (Closes: #669492). -- Michael Fladischer Sat, 21 Apr 2012 22:59:31 +0200 django-countries (1.1.2-1) unstable; urgency=low * New upstream release. * Make Metadata-Version fix more generic. * Bump Standards-Version to 3.9.3. * Change order of my name. * Update DEP-5 URL to 1.0. * Update years in d/copyright. -- Michael Fladischer Fri, 16 Mar 2012 19:17:19 +0100 django-countries (1.1.1-1) unstable; urgency=low * New upstream release. * Prefer PNG icons. * Streamline packaging code with wrap-and-sort. * Update d/copyright. * Bump standards version to 3.9.2. * 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 and symlink iso- codes translations to django.mo files in our own directory structure (Thanks to Jakub Wilk for his help!). * Add lintian override as the locale directory is initially empty and populated by postinst. * Temporary fix for Metadata-Version in PKG-INFO. * Switch to dh_python2. * Generate COUNTRIES_PLUS by duplicating countries with a comma in their name. The part after the comma is moved to the beginning of the string and the comma is removed. * Sort countries by name using unicodedata.normalize in NFD mode. * Update settings.py to use new DATABASE settings format. * Bump build dependency for python-django to >= 1.2. * Update flag icons path in d/copyright. -- Fladischer Michael Sat, 19 Nov 2011 18:14:25 +0100 django-countries (1.0.5-1) unstable; urgency=low * New upstream release. * Bump to standards-version 3.9.1. * Update DEP5 format. * Drop debian/pyversions in favour of XS-Python-Version. * Simplify debian/rules by using a predefined settings.py. * Set PMPT as maintainer and myself as uploader. -- Fladischer Michael Mon, 07 Feb 2011 13:24:36 +0100 django-countries (1.0.4-1) unstable; urgency=low * New upstream release. * Use DEP5 for copyright file. * Update to Debian policy 3.9.0. -- Fladischer Michael Wed, 07 Jul 2010 12:38:20 +0200 django-countries (1.0.3-1) unstable; urgency=low * Initial release (Closes: #576262) -- Fladischer Michael Fri, 23 Apr 2010 14:45:20 +0200 debian/patches/0000755000000000000000000000000012253567060010623 5ustar debian/patches/dont_include_flag_icons.patch0000644000000000000000000000114411650320752016472 0ustar Description: Don't install the included flag icons Debian already provides appropriate flag icons with the packages famfamfam-flag-(png|gif). Therefore ignore the images shipped by upstream. Author: Fladischer Michael Forwarded: not-needed Last-Update: 2011-10-18 --- a/setup.py +++ b/setup.py @@ -28,8 +28,6 @@ packages=find_packages(), zip_safe=False, package_data={'django_countries': [ - 'bin/*.py', - 'static/flags/*.gif', 'locale/*/LC_MESSAGES/*', ]}, # titlecase PYPI is broken, copied the module directly for now (in /bin) debian/patches/series0000644000000000000000000000007211650320752012032 0ustar dont_include_flag_icons.patch use_iso_codes_package.patch debian/patches/use_iso_codes_package.patch0000644000000000000000000000517011661401173016137 0ustar Description: Don't use the shipped static lists for the country-codes Debian already provides the necessary data as part of its ico-codes package. This patch changes the upstream behaviour to gather the data at runtime by parsing the XML files shipped with the iso-codes package. Translations for the countries names are also taken from iso-codes by using the symlinked .mo files with Django's lazy translation. Sorting function by Jakub Wilk. Author: Fladischer Michael Forwarded: not-needed Last-Update: 2011-11-17 --- a/django_countries/settings.py +++ b/django_countries/settings.py @@ -1,3 +1,4 @@ +import os from django.conf import settings @@ -11,5 +12,11 @@ prefix = '%s/' % prefix return '%s%s' % (prefix, url) +def _build_iso_xml(): + if hasattr(settings, 'COUNTRIES_ISO_XML'): + return settings.COUNTRIES_ISO_XML + else: + return '/usr/share/xml/iso-codes/iso_3166.xml' FLAG_URL = _build_flag_url() +ISO_XML = _build_iso_xml() --- a/django_countries/countries.py +++ b/django_countries/countries.py @@ -1,5 +1,35 @@ from django.utils.translation import ugettext_lazy as _ +import unicodedata +from xml.dom.minidom import parse + +from django_countries import settings + + +# Nicely titled (and translated) country names. +COUNTRIES = [] +COUNTRIES_PLUS = [] +OFFICIAL_COUNTRIES = {} + +def _sort_key(s): + return unicodedata.normalize('NFD', s).encode('ASCII', 'ignore') + +for node in sorted(parse(settings.ISO_XML).getElementsByTagName('iso_3166_entry'), + key=lambda node: _sort_key(node.getAttribute('name'))): + _code = str(node.getAttribute('alpha_2_code')) + _name = node.getAttribute('name') + COUNTRIES.append((_code, _(_name))) + COUNTRIES_PLUS.append((_code, _name)) + if _name.find(', ') >= 0: + COUNTRIES_PLUS.append((_code, ' '.join(reversed(_name.split(', '))))) + OFFICIAL_COUNTRIES[_code.upper()] = _name.upper() + +COUNTRIES_PLUS = [(_code, _(_name)) for (_code, _name) in sorted(COUNTRIES_PLUS, key=lambda node: _sort_key(node[1]))] + +''' +# Upstream shipped static lists of countries. +from django.utils.translation import ugettext_lazy as _ + # Nicely titled (and translatable) country names. COUNTRIES = ( ('AF', _(u'Afghanistan')), @@ -775,3 +805,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'], debian/settings.py0000755000000000000000000000072311744224776011423 0ustar DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'testproject/test.db3', } } INSTALLED_APPS = ["django_countries", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.admin", "django.contrib.sites", "django.contrib.sessions", ] SITE_ID = 1 ROOT_URLCONF = "testproject.urls" SECRET_KEY = "1" debian/python-django-countries.lintian-overrides0000644000000000000000000000031411653070245017341 0ustar # 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/python-django-countries/locale/ debian/docs0000644000000000000000000000001312245176221010035 0ustar README.rst debian/python-django-countries.dirs0000644000000000000000000000005211653070245014643 0ustar /usr/share/python-django-countries/locale debian/rules0000755000000000000000000000177512253567021010263 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh --with python2 $@ .PHONY: override_dh_auto_test override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) django-admin startproject testproject if [ -d testproject/testproject ]; then \ cp debian/settings.py testproject/testproject ; \ else \ cp debian/settings.py testproject ; \ fi set -e; \ for python in $(shell pyversions -r); do \ rm -f testproject/test.db3 ; \ PYTHONPATH=".:testproject" $$python testproject/manage.py syncdb --settings=testproject.settings --noinput ;\ PYTHONPATH=".:testproject" $$python testproject/manage.py test --settings=testproject.settings django_countries ;\ done rm -rf testproject endif .PHONY: override_dh_python2 override_dh_python2: set -e; \ for python in $(shell pyversions -r); do \ ln -s /usr/share/python-django-countries/locale debian/python-django-countries/usr/lib/$$python/*-packages/django_countries/; \ done dh_python2 debian/source/0000755000000000000000000000000012253567060010474 5ustar debian/source/format0000644000000000000000000000001411360573315011700 0ustar 3.0 (quilt)