%if 0%{?fedora} > 12 || 0%{?rhel} > 6 %global with_python3 1 %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} %endif %global snaphash 6825bba Name: pygit2 Version: 0.17.0 Release: 1%{?dist} Summary: Python bindings to libgit2 License: GPLv2 URL: https://github.com/libgit2/pygit2 Source0: libgit2-pygit2-v%{version}-0-g%{snaphash}.tar.gz BuildRequires: python-devel libgit2-devel Requires: libgit2 %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python-tools %endif %if (0%{?rhel} && 0%{?rhel} <= 6) || ( 0%{?fedora} && 0%{?fedora} <= 13 ) BuildRequires: python-importlib Requires: python-importlib %endif %description pygit2 is a set of Python bindings to the libgit2 linkable C Git library. The supported versions of Python are 2.6, 2.7, 3.1 and 3.2 Through this text Python 3 is used for the inline examples. Also, the Python 3 terminology is used (for instance we say text strings instead of unicode strings). %if 0%{?with_python3} %package -n python3-pygit2 Summary: Python3 bindings to libgit2 %description -n python3-pygit2 pygit2 is a set of Python bindings to the libgit2 linkable C Git library. The supported versions of Python are 2.6, 2.7, 3.1 and 3.2 Through this text Python 3 is used for the inline examples. Also, the Python 3 terminology is used (for instance we say text strings instead of unicode strings). %endif %prep %setup -q -c -n libgit2-pygit2-%{snaphash} %if 0%{?with_python3} cp -r libgit2-pygit2-%{snaphash} py3-libgit2-pygit2-%{snaphash} %endif %build # Remove CFLAGS=... for noarch packages (unneeded) pushd libgit2-pygit2-%{snaphash} CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build popd %if 0%{?with_python3} pushd py3-libgit2-pygit2-%{snaphash} sed -i -e "s|open('README.rst')|open('README.rst', 'r', encoding='utf8')|" setup.py CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build popd %endif %install rm -rf $RPM_BUILD_ROOT pushd libgit2-pygit2-%{snaphash} %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %if 0%{?with_python3} pushd py3-libgit2-pygit2-%{snaphash} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif %files %doc libgit2-pygit2-%{snaphash}/COPYING libgit2-pygit2-%{snaphash}/README.rst %{python_sitearch}/* %if 0%{?with_python3} %files -n python3-pygit2 %doc py3-libgit2-pygit2-%{snaphash}/COPYING py3-libgit2-pygit2-%{snaphash}/README.rst %{python3_sitearch}/* %endif %changelog * Wed Jul 4 2012 Pierre-Yves Chibon - 0.17.0-1 - Initial packaging work