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