Blob Blame Raw
%global module_name catkin_pkg

%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())")}
%{!?python2_version: %global python2_version %(%{__python2} -c "from sys import stdout, version; stdout.write(version[:3])")}
%endif

Name:           python-%{module_name}
Version:        0.2.7
Release:        2%{?dist}
Summary:        Library for retrieving information about catkin packages

License:        BSD
URL:            https://github.com/ros-infrastructure/%{module_name}
BuildArch:      noarch
Source0:        https://pypi.python.org/packages/source/c/%{module_name}/%{module_name}-%{version}.tar.gz

Requires:       python-argparse
Requires:       python-dateutil
Requires:       python-docutils
BuildRequires:  python2-devel
BuildRequires:  python-argparse
BuildRequires:  python-dateutil
BuildRequires:  python-docutils
BuildRequires:  python-mock
BuildRequires:  python-nose
BuildRequires:  python-setuptools

%if 0%{?with_python3}
%package -n python3-%{module_name}
Summary:        Library for retrieving information about catkin packages

Requires:       python3-dateutil
Requires:       python3-docutils
BuildRequires:  python3-dateutil
BuildRequires:  python3-devel
BuildRequires:  python3-docutils
BuildRequires:  python3-mock
BuildRequires:  python3-nose
BuildRequires:  python3-setuptools
%endif

%description
Library for retrieving information about catkin packages

%if 0%{?with_python3}
%description -n python3-%{module_name}
Library for retrieving information about catkin packages
%endif

%prep
%setup -q -n %{module_name}-%{version}

%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
pushd build/scripts-%{python3_version}
for f in *; do mv $f python3-$f; done
popd
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

%check
%if "%{python2_version}" == "2.6"
# Skip tests that use python 2.7 assertions
PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests -w test -e "(test_topological_order_packages_with_duplicates|test_validate_metapackage|test_package_decorator_init|test_create_package_template)"
%else
PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests-%{python2_version} -w test
%endif

%if 0%{?with_python3}
pushd %{py3dir}
PYTHONPATH=%{buildroot}%{python3_sitelib} nosetests-%{python3_version} -w test
popd
%endif

%files
%{_bindir}/catkin_create_pkg
%{_bindir}/catkin_find_pkg
%{_bindir}/catkin_generate_changelog
%{_bindir}/catkin_tag_changelog
%{_bindir}/catkin_test_changelog
%{python2_sitelib}/%{module_name}/
%{python2_sitelib}/%{module_name}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{module_name}
%{_bindir}/python3-catkin_create_pkg
%{_bindir}/python3-catkin_find_pkg
%{_bindir}/python3-catkin_generate_changelog
%{_bindir}/python3-catkin_tag_changelog
%{_bindir}/python3-catkin_test_changelog
%{python3_sitelib}/%{module_name}/
%{python3_sitelib}/%{module_name}-%{version}-py?.?.egg-info
%endif

%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Mar 12 2015 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.2.7-1
- Update to 0.2.7

* Sat Oct 25 2014 Scott K Logan <logans@cottsay.net> - 0.2.6-1
- Update to 0.2.6

* Sat Oct 18 2014 Scott K Logan <logans@cottsay.net> - 0.2.5-1
- Update to 0.2.5
- Add python3 package
- Exclude tests which are not compatible with python 2.6

* Thu Jul 31 2014 Scott K Logan <logans@cottsay.net> - 0.2.4-1
- Update to 0.2.4
- Remove README.rst (not present in Pypi sources)

* Wed Jul 16 2014 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.2.3-1
- Update to latest upstream release

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat May 10 2014 Scott K Logan <logans@cottsay.net> - 0.2.2-1
- Update to 0.2.2

* Thu Feb 06 2014 Scott K Logan <logans@cottsay.net> - 0.1.28-1
- Update to 0.1.28

* Thu Feb 06 2014 Scott K Logan <logans@cottsay.net> - 0.1.25-1
- Update to 0.1.25
- Added check section
- Added python-dateutil Requires/BuildRequires
- Added python-docutils Requires/BuildRequires
- Added python-nose BuildRequires
- Added python-mock BuildRequires

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Jul 17 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.1.18-1
- Update to 1.18
- https://bugzilla.redhat.com/show_bug.cgi?id=926034

* Sat Mar 16 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.1.10-1
- Initial rpm build