44cfb4d
changeset:   315:99c0eb1b5f65
44cfb4d
tag:         tip
44cfb4d
parent:      303:8d9188593726
44cfb4d
user:        David Paleino <dapal@debian.org>
44cfb4d
date:        Fri Dec 14 02:03:07 2018 -0500
44cfb4d
summary:     Use system iso-codes.
2f51df6
2f51df6
diff --git a/src/pycountry/__init__.py b/src/pycountry/__init__.py
2f51df6
--- a/src/pycountry/__init__.py
2f51df6
+++ b/src/pycountry/__init__.py
2f51df6
@@ -12,8 +12,8 @@ except ImportError:
2f51df6
         return os.path.join(os.path.dirname(__file__), resource_name)
2f51df6
 
2f51df6
 
2f51df6
-LOCALES_DIR = resource_filename('pycountry', 'locales')
2f51df6
-DATABASE_DIR = resource_filename('pycountry', 'databases')
2f51df6
+LOCALES_DIR = '/usr/share/locale'
2f51df6
+DATABASE_DIR = '/usr/share/iso-codes/json'
2f51df6
 
2f51df6
 
2f51df6
 class ExistingCountries(pycountry.db.Database):
44cfb4d
@@ -110,10 +110,10 @@ class Subdivisions(pycountry.db.Database
44cfb4d
             raise
2f51df6
 
2f51df6
 
2f51df6
-countries = ExistingCountries(os.path.join(DATABASE_DIR, 'iso3166-1.json'))
2f51df6
+countries = ExistingCountries(os.path.join(DATABASE_DIR, 'iso_3166-1.json'))
2f51df6
 historic_countries = HistoricCountries(
2f51df6
-    os.path.join(DATABASE_DIR, 'iso3166-3.json'))
2f51df6
-scripts = Scripts(os.path.join(DATABASE_DIR, 'iso15924.json'))
2f51df6
-currencies = Currencies(os.path.join(DATABASE_DIR, 'iso4217.json'))
2f51df6
-languages = Languages(os.path.join(DATABASE_DIR, 'iso639-3.json'))
2f51df6
-subdivisions = Subdivisions(os.path.join(DATABASE_DIR, 'iso3166-2.json'))
2f51df6
+    os.path.join(DATABASE_DIR, 'iso_3166-3.json'))
2f51df6
+scripts = Scripts(os.path.join(DATABASE_DIR, 'iso_15924.json'))
2f51df6
+currencies = Currencies(os.path.join(DATABASE_DIR, 'iso_4217.json'))
2f51df6
+languages = Languages(os.path.join(DATABASE_DIR, 'iso_639-3.json'))
2f51df6
+subdivisions = Subdivisions(os.path.join(DATABASE_DIR, 'iso_3166-2.json'))
2f51df6
diff --git a/src/pycountry/tests/test_general.py b/src/pycountry/tests/test_general.py
2f51df6
--- a/src/pycountry/tests/test_general.py
2f51df6
+++ b/src/pycountry/tests/test_general.py
2f51df6
@@ -89,7 +89,7 @@ def test_languages():
2f51df6
 
2f51df6
 def test_locales():
2f51df6
     german = gettext.translation(
2f51df6
-        'iso3166', pycountry.LOCALES_DIR, languages=['de'])
2f51df6
+        'iso_3166', pycountry.LOCALES_DIR, languages=['de'])
2f51df6
     german.install()
2f51df6
     assert __builtins__['_']('Germany') == 'Deutschland'
2f51df6
 
44cfb4d