%global commit c00d68bc83f3eee25cc4da60e41519c3ffc829ac
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global realname catkin-sphinx
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
Name: python-%{realname}
Version: 0.2.1
Release: 5.20130602git%{shortcommit}%{?dist}
Summary: Sphinx plugins for Catkin projects
License: BSD
URL: https://github.com/ros/%{realname}
Source0: https://github.com/ros/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz
BuildArch: noarch
Requires: python-sphinx
BuildRequires: python2-devel
%if 0%{?with_python3}
%package -n python3-%{realname}
Summary: Sphinx plugins for Catkin projects
BuildRequires: python3-devel
Requires: python3-sphinx
%endif
%description
Sphinx plugins for Catkin projects.
%if 0%{?with_python3}
%description -n python3-%{realname}
Sphinx plugins for Catkin projects.
%endif
%prep
%setup -qn %{realname}-%{commit}
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif
%files
%doc README.md
%{python2_sitelib}/catkin_sphinx
%{python2_sitelib}/catkin_sphinx-%{version}-py?.?.egg-info
%if 0%{?with_python3}
%files -n python3-%{realname}
%doc README.md
%{python3_sitelib}/catkin_sphinx
%{python3_sitelib}/catkin_sphinx-%{version}-py?.?.egg-info
%endif
%changelog
* Sat Dec 13 2014 Scott K Logan <logans@cottsay.net> - 0.2.1-5.20130602gitc00d68b
- Add python3 package
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.1-4.20130602gitc00d68b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.1-3.20130602gitc00d68b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jun 03 2013 Rich Mattes <richmattes@gmail.com> - 0.2.1-2.20130602gitc00d68b
- Change Python BuildRequires to python2-devel
- Don't try to remove RPM_BUILD_ROOT in install
* Sun Jun 02 2013 Rich Mattes <richmattes@gmail.com> - 0.2.1-1.20130602gitc00d68b
- Initial package