]>
Commit | Line | Data |
---|---|---|
239079b5 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | Summary: Python 2 SANE module | |
8 | Summary(pl.UTF-8): Moduł SANE dla Pythona 2 | |
9 | Name: python-sane | |
7786fb33 | 10 | # keep 2.8.x here for python2 support |
239079b5 | 11 | Version: 2.8.3 |
221dfe8b | 12 | Release: 4 |
239079b5 JB |
13 | License: MIT-like |
14 | Group: Libraries/Python | |
15 | #Source0Download: https://github.com/python-pillow/Sane/releases | |
16 | Source0: https://github.com/python-pillow/Sane/archive/v%{version}/Sane-%{version}.tar.gz | |
17 | # Source0-md5: 96877da43524fdab2c367541da547d2b | |
18 | URL: https://github.com/python-pillow/Sane | |
19 | %if %{with python2} | |
20 | BuildRequires: python-devel >= 1:2.6 | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3-devel >= 1:3.2 | |
24 | %endif | |
7786fb33 | 25 | BuildRequires: rpm-build >= 4.6 |
239079b5 JB |
26 | BuildRequires: rpm-pythonprov |
27 | BuildRequires: rpmbuild(macros) >= 1.714 | |
28 | BuildRequires: sane-backends-devel | |
29 | %if %{with doc} | |
30 | # mocking _sane module doesn't work with python 3.8, so use python2 here | |
31 | BuildRequires: python-mock | |
32 | BuildRequires: sphinx-pdg-2 | |
33 | %endif | |
34 | Requires: python-modules >= 1:2.6 | |
35 | Requires: python-numpy | |
36 | Requires: python-pillow | |
37 | Obsoletes: python-PIL-sane < 1:2.0 | |
38 | Obsoletes: python-pysane < 2.7.0 | |
39 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
40 | ||
41 | %description | |
42 | The SANE module provides an interface to the SANE scanner and frame | |
43 | grabber interface for Linux. | |
44 | ||
45 | %description -l pl.UTF-8 | |
46 | Moduł SANE udostępnia interfejs do biblioteki SANE będącej interfejsem | |
47 | do skanerów i urządzeń przechwytujących ramki obrazu dla Linuksa. | |
48 | ||
49 | %package -n python3-sane | |
50 | Summary: Python 3 SANE module | |
51 | Summary(pl.UTF-8): Moduł SANE dla Pythona 3 | |
52 | Group: Libraries/Python | |
53 | Requires: python3-modules >= 1:3.2 | |
54 | Requires: python3-numpy | |
55 | Requires: python3-pillow | |
56 | ||
57 | %description -n python3-sane | |
58 | The SANE module provides an interface to the SANE scanner and frame | |
59 | grabber interface for Linux. | |
60 | ||
61 | %description -n python3-sane -l pl.UTF-8 | |
62 | Moduł SANE udostępnia interfejs do biblioteki SANE będącej interfejsem | |
63 | do skanerów i urządzeń przechwytujących ramki obrazu dla Linuksa. | |
64 | ||
65 | %package apidocs | |
66 | Summary: API documentation for Python SANE module | |
67 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona SANE | |
68 | Group: Documentation | |
239079b5 | 69 | BuildArch: noarch |
239079b5 JB |
70 | |
71 | %description apidocs | |
72 | API documentation for Python SANE module. | |
73 | ||
74 | %description apidocs -l pl.UTF-8 | |
75 | Dokumentacja API modułu Pythona SANE. | |
76 | ||
77 | %prep | |
78 | %setup -q -n Sane-%{version} | |
79 | ||
80 | %build | |
81 | %if %{with python2} | |
82 | %py_build | |
83 | %endif | |
84 | ||
85 | %if %{with python3} | |
86 | %py3_build | |
87 | %endif | |
88 | ||
89 | %if %{with doc} | |
90 | PYTHONPATH=$(pwd) \ | |
91 | %{__make} -C doc html \ | |
92 | SPHINXBUILD=sphinx-build-2 | |
93 | %endif | |
94 | ||
95 | %install | |
96 | rm -rf $RPM_BUILD_ROOT | |
97 | ||
98 | %if %{with python2} | |
99 | %py_install | |
100 | ||
101 | %py_postclean | |
102 | %endif | |
103 | ||
104 | %if %{with python3} | |
105 | %py3_install | |
106 | %endif | |
107 | ||
108 | %clean | |
109 | rm -rf $RPM_BUILD_ROOT | |
110 | ||
111 | %if %{with python2} | |
112 | %files | |
113 | %defattr(644,root,root,755) | |
114 | %doc CHANGES.rst COPYING README.rst sanedoc.txt | |
115 | %attr(755,root,root) %{py_sitedir}/_sane.so | |
116 | %{py_sitedir}/sane.py[co] | |
117 | %{py_sitedir}/python_sane-%{version}-py*.egg-info | |
118 | %endif | |
119 | ||
120 | %if %{with python3} | |
121 | %files -n python3-sane | |
122 | %defattr(644,root,root,755) | |
123 | %doc CHANGES.rst COPYING README.rst sanedoc.txt | |
124 | %attr(755,root,root) %{py3_sitedir}/_sane.cpython-*.so | |
125 | %{py3_sitedir}/sane.py | |
126 | %{py3_sitedir}/__pycache__/sane.cpython-*.py[co] | |
127 | %{py3_sitedir}/python_sane-%{version}-py*.egg-info | |
128 | %endif | |
129 | ||
130 | %if %{with doc} | |
131 | %files apidocs | |
132 | %defattr(644,root,root,755) | |
133 | %doc doc/_build/html/{_static,*.html,*.js} | |
134 | %endif |