Blob Blame History Raw
changeset:   315:99c0eb1b5f65
tag:         tip
parent:      303:8d9188593726
user:        David Paleino <dapal@debian.org>
date:        Fri Dec 14 02:03:07 2018 -0500
summary:     Use system iso-codes.

diff --git a/src/pycountry/__init__.py b/src/pycountry/__init__.py
--- a/src/pycountry/__init__.py
+++ b/src/pycountry/__init__.py
@@ -12,8 +12,8 @@ except ImportError:
         return os.path.join(os.path.dirname(__file__), resource_name)
 
 
-LOCALES_DIR = resource_filename('pycountry', 'locales')
-DATABASE_DIR = resource_filename('pycountry', 'databases')
+LOCALES_DIR = '/usr/share/locale'
+DATABASE_DIR = '/usr/share/iso-codes/json'
 
 
 class ExistingCountries(pycountry.db.Database):
@@ -110,10 +110,10 @@ class Subdivisions(pycountry.db.Database
             raise
 
 
-countries = ExistingCountries(os.path.join(DATABASE_DIR, 'iso3166-1.json'))
+countries = ExistingCountries(os.path.join(DATABASE_DIR, 'iso_3166-1.json'))
 historic_countries = HistoricCountries(
-    os.path.join(DATABASE_DIR, 'iso3166-3.json'))
-scripts = Scripts(os.path.join(DATABASE_DIR, 'iso15924.json'))
-currencies = Currencies(os.path.join(DATABASE_DIR, 'iso4217.json'))
-languages = Languages(os.path.join(DATABASE_DIR, 'iso639-3.json'))
-subdivisions = Subdivisions(os.path.join(DATABASE_DIR, 'iso3166-2.json'))
+    os.path.join(DATABASE_DIR, 'iso_3166-3.json'))
+scripts = Scripts(os.path.join(DATABASE_DIR, 'iso_15924.json'))
+currencies = Currencies(os.path.join(DATABASE_DIR, 'iso_4217.json'))
+languages = Languages(os.path.join(DATABASE_DIR, 'iso_639-3.json'))
+subdivisions = Subdivisions(os.path.join(DATABASE_DIR, 'iso_3166-2.json'))
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
--- a/src/pycountry/tests/test_general.py
+++ b/src/pycountry/tests/test_general.py
@@ -89,7 +89,7 @@ def test_languages():
 
 def test_locales():
     german = gettext.translation(
-        'iso3166', pycountry.LOCALES_DIR, languages=['de'])
+        'iso_3166', pycountry.LOCALES_DIR, languages=['de'])
     german.install()
     assert __builtins__['_']('Germany') == 'Deutschland'