Blob Blame History Raw
%{?!_without_doc:%global with_doc 0%{?_with_doc:1} || !0%{?rhel} || 0%{?rhel} >= 7}
%{?!_without_python2:%global with_python2 0%{?_with_python2:1} || !(0%{?fedora} >= 32 || 0%{?rhel} >= 8)}
%{?!_without_python3:%global with_python3 0%{?_with_python3:1} || !0%{?rhel} || 0%{?rhel} >= 7}

%global srcname catkin_pkg

Name:           python-%{srcname}
Version:        0.4.23
Release:        1%{?dist}
Summary:        Library for retrieving information about catkin packages

License:        BSD
URL:            https://github.com/ros-infrastructure/%{srcname}
Source0:        https://github.com/ros-infrastructure/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch

%description
%{summary}


%if 0%{?with_doc}
%package doc
Summary:        HTML documentation for %{name}
BuildRequires:  python%{python3_pkgversion}-sphinx

%description doc
HTML API documentation for the Python module '%{srcname}'
%endif


%if 0%{?with_python2}
%package -n python2-%{srcname}
Summary:        %{summary}
BuildRequires:  python2-dateutil
BuildRequires:  python2-devel
BuildRequires:  python2-docutils
BuildRequires:  python2-mock
BuildRequires:  python2-nose
BuildRequires:  pyparsing
BuildRequires:  python2-setuptools
%{?python_provide:%python_provide python2-%{srcname}}

%if %{undefined __pythondist_requires}
Requires:       python2-dateutil
Requires:       python2-docutils
Requires:       pyparsing
%endif

%if (!0%{?rhel} || 0%{?rhel} >= 8) && (0%{?with_doc})
Suggests:       %{name}-doc = %{version}-%{release}
%endif

%description -n python2-%{srcname}
%{summary}
%endif


%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{summary}
BuildRequires:  python%{python3_pkgversion}-dateutil
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-docutils
BuildRequires:  python%{python3_pkgversion}-mock
BuildRequires:  python%{python3_pkgversion}-nose
BuildRequires:  python%{python3_pkgversion}-pyparsing
BuildRequires:  python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

%if %{undefined __pythondist_requires}
Requires:       python%{python3_pkgversion}-dateutil
Requires:       python%{python3_pkgversion}-docutils
Requires:       python%{python3_pkgversion}-pyparsing
%endif

%if (!0%{?rhel} || 0%{?rhel} >= 8) && (0%{?with_doc})
Suggests:       %{name}-doc = %{version}-%{release}
%endif

%description -n python%{python3_pkgversion}-%{srcname}
%{summary}
%endif


%prep
%autosetup -p1 -n %{srcname}-%{version}


%build
%if 0%{?with_python2}
%py2_build
%endif

%if 0%{?with_python3}
%py3_build
%endif

%if 0%{?with_doc}
PYTHONPATH=$PWD/build/lib \
  PYTHONDONTWRITEBYTECODE=1 \
  %make_build -C doc html SPHINXBUILD=sphinx-build-%{python3_version} SPHINXAPIDOC=sphinx-apidoc-%{python3_version}
rm doc/_build/html/.buildinfo
%endif


%install
%if 0%{?with_python2}
%py2_install
%endif

%if 0%{?with_python3}
%py3_install -- --install-scripts %{_bindir}/python%{python3_pkgversion}
pushd %{buildroot}%{_bindir}/python%{python3_pkgversion}
for i in *; do mv $i ../python%{python3_pkgversion}-$i; done
popd
rmdir %{buildroot}%{_bindir}/python%{python3_pkgversion}
%endif


%check
%if 0%{?with_python2}
%if "%{python2_version}" == "2.6"
# Skip tests that use python 2.7 assertions
PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests -w test \
  -e "(test_check_known_attributes|test_create_package_template|test_flake8|test_package_decorator_init|test_topological_order_packages_with_duplicates|test_validate_metapackage|test_validate_package)"
%else
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m nose -w test -e "(test_flake8)"
%endif
%endif

%if 0%{?with_python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m nose -w test -e "(test_flake8)"
%endif


%if 0%{?with_doc}
%files doc
%license LICENSE
%doc doc/_build/html
%endif

%if 0%{?with_python2}
%files -n python2-%{srcname}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{srcname}/
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info/
%{_bindir}/catkin_create_pkg
%{_bindir}/catkin_find_pkg
%{_bindir}/catkin_generate_changelog
%{_bindir}/catkin_package_version
%{_bindir}/catkin_prepare_release
%{_bindir}/catkin_tag_changelog
%{_bindir}/catkin_test_changelog
%endif

%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/
%{_bindir}/python%{python3_pkgversion}-catkin_create_pkg
%{_bindir}/python%{python3_pkgversion}-catkin_find_pkg
%{_bindir}/python%{python3_pkgversion}-catkin_generate_changelog
%{_bindir}/python%{python3_pkgversion}-catkin_package_version
%{_bindir}/python%{python3_pkgversion}-catkin_prepare_release
%{_bindir}/python%{python3_pkgversion}-catkin_tag_changelog
%{_bindir}/python%{python3_pkgversion}-catkin_test_changelog
%endif


%changelog
* Wed Sep 30 2020 Scott K Logan <logans@cottsay.net> - 0.4.23-1
- Update to 0.4.23 (rhbz#1883763)

* Thu Jun 25 2020 Scott K Logan <logans@cottsay.net> - 0.4.22-1
- Update to 0.4.22 (rhbz#1850827)

* Fri May 29 2020 Scott K Logan <logans@cottsay.net> - 0.4.20-1
- Update to 0.4.20 (rhbz#1835055)

* Sat May 09 2020 Scott K Logan <logans@cottsay.net> - 0.4.19-1
- Update to 0.4.19 (rhbz#1824378)

* Wed Apr 15 2020 Scott K Logan <logans@cottsay.net> - 0.4.16-1
- Update to 0.4.16 (rhbz#1782360)

* Wed Oct 30 2019 Scott K Logan <logans@cottsay.net> - 0.4.14-1
- Update to 0.4.14 (rhbz#1762232)

* Fri Jul 26 2019 Scott K Logan <logans@cottsay.net> - 0.4.13-1
- Update to 0.4.13

* Wed Jul 17 2019 Scott K Logan <logans@cottsay.net> - 0.4.12-1
- Update to 0.4.12 (rhbz#1702118)

* Tue Apr 09 2019 Scott K Logan <logans@cottsay.net> - 0.4.11-1
- Update to 0.4.11
- Switch to Python 3 Sphinx
- Merge spec format with master

* 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

* 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
- Remove README.rst (not present in Pypi sources)

* 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