[python-pyphen] Initial import (#986634).

Eric Smith brouhaha at fedoraproject.org
Thu Jul 25 16:01:21 UTC 2013


commit 3f58ab276112fb86d360e09833d5d75258db02d4
Author: Eric Smith <brouhaha at fedoraproject.org>
Date:   Thu Jul 25 10:00:45 2013 -0600

    Initial import (#986634).

 .gitignore                    |    1 +
 pyphen-0.7-shared-dicts.patch |   14 ++++++
 python-pyphen.spec            |   91 +++++++++++++++++++++++++++++++++++++++++
 sources                       |    1 +
 4 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..e736c1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/0.7.tar.gz
diff --git a/pyphen-0.7-shared-dicts.patch b/pyphen-0.7-shared-dicts.patch
new file mode 100644
index 0000000..13e50aa
--- /dev/null
+++ b/pyphen-0.7-shared-dicts.patch
@@ -0,0 +1,14 @@
+diff -up Pyphen-0.7/pyphen/__init__.py.shared_dicts Pyphen-0.7/pyphen/__init__.py
+--- Pyphen-0.7/pyphen/__init__.py.shared_dicts	2013-07-21 00:51:04.606945135 -0600
++++ Pyphen-0.7/pyphen/__init__.py	2013-07-21 00:52:58.757932594 -0600
+@@ -40,8 +40,8 @@ hdcache = {}
+ parse_hex = re.compile(r'\^{2}([0-9a-f]{2})').sub
+ parse = re.compile(r'(\d?)(\D?)').findall
+ 
+-# included dictionaries
+-dictionaries_root = os.path.join(os.path.dirname(__file__), 'dictionaries')
++# dictionaries provided by hyphen-xx RPM packages, e.g. hyphen-en
++dictionaries_root = '/usr/share/hyphen'
+ LANGUAGES = dict(
+     (filename[5:-4], os.path.join(dictionaries_root, filename))
+     for filename in os.listdir(dictionaries_root)
diff --git a/python-pyphen.spec b/python-pyphen.spec
new file mode 100644
index 0000000..029a00c
--- /dev/null
+++ b/python-pyphen.spec
@@ -0,0 +1,91 @@
+%if 0%{?fedora} > 12 || 0%{?rhel} > 6
+%global with_python3 1
+%else
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%endif
+
+Name:           python-pyphen
+Version:        0.7
+Release:        3%{?dist}
+Group:          Development/Libraries
+Summary:        Pure Python module to hyphenate text
+License:        LGPLv2+
+URL:            https://pypi.python.org/pypi/Pyphen/
+Source0:        https://github.com/Kozea/Pyphen/archive/%{version}.tar.gz
+BuildArch:      noarch
+
+BuildRequires:  python2-devel python-setuptools
+%if 0%{?with_python3}
+BuildRequires:  python3-devel python3-setuptools
+%endif # if with_python3
+
+# Fedora-specific patch to use hyphenation dictionaries in /usr/share/hyphen
+# Desktop users will likely have hyphenation dictionaries installed
+# for the languages they use, as part of the Libreoffice language
+# packs, but if not, they can be installed separately.
+Patch0:         pyphen-0.7-shared-dicts.patch
+
+%description
+Pyphen is a pure Python module to hyphenate text using existing
+hyphenation dictionaries, e.g., from Libreoffice language packs.
+
+%if 0%{?with_python3}
+%package -n python3-pyphen
+Summary:        Pure Python module to hyphenate text
+Group:          Development/Libraries
+
+%description -n python3-pyphen
+Pyphen is a pure Python module to hyphenate text using existing
+hyphenation dictionaries, e.g., from Libreoffice language packs.
+%endif # if with_python3
+
+%prep
+%setup -q -n Pyphen-%{version}
+%patch0 -p1 -b .shared-dict
+rm -rf pyphen/dictionaries
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
+%endif # with_python3
+
+%build
+%{__python} setup.py build
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
+# I'd like to have a test section, but the provided tests would require
+# hyphenation dictionaries for many languages to be installed.
+
+%install
+%{__python} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
+popd
+%endif # with_python3
+
+%files
+%doc COPYING README
+%{python_sitelib}/*
+
+%if 0%{?with_python3}
+%files -n python3-pyphen
+%doc COPYING README
+%{python3_sitelib}/*
+%endif # with_python3
+
+%changelog
+* Tue Jul 23 2013 Eric Smith <brouhaha at fedoraproject.org> 0.7-3
+- Added Python 3 support.
+
+* Mon Jul 22 2013 Eric Smith <brouhaha at fedoraproject.org> 0.7-2
+- Removed requirement for hyphen-en.
+- Changed files section based on review request.
+
+* Sun Jul 21 2013 Eric Smith <brouhaha at fedoraproject.org> 0.7-1
+- initial version
diff --git a/sources b/sources
index e69de29..af255a4 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+aeb22934c6975ebc3ada833205b91350  0.7.tar.gz


More information about the scm-commits mailing list