]>
Commit | Line | Data |
---|---|---|
01a65240 KK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | %bcond_without docs # documentation | |
6 | ||
7 | %define module pygit2 | |
a7da3c5d JB |
8 | Summary: Python 2.x bindings for libgit2 library |
9 | Summary(pl.UTF-8): Wiązania Pythona 2.x do biblioteki libgit2 | |
01a65240 | 10 | Name: python-%{module} |
067cd5ad | 11 | Version: 0.23.2 |
4b0cff09 | 12 | Release: 2 |
01a65240 KK |
13 | License: GPL v2 with linking exception |
14 | Group: Libraries/Python | |
a66114b5 | 15 | #Source0Download: https://pypi.python.org/pypi/pygit2 |
be2c3764 | 16 | Source0: https://pypi.python.org/packages/source/p/pygit2/%{module}-%{version}.tar.gz |
067cd5ad | 17 | # Source0-md5: c4b00f2add53e17a98c0ebe558d4db80 |
2d087e32 | 18 | Patch0: %{name}-docbuild.patch |
01a65240 | 19 | URL: https://pypi.python.org/pypi/pygit2 |
067cd5ad | 20 | BuildRequires: libgit2-devel >= 0.23.0 |
e507b989 JB |
21 | BuildRequires: python-cffi |
22 | BuildRequires: python-devel >= 1:2.7 | |
067cd5ad | 23 | BuildRequires: python-setuptools |
01a65240 | 24 | BuildRequires: rpm-pythonprov |
da8a1022 | 25 | BuildRequires: rpmbuild(macros) >= 1.710 |
01a65240 | 26 | %if %{with python3} |
e507b989 JB |
27 | BuildRequires: python3-cffi |
28 | BuildRequires: python3-devel >= 1:3.2 | |
e507b989 | 29 | BuildRequires: python3-modules >= 1:3.2 |
067cd5ad | 30 | BuildRequires: python3-setuptools |
01a65240 KK |
31 | %endif |
32 | %{?with_docs:BuildRequires: sphinx-pdg} | |
067cd5ad | 33 | Requires: libgit2 >= 0.23.0 |
e507b989 | 34 | Requires: python-cffi |
01a65240 KK |
35 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
36 | ||
37 | %description | |
38 | pygit2 is a set of Python bindings to the libgit2 shared library. | |
39 | ||
a7da3c5d JB |
40 | %description -l pl.UTF-8 |
41 | pygit2 to zbiór wiązań Pythona do biblioteki współdzielonej libgit2. | |
42 | ||
c6e2e8fd | 43 | %package -n python3-%{module} |
a7da3c5d JB |
44 | Summary: Python 3.x bindings for libgit2 library |
45 | Summary(pl.UTF-8): Wiązania Pythona 3.x do biblioteki libgit2 | |
46 | Group: Libraries/Python | |
067cd5ad | 47 | Requires: libgit2 >= 0.23.0 |
e507b989 | 48 | Requires: python3-cffi |
01a65240 KK |
49 | |
50 | %description -n python3-%{module} | |
51 | pygit2 is a set of Python bindings to the libgit2 shared library. | |
52 | ||
a7da3c5d JB |
53 | %description -n python3-%{module} -l pl.UTF-8 |
54 | pygit2 to zbiór wiązań Pythona do biblioteki współdzielonej libgit2. | |
55 | ||
01a65240 KK |
56 | %package apidoc |
57 | Summary: pygit2 API documentation | |
58 | Summary(pl.UTF-8): Dokumentacja API pygit2 | |
59 | Group: Documentation | |
60 | ||
61 | %description apidoc | |
62 | API documentation for %{module}. | |
63 | ||
64 | %description apidoc -l pl.UTF-8 | |
65 | Dokumentacja API %{module}. | |
66 | ||
67 | %prep | |
68 | %setup -q -n %{module}-%{version} | |
6a54849d | 69 | %patch0 -p1 |
01a65240 | 70 | |
be2c3764 JB |
71 | # these tests use network |
72 | %{__rm} test/test_{credentials,repository}.py | |
73 | ||
01a65240 | 74 | %build |
859cf233 | 75 | %py_build |
01a65240 | 76 | %if %{with python3} |
859cf233 | 77 | %py3_build |
01a65240 KK |
78 | %endif |
79 | ||
859cf233 | 80 | %{?with_tests:%py_build test} |
01a65240 KK |
81 | |
82 | %if %{with python3} | |
83 | %{__python3} setup.py \ | |
84 | build -b build-3 | |
85 | ||
86 | %if %{with tests} | |
859cf233 | 87 | %py3_build test |
01a65240 KK |
88 | %endif |
89 | %endif | |
90 | ||
91 | %if %{with docs} | |
92 | cd docs | |
a7da3c5d JB |
93 | PACKAGE_BUILD=../build-2 \ |
94 | %{__make} -j1 html | |
01a65240 KK |
95 | rm -rf _build/html/_sources |
96 | %endif | |
97 | ||
98 | %install | |
99 | rm -rf $RPM_BUILD_ROOT | |
01a65240 KK |
100 | %{__python} -- setup.py \ |
101 | build -b build-2 \ | |
102 | install \ | |
103 | --root=$RPM_BUILD_ROOT \ | |
104 | --optimize=2 | |
c6e2e8fd | 105 | |
01a65240 KK |
106 | %py_postclean |
107 | ||
108 | %if %{with python3} | |
859cf233 | 109 | %py3_install |
01a65240 KK |
110 | %endif |
111 | ||
01a65240 KK |
112 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} |
113 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
114 | %py_postclean | |
115 | ||
116 | %clean | |
117 | rm -rf $RPM_BUILD_ROOT | |
118 | ||
119 | %files | |
120 | %defattr(644,root,root,755) | |
121 | %doc COPYING README.rst TODO.txt | |
f193cb9b | 122 | %dir %{py_sitedir}/pygit2 |
01a65240 | 123 | %{py_sitedir}/pygit2/*.py[co] |
f193cb9b | 124 | %{py_sitedir}/pygit2/decl.h |
067cd5ad | 125 | %attr(755,root,root) %{py_sitedir}/pygit2/_libgit2.so |
f193cb9b | 126 | %attr(755,root,root) %{py_sitedir}/_pygit2.so |
01a65240 | 127 | %if "%{py_ver}" > "2.4" |
f193cb9b | 128 | %{py_sitedir}/pygit2-%{version}-py*.egg-info |
01a65240 KK |
129 | %endif |
130 | ||
131 | %if %{with python3} | |
132 | %files -n python3-%{module} | |
133 | %defattr(644,root,root,755) | |
134 | %doc COPYING README.rst TODO.txt | |
f193cb9b | 135 | %dir %{py3_sitedir}/pygit2 |
f193cb9b JB |
136 | %{py3_sitedir}/pygit2/decl.h |
137 | %{py3_sitedir}/pygit2/*.py | |
138 | %{py3_sitedir}/pygit2/__pycache__ | |
067cd5ad JB |
139 | %attr(755,root,root) %{py3_sitedir}/pygit2/_libgit2.cpython-*.so |
140 | %attr(755,root,root) %{py3_sitedir}/_pygit2.cpython-*.so | |
f193cb9b | 141 | %{py3_sitedir}/pygit2-%{version}-py*.egg-info |
01a65240 KK |
142 | %endif |
143 | ||
144 | %if %{with docs} | |
145 | %files apidoc | |
146 | %defattr(644,root,root,755) | |
147 | %doc docs/_build/html/* | |
148 | %endif |