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