3 %bcond_without tests # unit tests
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
9 Summary: PyOpenFST - Python 2 bindings to OpenFTS library
10 Summary(pl.UTF-8): PyOpenFST - wiązania Pythona 2 do biblioteki OpenFST
11 Name: python-pyopenfst
14 %define gitref eb0c0f9af57bb597f9511e1cc69cbbefe50ff507
15 Release: 0.%{snap}.%{rel}
17 Group: Libraries/Python
18 Source0: https://github.com/tmbdev/pyopenfst/archive/%{gitref}/pyopenfst-%{snap}.tar.gz
19 # Source0-md5: 39e3516a6d80cd2604d9dc76de48a9a5
20 Patch0: pyopenfst-update.patch
21 Patch1: pyopenfst-tests.patch
22 Patch2: pyopenfst-python3.patch
23 URL: https://github.com/tmbdev/pyopenfst
24 BuildRequires: libstdc++-devel >= 6:4.7
25 BuildRequires: openfst-devel
26 BuildRequires: rpm-pythonprov
27 BuildRequires: rpmbuild(macros) >= 1.714
28 BuildRequires: swig-python >= 2
30 BuildRequires: python-devel >= 2.0
33 BuildRequires: python3-devel >= 1:3.2
35 Requires: python-libs >= 2.0
36 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39 The OpenFST library implements algorithms on weighted finite state
40 transducers. The PyOpenFST project contains bindings for the library.
42 %description -l pl.UTF-8
43 Biblioteka OpenFST implementuje algorytmy na automatach skończonych z
44 wyjściem i wagami. Projekt PyOpenFST zawiera wiązania Pythona do
47 %package -n python3-pyopenfst
48 Summary: PyOpenFST - Python 3 bindings to OpenFTS library
49 Summary(pl.UTF-8): PyOpenFST - wiązania Pythona 3 do biblioteki OpenFST
50 Group: Libraries/Python
51 Requires: python3-libs >= 1:3.2
53 %description -n python3-pyopenfst
54 The OpenFST library implements algorithms on weighted finite state
55 transducers. The PyOpenFST project contains bindings for the library.
57 %description -n python3-pyopenfst -l pl.UTF-8
58 Biblioteka OpenFST implementuje algorytmy na automatach skończonych z
59 wyjściem i wagami. Projekt PyOpenFST zawiera wiązania Pythona do
63 %setup -q -n pyopenfst-%{gitref}
69 # setup.py uses CFLAGS for C++; openfst requires C++11
70 CFLAGS="%{rpmcxxflags} -std=c++11"
76 PYTHONPATH=$(echo build-2/lib.*) \
77 %{__python} -munittest test-openfst test-openfst0 test-openfst1
85 PYTHONPATH=$(echo build-3/lib.*) \
86 %{__python3} -munittest test-*.py
91 rm -rf $RPM_BUILD_ROOT
103 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version}
104 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version}
105 %{__sed} -E -i -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python}\1,' \
106 $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version}/*
109 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version}
110 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version}
111 %{__sed} -E -i -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python3}\1,' \
112 $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version}/*
116 rm -rf $RPM_BUILD_ROOT
120 %defattr(644,root,root,755)
122 %{py_sitedir}/openfst.py[co]
123 %attr(755,root,root) %{py_sitedir}/_openfst.so
124 %{py_sitedir}/openfst-%{version}-py*.egg-info
125 %dir %{_examplesdir}/%{name}-%{version}
126 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/dict2linefst
127 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/lines2linefst
128 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/pyfst-*
129 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/test-ngraph
130 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/text2ngraphfst
131 %attr(755,root,root) %{_examplesdir}/%{name}-%{version}/wdict2wordfst
132 %{_examplesdir}/%{name}-%{version}/dict-*
136 %files -n python3-pyopenfst
137 %defattr(644,root,root,755)
139 %{py3_sitedir}/openfst.py
140 %attr(755,root,root) %{py3_sitedir}/_openfst.cpython-*.so
141 %{py3_sitedir}/__pycache__/openfst.cpython-*.py[co]
142 %{py3_sitedir}/openfst-%{version}-py*.egg-info
143 %dir %{_examplesdir}/python3-pyopenfst-%{version}
144 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/dict2linefst
145 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/lines2linefst
146 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/pyfst-*
147 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/test-ngraph
148 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/text2ngraphfst
149 %attr(755,root,root) %{_examplesdir}/python3-pyopenfst-%{version}/wdict2wordfst
150 %{_examplesdir}/python3-pyopenfst-%{version}/dict-*