91ab0fa
From 988372ed85d7317c2f24a956d50e78542728e575 Mon Sep 17 00:00:00 2001
91ab0fa
From: Alon Levy <alon@pobox.com>
91ab0fa
Date: Thu, 7 Aug 2014 18:33:48 +0300
91ab0fa
Subject: [PATCH] pyphen 0.9.1 shared dicts
91ab0fa
91ab0fa
---
91ab0fa
 pyphen.py | 19 ++-----------------
91ab0fa
 setup.py  |  6 ------
91ab0fa
 2 files changed, 2 insertions(+), 23 deletions(-)
91ab0fa
91ab0fa
diff --git a/pyphen.py b/pyphen.py
91ab0fa
index 4ea1499..06cadd8 100755
91ab0fa
--- a/pyphen.py
91ab0fa
+++ b/pyphen.py
91ab0fa
@@ -42,23 +42,8 @@ hdcache = {}
91ab0fa
 parse_hex = re.compile(r'\^{2}([0-9a-f]{2})').sub
91ab0fa
 parse = re.compile(r'(\d?)(\D?)').findall
91ab0fa
 
91ab0fa
-# included dictionaries are available:
91ab0fa
-# - at <sys.prefix>/share/pyphen/dictionaries when Pyphen is installed
91ab0fa
-# - at <project_root>/dictionaries when Pyphen is not installed
91ab0fa
-# - at <pkg_resources>/share/pyphen/dictionaries when Pyphen is in an egg
91ab0fa
-try:
91ab0fa
-    import pkg_resources
91ab0fa
-except ImportError:
91ab0fa
-    dictionaries_roots = ()
91ab0fa
-else:
91ab0fa
-    dictionaries_roots = (os.path.join(
91ab0fa
-        pkg_resources.resource_filename('pyphen', ''),
91ab0fa
-        'share', 'pyphen', 'dictionaries'),)
91ab0fa
-finally:
91ab0fa
-    dictionaries_roots += (
91ab0fa
-        os.path.join(sys.prefix, 'share', 'pyphen', 'dictionaries'),
91ab0fa
-        os.path.join(os.path.dirname(__file__), 'dictionaries'))
91ab0fa
-
91ab0fa
+# dictionaries provided by hyphen-xx RPM packages, e.g. hyphen-en
91ab0fa
+dictionaries_roots = ['/usr/share/hyphen']
91ab0fa
 
91ab0fa
 LANGUAGES = dict(
91ab0fa
     (filename[5:-4], os.path.join(dictionaries_root, filename))
91ab0fa
diff --git a/setup.py b/setup.py
91ab0fa
index 94022ab..fc54e24 100755
91ab0fa
--- a/setup.py
91ab0fa
+++ b/setup.py
91ab0fa
@@ -21,17 +21,11 @@ classifiers = [
91ab0fa
     'Topic :: Text Processing :: Linguistic',
91ab0fa
 ]
91ab0fa
 
91ab0fa
-_dict_folder = os.path.join(os.path.dirname(__file__), 'dictionaries')
91ab0fa
 setup(
91ab0fa
     name='Pyphen',
91ab0fa
     version='0.9.1',
91ab0fa
     py_modules=['pyphen'],
91ab0fa
     provides=['pyphen'],
91ab0fa
-    data_files=[(
91ab0fa
-        os.path.join('share', 'pyphen', 'dictionaries'), (
91ab0fa
-            os.path.join(_dict_folder, filename)
91ab0fa
-            for filename in os.listdir(_dict_folder)
91ab0fa
-            if filename.endswith('.dic')))],
91ab0fa
     author='Guillaume Ayoub',
91ab0fa
     author_email='guillaume.ayoub@kozea.fr',
91ab0fa
     url='https://github.com/Kozea/Pyphen',
91ab0fa
-- 
91ab0fa
1.9.3
91ab0fa