]>
Commit | Line | Data |
---|---|---|
be17d6f7 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # unit tests | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
58f40fa5 | 7 | %define rel 4 |
54a6b6a9 | 8 | |
be17d6f7 JB |
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 | |
12 | Version: 0.4 | |
13 | %define snap 20141029 | |
14 | %define gitref eb0c0f9af57bb597f9511e1cc69cbbefe50ff507 | |
54a6b6a9 | 15 | Release: 0.%{snap}.%{rel} |
be17d6f7 JB |
16 | License: Apache v2.0 |
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 | |
29 | %if %{with python2} | |
30 | BuildRequires: python-devel >= 2.0 | |
31 | %endif | |
32 | %if %{with python3} | |
33 | BuildRequires: python3-devel >= 1:3.2 | |
34 | %endif | |
35 | Requires: python-libs >= 2.0 | |
36 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
37 | ||
38 | %description | |
39 | The OpenFST library implements algorithms on weighted finite state | |
40 | transducers. The PyOpenFST project contains bindings for the library. | |
41 | ||
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 | |
45 | biblioteki. | |
46 | ||
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 | |
52 | ||
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. | |
56 | ||
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 | |
60 | biblioteki. | |
61 | ||
62 | %prep | |
63 | %setup -q -n pyopenfst-%{gitref} | |
64 | %patch0 -p1 | |
65 | %patch1 -p1 | |
66 | %patch2 -p1 | |
67 | ||
68 | %build | |
69 | # setup.py uses CFLAGS for C++; openfst requires C++11 | |
70 | CFLAGS="%{rpmcxxflags} -std=c++11" | |
71 | ||
72 | %if %{with python2} | |
73 | %py_build | |
74 | ||
75 | %if %{with tests} | |
76 | PYTHONPATH=$(echo build-2/lib.*) \ | |
77 | %{__python} -munittest test-openfst test-openfst0 test-openfst1 | |
78 | %endif | |
79 | %endif | |
80 | ||
81 | %if %{with python3} | |
82 | %py3_build | |
83 | ||
84 | %if %{with tests} | |
85 | PYTHONPATH=$(echo build-3/lib.*) \ | |
86 | %{__python3} -munittest test-*.py | |
87 | %endif | |
88 | %endif | |
89 | ||
90 | %install | |
91 | rm -rf $RPM_BUILD_ROOT | |
92 | ||
93 | %if %{with python2} | |
94 | %py_install | |
95 | %py_postclean | |
96 | %endif | |
97 | ||
98 | %if %{with python3} | |
99 | %py3_install | |
100 | %endif | |
101 | ||
102 | %if %{with python2} | |
103 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version} | |
104 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version} | |
3e045e64 JR |
105 | %{__sed} -E -i -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python}\1,' \ |
106 | $RPM_BUILD_ROOT%{_examplesdir}/python-pyopenfst-%{version}/* | |
be17d6f7 JB |
107 | %endif |
108 | %if %{with python3} | |
109 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version} | |
110 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version} | |
3e045e64 JR |
111 | %{__sed} -E -i -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python3}\1,' \ |
112 | $RPM_BUILD_ROOT%{_examplesdir}/python3-pyopenfst-%{version}/* | |
be17d6f7 JB |
113 | %endif |
114 | ||
115 | %clean | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
118 | %if %{with python2} | |
119 | %files | |
120 | %defattr(644,root,root,755) | |
121 | %doc README.md | |
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-* | |
133 | %endif | |
134 | ||
135 | %if %{with python3} | |
136 | %files -n python3-pyopenfst | |
137 | %defattr(644,root,root,755) | |
138 | %doc README.md | |
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-* | |
151 | %endif |