b71cdf1
%if 0%{?fedora} > 12
b71cdf1
%global with_python3 1
b71cdf1
%else
cef9eae
%{!?__python2: %global __python2 /usr/bin/python2}
b71cdf1
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
cef9eae
%endif
cef9eae
b71cdf1
%global commit ee467fa505d04850ebc992d48b5374fb8b054446
5dc58d4
%global shortcommit %(c=%{commit}; echo ${c:0:7})
f680e80
%global realname rospkg
f680e80
b71cdf1
Name:           python-%{realname}
b71cdf1
Version:        1.0.31
d9dbb39
Release:        1%{?dist}
f680e80
Summary:        Utilities for ROS package, stack, and distribution information
f680e80
f680e80
License:        BSD
f680e80
URL:            http://ros.org/wiki/rospkg
67b57a0
Source0:        https://github.com/ros-infrastructure/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz
cef9eae
b71cdf1
# Add armv7l/ppc/ppc64 to the allowed arches in the arch detect test (submitted upstream)
b71cdf1
Patch0:         %{realname}-1.0.31-arch-detect-test.patch
cef9eae
f680e80
BuildArch:      noarch
f680e80
cef9eae
BuildRequires:  python2-devel
8303996
BuildRequires:  python-argparse
cef9eae
BuildRequires:  python-setuptools
cef9eae
BuildRequires:  python-catkin-sphinx
b71cdf1
%if 0%{?rhel} && 0%{?rhel} < 7
b71cdf1
BuildRequires:  python-sphinx10
b71cdf1
BuildRequires:  python-nose1.1
b71cdf1
%else
f680e80
BuildRequires:  python-sphinx
b71cdf1
BuildRequires:  python-nose
b71cdf1
%endif
67a35fc
BuildRequires:  PyYAML
9ce7183
BuildRequires:  python-mock
9ce7183
BuildRequires:  python-coverage
cef9eae
67a35fc
Requires:       PyYAML
cef9eae
Requires:       python-argparse
f680e80
b71cdf1
%if 0%{?with_python3}
b71cdf1
%package -n python3-%{realname}
b71cdf1
Summary:        Utilities for ROS package, stack, and distribution information
b71cdf1
b71cdf1
BuildRequires:  python3-coverage
b71cdf1
BuildRequires:  python3-devel
b71cdf1
BuildRequires:  python3-mock
b71cdf1
BuildRequires:  python3-nose
b71cdf1
BuildRequires:  python3-PyYAML
b71cdf1
BuildRequires:  python3-setuptools
b71cdf1
BuildRequires:  python3-sphinx
b71cdf1
Requires:       python3-PyYAML
b71cdf1
%endif
b71cdf1
f680e80
%description
b71cdf1
The ROS packaging system simplifies development and distribution of code
b71cdf1
libraries. It enables you to easily specify dependencies between code
b71cdf1
libraries, easily interact with those libraries from the command-line, and
b71cdf1
release your code for others to use.
b71cdf1
b71cdf1
%if 0%{?with_python3}
b71cdf1
%description -n python3-%{realname}
b71cdf1
The ROS packaging system simplifies development and distribution of code
b71cdf1
libraries. It enables you to easily specify dependencies between code
b71cdf1
libraries, easily interact with those libraries from the command-line, and
f680e80
release your code for others to use.
b71cdf1
%endif
f680e80
f680e80
%prep
5dc58d4
%setup -qn %{realname}-%{commit}
b71cdf1
%patch0 -p1 -b .arch-detect-test
b71cdf1
b71cdf1
%if 0%{?with_python3}
b71cdf1
rm -rf %{py3dir}
b71cdf1
cp -a . %{py3dir}
b71cdf1
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
cef9eae
%endif
b71cdf1
b71cdf1
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
f680e80
f680e80
%build
cef9eae
%{__python2} setup.py build
b71cdf1
%if 0%{?rhel} && 0%{?rhel} < 7
b71cdf1
make -C doc html man SPHINXBUILD=sphinx-1.0-build
b71cdf1
%else
b71cdf1
make -C doc html man
b71cdf1
%endif
cef9eae
rm -f doc/_build/html/.buildinfo
cef9eae
b71cdf1
%if 0%{?with_python3}
b71cdf1
pushd %{py3dir}
b71cdf1
%{__python3} setup.py build
b71cdf1
# TODO: Disabled until python3-catkin-sphinx is built
b71cdf1
#make -C doc html man SPHINXBUILD=sphinx-build-%{python3_version}
b71cdf1
pushd build/scripts-%{python3_version}
b71cdf1
for f in *; do mv $f python3-$f; done
b71cdf1
popd
b71cdf1
popd
b71cdf1
%endif
b71cdf1
cef9eae
%check
cef9eae
# Tests expect the base folder name to be 'rospkg', so move the source folder
cef9eae
cd ..
cef9eae
mv %{realname}-%{commit} %{realname}
cef9eae
cd %{realname}
cef9eae
# Run the nosetests
b71cdf1
%if 0%{?rhel} && 0%{?rhel} < 7
b71cdf1
LANG=en_US.utf8 PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests1.1 -w test
b71cdf1
%else
b71cdf1
LANG=en_US.utf8 PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests -w test
b71cdf1
%endif
cef9eae
# Put the source folder back to its original name
cef9eae
cd ..
cef9eae
mv %{realname} %{realname}-%{commit}
cef9eae
cd %{realname}-%{commit}
f680e80
b71cdf1
%if 0%{?with_python3}
b71cdf1
# Tests expect the base folder name to be 'rospkg', so move the source folder
b71cdf1
cd ..
b71cdf1
mv %{py3dir} %{realname}
b71cdf1
cd %{realname}
b71cdf1
# Run the nosetests
b71cdf1
LANG=en_US.utf8 PYTHONPATH=%{buildroot}%{python3_sitelib} nosetests-%{python3_version} -w test
b71cdf1
# Put the source folder back to its original name
b71cdf1
cd ..
b71cdf1
mv %{realname} %{py3dir}
b71cdf1
cd %{py3dir}
b71cdf1
%endif
b71cdf1
f680e80
%install
f680e80
rm -rf $RPM_BUILD_ROOT
cef9eae
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
f680e80
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{realname}
f680e80
install -p -m 0644 manifest.xml $RPM_BUILD_ROOT%{_datadir}/%{realname}
f680e80
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
f680e80
install -p -m 0644 doc/man/rosversion.1 $RPM_BUILD_ROOT%{_mandir}/man1
f680e80
f680e80
sed -i 's|#!/usr/bin/env python||' $RPM_BUILD_ROOT%{python_sitelib}/%{realname}/*.py
f680e80
b71cdf1
%if 0%{?with_python3}
b71cdf1
pushd %{py3dir}
b71cdf1
%{__python3} setup.py install --skip-build --root %{buildroot}
b71cdf1
popd
b71cdf1
%endif
b71cdf1
f680e80
%files
cef9eae
%doc doc/_build/html
b71cdf1
%{_bindir}/rosversion
cef9eae
%{python2_sitelib}/%{realname}-%{version}-py?.?.egg-info
cef9eae
%{python2_sitelib}/%{realname}
f680e80
%{_mandir}/man1/*.gz
f680e80
%{_datadir}/%{realname}
f680e80
b71cdf1
%if 0%{?with_python3}
b71cdf1
%files -n python3-%{realname}
b71cdf1
%doc doc/_build/html
b71cdf1
%{_bindir}/python3-rosversion
b71cdf1
%{python3_sitelib}/%{realname}-%{version}-py?.?.egg-info
b71cdf1
%{python3_sitelib}/%{realname}
b71cdf1
%endif
b71cdf1
f680e80
%changelog
b71cdf1
* Sat Oct 25 2014 Scott K Logan <logans@cottsay.net> - 1.0.31-1
b71cdf1
- Update to release 1.0.31
b71cdf1
- Fix test failure on PPC
b71cdf1
- Remove argparse patch (fixed upstream)
b71cdf1
- Fix sphinx and nose dependencies in el6
b71cdf1
- Add python3 package
b71cdf1
d9dbb39
* Tue Jul 15 2014 Scott K Logan <logans@cottsay.net> - 1.0.29-1
d9dbb39
- Update to release 1.0.29
d9dbb39
- Fix test failure on ARM
d9dbb39
9528764
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.28-2
9528764
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
9528764
cef9eae
* Wed Apr 16 2014 Rich Mattes <richmattes@gmail.com> - 1.0.28-1
cef9eae
- Update to release 1.0.28
cef9eae
- Remove argparse from python dependency list (rhbz#1088448)
cef9eae
- Add requirement on python-argparse
cef9eae
- Add check section
cef9eae
- Add html documentation
cef9eae
67a35fc
* Fri Apr 04 2014 Scott K Logan <logans@cottsay.net> - 1.0.27-1
67a35fc
- Update to release 1.0.27
67a35fc
- Added PyYAML BuildRequires and Requires
67a35fc
67b57a0
* Sat Feb 08 2014 Rich Mattes <richmattes@gmail.com> - 1.0.26-1
67b57a0
- Update to release 1.0.26
67b57a0
5dc58d4
* Mon Aug 19 2013 Rich Mattes <richmattes@gmail.com> - 1.0.21-1
5dc58d4
- Update to release 1.0.21
5dc58d4
- Update to github sourceurl guidelines
5dc58d4
89ecb5e
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.20-2.20130318git0a4448e
89ecb5e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
89ecb5e
78ed549
* Mon Mar 18 2013 Rich Mattes <richmattes@gmail.com> - 1.0.20-1.20130318git0a4448e
78ed549
- Update to release 1.0.20
78ed549
9299bc7
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.18-2
9299bc7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
9299bc7
ea48979
* Wed Jan 02 2013 Rich Mattes <richmattes@gmail.com> - 1.0.18-1
ea48979
- Update to version 1.0.18
ea48979
8f93f39
* Fri Oct 26 2012 Rich Mattes <richmattes@gmail.com> - 1.0.10-1
8f93f39
- Update to version 1.0.10
8f93f39
f680e80
* Sat Sep 22 2012 Rich Mattes <richmattes@gmail.com> - 1.0.6-2
f680e80
- Moved build to build section
f680e80
- Finer-grained filenames in files section
f680e80
f680e80
* Sat Jun 16 2012 Rich Mattes <richmattes@gmail.com> - 1.0.6-1
f680e80
- Update to version 1.0.6
f680e80
f680e80
* Sat Jun 02 2012 Rich Mattes <richmattes@gmail.com> - 1.0.3-1
f680e80
- Update to version 1.0.3
f680e80
f680e80
* Wed Apr 25 2012 Rich Mattes <richmattes@gmail.com> - 1.0.2-1
f680e80
- Initial package