]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without tests # py.test tests | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_with python3 # CPython 3.x module | |
7 | ||
8 | %define module keyring | |
9 | Summary: Python 2 library to access the system keyring service | |
10 | Summary(pl.UTF-8): Biblioteka Pythona 2 do dostępu do systemowego pęku kluczy | |
11 | Name: python-%{module} | |
12 | # keep 18.x here for python2 support | |
13 | Version: 18.0.1 | |
14 | Release: 4 | |
15 | License: MIT, PSF | |
16 | Group: Libraries/Python | |
17 | #Source0Download: https://pypi.python.org/simple/keyring | |
18 | Source0: https://files.pythonhosted.org/packages/source/k/keyring/%{module}-%{version}.tar.gz | |
19 | # Source0-md5: 00cdec34da9c15ad804441979b70830b | |
20 | URL: https://pypi.python.org/pypi/keyring | |
21 | %if %{with python2} | |
22 | BuildRequires: python-devel >= 1:2.7 | |
23 | BuildRequires: python-setuptools | |
24 | BuildRequires: python-setuptools_scm >= 1.15.0 | |
25 | %if %{with tests} | |
26 | BuildRequires: python-entrypoints | |
27 | BuildRequires: python-pytest >= 2.8 | |
28 | BuildRequires: python-pytest-flake8 | |
29 | BuildRequires: python-secretstorage | |
30 | %endif | |
31 | %endif | |
32 | %if %{with python3} | |
33 | BuildRequires: python3-devel >= 1:3.3 | |
34 | BuildRequires: python3-setuptools | |
35 | BuildRequires: python3-setuptools_scm >= 1.15.0 | |
36 | %if %{with tests} | |
37 | BuildRequires: python3-entrypoints | |
38 | BuildRequires: python3-pytest >= 2.8 | |
39 | BuildRequires: python3-pytest-flake8 | |
40 | BuildRequires: python3-secretstorage | |
41 | %endif | |
42 | %endif | |
43 | %if %{with doc} | |
44 | BuildRequires: python-Sphinx | |
45 | BuildRequires: python-jaraco.packaging >= 3.2 | |
46 | BuildRequires: python-rst.linker >= 1.9 | |
47 | %endif | |
48 | BuildRequires: rpm-pythonprov | |
49 | BuildRequires: rpmbuild(macros) >= 1.714 | |
50 | Requires: python-modules >= 1:2.7 | |
51 | # kwalletd5 through dbus | |
52 | Suggests: python-dbus | |
53 | Obsoletes: python-keyring-gnome < 0.5.1 | |
54 | Obsoletes: python-keyring-kwallet < 0.5.1 | |
55 | BuildArch: noarch | |
56 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
57 | ||
58 | %description | |
59 | The Python keyring library provides a easy way to access the system | |
60 | keyring service from Python. It can be used in any application that | |
61 | needs safe password storage. | |
62 | ||
63 | %description -l pl.UTF-8 | |
64 | Biblioteka Pythona keyring udostępnia prosty sposób dostępu do usługi | |
65 | systemowego pęku kluczy z poziomu Pythona. Może być używana w dowolnej | |
66 | aplikacji wymagającej bezpiecznego przechowywania haseł. | |
67 | ||
68 | %package -n python3-%{module} | |
69 | Summary: Python 3 library to access the system keyring service | |
70 | Summary(pl.UTF-8): Biblioteka Pythona 3 do dostępu do systemowego pęku kluczy | |
71 | Group: Libraries/Python | |
72 | Requires: python3-modules >= 1:3.3 | |
73 | # kwalletd5 through dbus | |
74 | Suggests: python-dbus | |
75 | ||
76 | %description -n python3-%{module} | |
77 | The Python keyring lib provides a easy way to access the system | |
78 | keyring service from Python. It can be used in any application that | |
79 | needs safe password storage. | |
80 | ||
81 | %description -n python3-%{module} -l pl.UTF-8 | |
82 | Biblioteka Pythona keyring udostępnia prosty sposób dostępu do usługi | |
83 | systemowego pęku kluczy z poziomu Pythona. Może być używana w dowolnej | |
84 | aplikacji wymagającej bezpiecznego przechowywania haseł. | |
85 | ||
86 | %package apidocs | |
87 | Summary: API documentation for Python keyring library | |
88 | Summary(pl.UTF-8): Dokumentacja API biblioteki Pythona keyring | |
89 | Group: Documentation | |
90 | ||
91 | %description apidocs | |
92 | API documentation for Python keyring library. | |
93 | ||
94 | %description apidocs -l pl.UTF-8 | |
95 | Dokumentacja API biblioteki Pythona keyring. | |
96 | ||
97 | %prep | |
98 | %setup -q -n %{module}-%{version} | |
99 | ||
100 | %build | |
101 | %if %{with python2} | |
102 | %py_build %{?with_doc:build_sphinx} | |
103 | ||
104 | %if %{with tests} | |
105 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
106 | PYTEST_PLUGINS="pytest_flake8" \ | |
107 | PYTHONPATH=$(pwd)/build-2/lib \ | |
108 | %{__python} -m pytest tests keyring/tests | |
109 | %endif | |
110 | %endif | |
111 | ||
112 | %if %{with python3} | |
113 | %py3_build | |
114 | ||
115 | %if %{with tests} | |
116 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
117 | PYTEST_PLUGINS="pytest_flake8" \ | |
118 | PYTHONPATH=$(pwd)/build-3/lib \ | |
119 | %{__python3} -m pytest tests keyring/tests | |
120 | %endif | |
121 | %endif | |
122 | ||
123 | %install | |
124 | rm -rf $RPM_BUILD_ROOT | |
125 | ||
126 | %if %{with python3} | |
127 | %py3_install | |
128 | ||
129 | # keep base tests classes (for e.g. python-keyrings.alt tests), remove just backends unit tests | |
130 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/keyring/tests/backends | |
131 | # "keyring" name is too generic, add -py[version] suffix | |
132 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/keyring{,-py3} | |
133 | %endif | |
134 | ||
135 | %if %{with python2} | |
136 | %py_install | |
137 | ||
138 | %py_postclean | |
139 | ||
140 | # keep base tests classes (for e.g. python-keyrings.alt tests), remove just backends unit tests | |
141 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/keyring/tests/backends | |
142 | # "keyring" name is too generic, add -py[version] suffix | |
143 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/keyring{,-py2} | |
144 | ln -sf keyring-py2 $RPM_BUILD_ROOT%{_bindir}/keyring-py | |
145 | %endif | |
146 | ||
147 | %clean | |
148 | rm -rf $RPM_BUILD_ROOT | |
149 | ||
150 | %if %{with python2} | |
151 | %files | |
152 | %defattr(644,root,root,755) | |
153 | %doc CHANGES.rst README.rst | |
154 | %attr(755,root,root) %{_bindir}/keyring-py | |
155 | %attr(755,root,root) %{_bindir}/keyring-py2 | |
156 | %{py_sitescriptdir}/keyring | |
157 | %{py_sitescriptdir}/keyring-%{version}-py*.egg-info | |
158 | %endif | |
159 | ||
160 | %if %{with python3} | |
161 | %files -n python3-%{module} | |
162 | %defattr(644,root,root,755) | |
163 | %doc CHANGES.rst README.rst | |
164 | %attr(755,root,root) %{_bindir}/keyring-py3 | |
165 | %{py3_sitescriptdir}/keyring | |
166 | %{py3_sitescriptdir}/keyring-%{version}-py*.egg-info | |
167 | %endif | |
168 | ||
169 | %if %{with python2} && %{with doc} | |
170 | %files apidocs | |
171 | %defattr(644,root,root,755) | |
172 | %doc build-2/sphinx/html/{_static,*.html,*.js} | |
173 | %endif |