%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__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
%global commit 4cee3f4c28afea1c55f82371cb9cac91edf5de06
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global realname rospkg
Name: python-rospkg
Version: 1.0.28
Release: 1%{?dist}
Summary: Utilities for ROS package, stack, and distribution information
License: BSD
URL: http://ros.org/wiki/rospkg
Source0: https://github.com/ros-infrastructure/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz
# Remove python-argparse from runtime dependency list (rhbz#1088448)
Patch0: %{realname}-1.0.28-argparse.patch
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: python-catkin-sphinx
BuildRequires: python-sphinx
BuildRequires: PyYAML
Requires: PyYAML
Requires: python-argparse
%description
The ROS packaging system simplifies development and distribution of code
libraries. It enable you to easily specify dependencies between code
libraries, easily interact with those libraries from the command-line, and
release your code for others to use.
%prep
%setup -qn %{realname}-%{commit}
%if 0%{?fedora} || 0%{?rhel} > 6
%patch0 -p0 -b .argparse
%endif
%build
%{__python2} setup.py build
pushd doc
make html
make man
popd
rm -f doc/_build/html/.buildinfo
%check
# Tests expect the base folder name to be 'rospkg', so move the source folder
cd ..
mv %{realname}-%{commit} %{realname}
cd %{realname}
# Run the nosetests
pushd test
PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests
popd
# Put the source folder back to its original name
cd ..
mv %{realname} %{realname}-%{commit}
cd %{realname}-%{commit}
%install
rm -rf $RPM_BUILD_ROOT
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{realname}
install -p -m 0644 manifest.xml $RPM_BUILD_ROOT%{_datadir}/%{realname}
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
install -p -m 0644 doc/man/rosversion.1 $RPM_BUILD_ROOT%{_mandir}/man1
sed -i 's|#!/usr/bin/env python||' $RPM_BUILD_ROOT%{python_sitelib}/%{realname}/*.py
%files
%doc doc/_build/html
%{_bindir}/*
%{python2_sitelib}/%{realname}-%{version}-py?.?.egg-info
%{python2_sitelib}/%{realname}
%{_mandir}/man1/*.gz
%{_datadir}/%{realname}
%changelog
* Wed Apr 16 2014 Rich Mattes <richmattes@gmail.com> - 1.0.28-1
- Update to release 1.0.28
- Remove argparse from python dependency list (rhbz#1088448)
- Add requirement on python-argparse
- Add check section
- Add html documentation
* Fri Apr 04 2014 Scott K Logan <logans@cottsay.net> - 1.0.27-1
- Update to release 1.0.27
- Added PyYAML BuildRequires and Requires
* Sat Feb 08 2014 Rich Mattes <richmattes@gmail.com> - 1.0.26-1
- Update to release 1.0.26
* Mon Aug 19 2013 Rich Mattes <richmattes@gmail.com> - 1.0.21-1
- Update to release 1.0.21
- Update to github sourceurl guidelines
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.20-2.20130318git0a4448e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Mar 18 2013 Rich Mattes <richmattes@gmail.com> - 1.0.20-1.20130318git0a4448e
- Update to release 1.0.20
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jan 02 2013 Rich Mattes <richmattes@gmail.com> - 1.0.18-1
- Update to version 1.0.18
* Fri Oct 26 2012 Rich Mattes <richmattes@gmail.com> - 1.0.10-1
- Update to version 1.0.10
* Sat Sep 22 2012 Rich Mattes <richmattes@gmail.com> - 1.0.6-2
- Moved build to build section
- Finer-grained filenames in files section
* Sat Jun 16 2012 Rich Mattes <richmattes@gmail.com> - 1.0.6-1
- Update to version 1.0.6
* Sat Jun 02 2012 Rich Mattes <richmattes@gmail.com> - 1.0.3-1
- Update to version 1.0.3
* Wed Apr 25 2012 Rich Mattes <richmattes@gmail.com> - 1.0.2-1
- Initial package