%global commit e1ac5e51bbabc650fa78edf9009ba22cc366f4e5
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global module catkin_tools
%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-%{module}
Version: 0.3.1
Release: 3%{?dist}
Summary: Command line tools for working with catkin
Group: Development/Tools
License: ASL 2.0
URL: http://catkin-tools.readthedocs.org
Source0: https://github.com/catkin/%{module}/archive/%{commit}/%{module}-%{commit}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-argparse
BuildRequires: python-catkin_pkg >= 0.2.8
BuildRequires: cmake
%if 0%{?fedora} > 19 || 0%{?rhel} > 6
BuildRequires: python-flake8
%endif
BuildRequires: python-mock
BuildRequires: python-nose
BuildRequires: python-pep8
BuildRequires: python-setuptools
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires: python-sphinx10
%else
BuildRequires: python-sphinx
%endif
BuildRequires: PyYAML
Requires: cmake
Requires: make
Requires: python-argparse
Requires: python-catkin_pkg >= 0.2.8
Requires: python-setuptools
Requires: PyYAML
%description
Provides command line tools for working with catkin
%if 0%{?with_python3}
%package -n python3-%{module}
Summary: Command line tools for working with catkin
BuildRequires: python3-catkin_pkg >= 0.2.8
BuildRequires: cmake
BuildRequires: python3-devel
%if 0%{?fedora} > 19 || 0%{?rhel} > 6
BuildRequires: python3-flake8
%endif
BuildRequires: python3-mock
BuildRequires: python3-nose
BuildRequires: python3-pep8
BuildRequires: python3-sphinx
BuildRequires: python3-PyYAML
Requires: cmake
Requires: make
Requires: python3-catkin_pkg >= 0.2.8
Requires: python3-setuptools
Requires: python3-PyYAML
%description -n python3-%{module}
Provides command line tools for working with catkin
%endif
%prep
%setup -qc
mv %{module}-%{commit} python2
%if 0%{?with_python3}
cp -a python2 python3
find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif
find python2 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%build
pushd python2
%{__python2} setup.py build
%if 0%{?rhel} && 0%{?rhel} <= 6
make -C docs html man SPHINXBUILD=sphinx-1.0-build
%else
make -C docs html man
%endif
rm -f docs/_build/html/.buildinfo
popd
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
make -C docs html man SPHINXBUILD=sphinx-build-%{python3_version}
pushd docs/_build/man
for f in *; do mv $f python3-$f; done
popd
rm -f docs/_build/html/.buildinfo
popd
%endif
%install
pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
install -d %{buildroot}%{_mandir}/man1
install -p -m0644 docs/_build/man/*.1 %{buildroot}%{_mandir}/man1/
# Removed the installed test
rm -rf %{buildroot}%{python2_sitelib}/tests
popd
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot} --install-scripts %{_bindir}3
pushd %{buildroot}%{_bindir}3
for f in *; do mv $f %{buildroot}%{_bindir}/python3-$f; done
popd
rmdir %{buildroot}%{_bindir}3
install -p -m0644 docs/_build/man/*.1 %{buildroot}%{_mandir}/man1/
# Removed the installed test
rm -rf %{buildroot}%{python3_sitelib}/tests
popd
%endif
# Fix the install location of the bash completion scripts
install -d %{buildroot}%{_datadir}/bash-completion/completions/
mv %{buildroot}/usr/etc/bash_completion.d/%{module}-completion.bash %{buildroot}%{_datadir}/bash-completion/completions/catkin
rm %{buildroot}%{_datadir}/zsh/site-functions/*.bash
%if 0%{?fedora} > 19 || 0%{?rhel} > 6
%check
pushd python2
# The tests depend on "catkin" being in PATH.
mkdir -p tmpbin
ln -s %{buildroot}%{_bindir}/catkin tmpbin/catkin
PYTHONPATH=%{buildroot}%{python2_sitelib} PATH=`pwd`/tmpbin:$PATH nosetests -w tests -e test_build_*
popd
%if 0%{?with_python3}
pushd python3
mkdir -p tmpbin
ln -s %{buildroot}%{_bindir}/python3-catkin tmpbin/catkin
PYTHONPATH=%{buildroot}%{python2_sitelib} PATH=`pwd`/tmpbin:$PATH nosetests-%{python3_version} -w tests -e test_build_*
popd
%endif
%endif
%files
%if !0%{?rhel} || 0%{?rhel} >= 7
%doc python2/README.md python2/docs/_build/html
%license python2/LICENSE
%else
%doc python2/LICENSE python2/README.md python2/docs/_build/html
%endif
%{python2_sitelib}/%{module}
%{python2_sitelib}/%{module}-%{version}-py?.?.egg-info
%{_bindir}/catkin
%{_mandir}/man1/%{module}.1.gz
%{_datadir}/zsh/site-functions/_catkin
%{_datadir}/bash-completion/
%if 0%{?with_python3}
%files -n python3-%{module}
%doc python3/README.md python3/docs/_build/html
%license python3/LICENSE
%{python3_sitelib}/%{module}
%{python3_sitelib}/%{module}-%{version}-py?.?.egg-info
%{_bindir}/python3-catkin
%{_mandir}/man1/python3-%{module}.1.gz
%endif
%changelog
* Sun Sep 18 2016 Scott K Logan <logans@cottsay.net> - 0.3.1-3
- Fix bash completion installation location (rhbz#1375604)
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Sun Feb 21 2016 Rich Mattes <richmattes@gmail.com> - 0.3.1-1
- Update to release 0.3.1 (rhbz#1293318)
- Fix rawhide FTBFS (rhbz#1307897)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Dec 02 2015 Scott K Logan <logans@cottsay.net> - 0.3.0-3
- Add upstream patch for newer versions of flake8
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Sat Jul 04 2015 Scott K Logan <logans@cottsay.net> - 0.3.0-1
- Update to 0.3.0
- Add Requires: cmake make (RHBZ#1227816)
- Update to latest packaging guidelines
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Oct 22 2014 Scott K Logan <logans@cottsay.net> - 0.2.0-2
- Add upstream terminal width patch to enable tests
* Sat Oct 18 2014 Scott K Logan <logans@cottsay.net> - 0.2.0-1
- Update to 0.2.0
- Add python3 package
- Exclude new test_build_* tests because they require catkin
- Disable buildfarm testing (https://github.com/catkin/catkin_tools/issues/122)
* Tue Jun 10 2014 Scott K Logan <logans@cottsay.net> - 0.1.0-1
- Initial package