]>
Commit | Line | Data |
---|---|---|
d26ecacc JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without tests # unit tests | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | Summary: Self-service finite-state machines for the programmer on the go | |
9 | Summary(pl.UTF-8): Bezobsługowe automaty skończone dla programisty w biegu | |
10 | Name: python-automat | |
11 | Version: 20.2.0 | |
bc7b4f10 | 12 | Release: 5 |
d26ecacc JB |
13 | License: MIT |
14 | Group: Libraries/Python | |
15 | #Source0Download: https://pypi.org/simple/automat/ | |
16 | Source0: https://files.pythonhosted.org/packages/source/a/automat/Automat-%{version}.tar.gz | |
17 | # Source0-md5: d6cef9886b037b8857bfbc686f3ae30a | |
18 | URL: https://pypi.org/project/Automat/ | |
19 | %if %{with python2} | |
20 | BuildRequires: python-m2r | |
21 | BuildRequires: python-modules >= 1:2.7 | |
22 | BuildRequires: python-setuptools | |
23 | BuildRequires: python-setuptools_scm | |
24 | %if %{with tests} | |
25 | BuildRequires: python-attrs >= 19.2.0 | |
26 | BuildRequires: python-pytest | |
27 | BuildRequires: python-six | |
8d69f9e4 JB |
28 | # it renames xml module to _xmlplus, breaking test_discover.py:WrapFQPNTests.test_singlePackage if Twisted is installed |
29 | BuildConflicts: python-PyXML | |
d26ecacc JB |
30 | %endif |
31 | %endif | |
32 | %if %{with python3} | |
33 | BuildRequires: python3-m2r | |
34 | BuildRequires: python3-modules >= 1:3.5 | |
35 | BuildRequires: python3-setuptools | |
36 | BuildRequires: python3-setuptools_scm | |
37 | %if %{with tests} | |
38 | BuildRequires: python3-attrs >= 19.2.0 | |
39 | BuildRequires: python3-pytest | |
40 | BuildRequires: python3-six | |
41 | %endif | |
42 | %endif | |
43 | BuildRequires: rpm-pythonprov | |
44 | BuildRequires: rpmbuild(macros) >= 1.714 | |
45 | %if %{with doc} | |
46 | BuildRequires: sphinx-pdg | |
47 | %endif | |
d26ecacc JB |
48 | Requires: python-modules >= 1:2.7 |
49 | BuildArch: noarch | |
50 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
51 | ||
52 | %description | |
53 | Automat is a library for concise, idiomatic Python expression of | |
54 | finite-state automata (particularly deterministic finite-state | |
55 | transducers). | |
56 | ||
57 | %description -l pl.UTF-8 | |
58 | Automat to biblioteka do zwięzłego wyrażania automatów skończonych (w | |
59 | szczególności deterministycznych automatów skończończonych z wyjściem, | |
60 | tj. transduktorów) w Pythonie. | |
61 | ||
62 | %package -n python3-automat | |
63 | Summary: Self-service finite-state machines for the programmer on the go | |
64 | Summary(pl.UTF-8): Bezobsługowe automaty skończone dla programisty w biegu | |
65 | Group: Libraries/Python | |
66 | Requires: python3-modules >= 1:3.5 | |
67 | ||
68 | %description -n python3-automat | |
69 | Automat is a library for concise, idiomatic Python expression of | |
70 | finite-state automata (particularly deterministic finite-state | |
71 | transducers). | |
72 | ||
73 | %description -n python3-automat -l pl.UTF-8 | |
74 | Automat to biblioteka do zwięzłego wyrażania automatów skończonych (w | |
75 | szczególności deterministycznych automatów skończończonych z wyjściem, | |
76 | tj. transduktorów) w Pythonie. | |
77 | ||
78 | %package apidocs | |
79 | Summary: API documentation for Python automat module | |
80 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona automat | |
81 | Group: Documentation | |
82 | ||
83 | %description apidocs | |
84 | API documentation for Python automat module. | |
85 | ||
86 | %description apidocs -l pl.UTF-8 | |
87 | Dokumentacja API modułu Pythona automat. | |
88 | ||
89 | %prep | |
90 | %setup -q -n Automat-%{version} | |
91 | ||
92 | %build | |
93 | %if %{with python2} | |
94 | %py_build | |
95 | ||
96 | %if %{with tests} | |
97 | %{__python} -m pytest automat/_test | |
98 | %endif | |
99 | %endif | |
100 | ||
101 | %if %{with python3} | |
102 | %py3_build | |
103 | ||
104 | %if %{with tests} | |
105 | %{__python3} -m pytest automat/_test | |
106 | %endif | |
107 | %endif | |
108 | ||
109 | %if %{with doc} | |
110 | PYTHONPATH=$(pwd) \ | |
111 | %{__make} -C docs html | |
112 | %endif | |
113 | ||
114 | %install | |
115 | rm -rf $RPM_BUILD_ROOT | |
116 | ||
117 | %if %{with python2} | |
118 | %py_install | |
119 | ||
120 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/automat-visualize{,-2} | |
121 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-automat-%{version} | |
122 | cp -p docs/examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-automat-%{version} | |
123 | ||
124 | %py_postclean | |
125 | %endif | |
126 | ||
127 | %if %{with python3} | |
128 | %py3_install | |
129 | ||
130 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/automat-visualize{,-3} | |
131 | ln -sf automat-visualize-3 $RPM_BUILD_ROOT%{_bindir}/automat-visualize | |
132 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-automat-%{version} | |
133 | cp -p docs/examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-automat-%{version} | |
134 | %endif | |
135 | ||
136 | %clean | |
137 | rm -rf $RPM_BUILD_ROOT | |
138 | ||
139 | %if %{with python2} | |
140 | %files | |
141 | %defattr(644,root,root,755) | |
142 | %doc LICENSE README.md | |
143 | %attr(755,root,root) %{_bindir}/automat-visualize-2 | |
144 | %{py_sitescriptdir}/automat | |
145 | %{py_sitescriptdir}/Automat-%{version}-py*.egg-info | |
146 | %{_examplesdir}/python-automat-%{version} | |
147 | %endif | |
148 | ||
149 | %if %{with python3} | |
150 | %files -n python3-automat | |
151 | %defattr(644,root,root,755) | |
152 | %doc LICENSE README.md | |
153 | %attr(755,root,root) %{_bindir}/automat-visualize | |
154 | %attr(755,root,root) %{_bindir}/automat-visualize-3 | |
155 | %{py3_sitescriptdir}/automat | |
156 | %{py3_sitescriptdir}/Automat-%{version}-py*.egg-info | |
157 | %{_examplesdir}/python3-automat-%{version} | |
158 | %endif | |
159 | ||
160 | %if %{with doc} | |
161 | %files apidocs | |
162 | %defattr(644,root,root,755) | |
163 | %doc docs/_build/html/{_images,_static,*.html,*.js} | |
164 | %endif |