Blob Blame History Raw
%global module_name catkin_pkg
%global commit f5e19aadafc9cea59f41f018e3a2fc2517d434a9
%global shortcommit %(c=%{commit}; echo ${c:0:7})

%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.3.1
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://github.com/ros-infrastructure/%{module_name}/archive/%{commit}/%{module_name}-%{commit}.tar.gz

BuildRequires:  python2-devel
BuildRequires:  python-dateutil
BuildRequires:  python-docutils
BuildRequires:  python-mock
BuildRequires:  python-nose
BuildRequires:  python-setuptools
%if !0%{?rhel} || 0%{?rhel} > 6
BuildRequires:  python-sphinx
%endif

%description
Library for retrieving information about catkin packages

%package -n python2-%{module_name}
Summary:        Library for retrieving information about catkin packages
%{?python_provide:%python_provide python2-%{module_name}}
Requires:       python-dateutil
Requires:       python-docutils

%description -n python2-%{module_name}
Library for retrieving information about catkin packages

%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
BuildRequires:  python3-sphinx

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

%prep
%setup -qc

mv %{module_name}-%{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}|'

sed -i "s/  'catkin_/  'python3-catkin_/g" python3/setup.py

%build
pushd python2
%{__python2} setup.py build
%if !0%{?rhel} || 0%{?rhel} > 6
PYTHONPATH=%{_builddir}/%{name}-%{version}/python2/build/lib make %{?_smp_mflags} -C doc html
rm -f doc/_build/html/.buildinfo
%endif
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
PYTHONPATH=%{_builddir}/%{name}-%{version}/python3/build/lib make %{?_smp_mflags} -C doc html SPHINXAPIDOC=sphinx-apidoc-%{python3_version} SPHINXBUILD=sphinx-build-%{python3_version}
rm -f doc/_build/html/.buildinfo
pushd bin
for f in *; do mv $f python3-$f; done
popd
popd
%endif

%install
pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

%check
pushd python2
%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
popd

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

%files -n python2-%{module_name}
%if !0%{?rhel} || 0%{?rhel} > 6
%doc python2/doc/_build/html python2/README.rst
%license python2/LICENSE
%else
%doc python2/LICENSE python2/README.rst
%endif
%{_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}
%doc python3/doc/_build/html python3/README.rst
%license python3/LICENSE
%{_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 Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sun Apr 09 2017 Rich Mattes <richmattes@gmail.com> - 0.3.1-1
- Update to release 0.3.1 (rhbz#1422069)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.10-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.2.10-6
- Rebuild for Python 3.6

* Tue Sep 27 2016 Rich Mattes <richmattes@gmail.com> - 0.2.10-5
- Remove argparse requirement

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.10-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.10-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Sep 17 2015 Rich Mattes <richmattes@gmail.com> - 0.2.10-1
- Update to release 0.2.10 (rhbz#1250758)
- Remove upstreamed patches
- Fix spec file layout so spectool can parse it

* Tue Jun 30 2015 Scott K Logan <logans@cottsay.net> - 0.2.9-1
- Update to 0.2.9
- Switch to Github upstream to get docs
- Update to latest packaging guidelines

* 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