a062b4b
%{?!_without_python2:%global with_python2 0%{?_with_python2:1} || !(0%{?rhel} >= 8 || 0%{?fedora} >= 30)}
12f7b3e
%{?!_without_python3:%global with_python3 0%{?_with_python3:1} || !0%{?rhel} || 0%{?rhel} >= 7}
a062b4b
fdc8cf2
%global srcname osrf_pycommon
fdc8cf2
%global pkgname osrf-pycommon
fdc8cf2
fdc8cf2
Name:           python-%{pkgname}
60cf00c
Version:        0.2.1
635d814
Release:        1%{?dist}
a062b4b
Summary:        Commonly needed Python modules used by software developed at OSRF
fdc8cf2
fdc8cf2
# The entire source code is ASL 2.0 except parts of osrf_pycommon/terminal_color/windows.py which is BSD
fdc8cf2
License:        ASL 2.0 and BSD
fdc8cf2
URL:            http://osrf-pycommon.readthedocs.org/
12f7b3e
Source0:        https://github.com/osrf/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
fdc8cf2
fdc8cf2
BuildArch:      noarch
fdc8cf2
fdc8cf2
%description
fdc8cf2
osrf_pycommon is a python package which contains commonly used Python
fdc8cf2
boilerplate code and patterns. Things like ANSI terminal coloring, capturing
fdc8cf2
colored output from programs using sub-process, or even a simple logging system
fdc8cf2
which provides some nice functionality over the built-in Python logging system.
fdc8cf2
fdc8cf2
The functionality provided here should be generic enough to be reused in
fdc8cf2
arbitrary scenarios and should avoid bringing in dependencies which are not
fdc8cf2
part of the standard Python library. Where possible Windows and Linux/OS X
fdc8cf2
should be supported, and where it cannot it should be gracefully degrading.
fdc8cf2
12f7b3e
fdc8cf2
%package doc
fdc8cf2
Summary:        API Documentation for the osrf_pycommon Python modules
60cf00c
BuildRequires:  make
12f7b3e
BuildRequires:  python%{python3_pkgversion}-sphinx
fdc8cf2
fdc8cf2
%description doc
fdc8cf2
HTML documentation generated from osrf_pycommon sources to be used in
fdc8cf2
developing software which uses osrf_pycommon.
fdc8cf2
12f7b3e
a062b4b
%if 0%{?with_python2}
fdc8cf2
%package -n python2-%{pkgname}
a062b4b
Summary:        %{summary}
fdc8cf2
BuildRequires:  python2-devel
cced2f9
BuildRequires:  python2-mock
cced2f9
BuildRequires:  python2-nose
cced2f9
BuildRequires:  python2-setuptools
cced2f9
BuildRequires:  python2-trollius
fdc8cf2
%{?python_provide:%python_provide python2-%{pkgname}}
fdc8cf2
635d814
%if %{undefined __pythondist_requires}
12f7b3e
Requires:       python2-trollius
635d814
%endif
12f7b3e
635d814
%if !0%{?rhel} || 0%{?rhel} >= 8
12f7b3e
Suggests:       %{name}-doc = %{version}-%{release}
635d814
%endif
a062b4b
fdc8cf2
%description -n python2-%{pkgname}
fdc8cf2
osrf_pycommon is a python package which contains commonly used Python
fdc8cf2
boilerplate code and patterns. Things like ANSI terminal coloring, capturing
fdc8cf2
colored output from programs using sub-process, or even a simple logging system
fdc8cf2
which provides some nice functionality over the built-in Python logging system.
fdc8cf2
fdc8cf2
The functionality provided here should be generic enough to be reused in
fdc8cf2
arbitrary scenarios and should avoid bringing in dependencies which are not
fdc8cf2
part of the standard Python library. Where possible Windows and Linux/OS X
fdc8cf2
should be supported, and where it cannot it should be gracefully degrading.
635d814
%endif
a062b4b
12f7b3e
a062b4b
%if 0%{?with_python3}
a062b4b
%package -n python%{python3_pkgversion}-%{pkgname}
a062b4b
Summary:        %{summary}
a062b4b
BuildRequires:  python%{python3_pkgversion}-devel
a062b4b
BuildRequires:  python%{python3_pkgversion}-mock
a062b4b
BuildRequires:  python%{python3_pkgversion}-nose
a062b4b
BuildRequires:  python%{python3_pkgversion}-setuptools
a062b4b
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pkgname}}
a062b4b
635d814
%if !0%{?rhel} || 0%{?rhel} >= 8
12f7b3e
Suggests:       %{name}-doc = %{version}-%{release}
635d814
%endif
a062b4b
a062b4b
%description -n python%{python3_pkgversion}-%{pkgname}
fdc8cf2
osrf_pycommon is a python package which contains commonly used Python
fdc8cf2
boilerplate code and patterns. Things like ANSI terminal coloring, capturing
fdc8cf2
colored output from programs using sub-process, or even a simple logging system
fdc8cf2
which provides some nice functionality over the built-in Python logging system.
fdc8cf2
fdc8cf2
The functionality provided here should be generic enough to be reused in
fdc8cf2
arbitrary scenarios and should avoid bringing in dependencies which are not
fdc8cf2
part of the standard Python library. Where possible Windows and Linux/OS X
fdc8cf2
should be supported, and where it cannot it should be gracefully degrading.
635d814
%endif
fdc8cf2
12f7b3e
fdc8cf2
%prep
a062b4b
%autosetup -p1 -n %{srcname}-%{version}
1dce64e
c9d60b4
# Don't install the package.xml
c9d60b4
sed -i "\\|'share/' + package_name, \\['package.xml'\\]|d" setup.py
c9d60b4
19d3672
# Don't install the resource marker
19d3672
sed -i "\\|('share/ament_index/resource_index/packages',|$!{
19d3672
  N
19d3672
  \\|('share/ament_index/resource_index/packages',\n *\\['resource/' + package_name\\])|d
19d3672
  }" setup.py
12f7b3e
635d814
fdc8cf2
%build
a062b4b
%if 0%{?with_python2}
fdc8cf2
%py2_build
635d814
%endif
a062b4b
a062b4b
%if 0%{?with_python3}
fdc8cf2
%py3_build
635d814
%endif
fdc8cf2
12f7b3e
%make_build -C docs html man SPHINXBUILD=sphinx-build-%{python3_version}
fdc8cf2
rm docs/_build/html/.buildinfo
fdc8cf2
c9d60b4
fdc8cf2
%install
a062b4b
%if 0%{?with_python2}
fdc8cf2
%py2_install
12f7b3e
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/process_utils/async_execute_process_asyncio
635d814
%endif
a062b4b
a062b4b
%if 0%{?with_python3}
fdc8cf2
%py3_install
635d814
%endif
fdc8cf2
fdc8cf2
install -p -m0644 -D docs/_build/man/%{srcname}.1 %{buildroot}%{_mandir}/man1/%{srcname}.1
fdc8cf2
c9d60b4
fdc8cf2
%check
a062b4b
%if 0%{?with_python2}
a062b4b
PYTHONASYNCIODEBUG=1 %{__python2} -m nose tests -e test_code_format
635d814
%endif
a062b4b
a062b4b
%if 0%{?with_python3}
a062b4b
PYTHONASYNCIODEBUG=1 %{__python3} -m nose tests -e test_code_format
635d814
%endif
fdc8cf2
12f7b3e
fdc8cf2
%files doc
fdc8cf2
%license LICENSE
a062b4b
%doc docs/_build/html
fdc8cf2
a062b4b
%if 0%{?with_python2}
fdc8cf2
%files -n python2-%{pkgname}
fdc8cf2
%license LICENSE
a062b4b
%doc CHANGELOG.rst README.md
fdc8cf2
%{python2_sitelib}/%{srcname}/
a062b4b
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info/
a062b4b
%{_mandir}/man1/%{srcname}.1.gz
635d814
%endif
fdc8cf2
a062b4b
%if 0%{?with_python3}
a062b4b
%files -n python%{python3_pkgversion}-%{pkgname}
fdc8cf2
%license LICENSE
a062b4b
%doc CHANGELOG.rst README.md
fdc8cf2
%{python3_sitelib}/%{srcname}/
a062b4b
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/
a062b4b
%{_mandir}/man1/%{srcname}.1.gz
635d814
%endif
fdc8cf2
12f7b3e
fdc8cf2
%changelog
60cf00c
* Thu Feb 04 2021 Scott K Logan <logans@cottsay.net> - 0.2.1-1
60cf00c
- Update to 0.2.1 (rhbz#1905288)
60cf00c
635d814
* Fri May 08 2020 Scott K Logan <logans@cottsay.net> - 0.1.10-1
635d814
- Update to 0.1.10 (rhbz#1833518)
635d814
4586c34
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.9-2
4586c34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
4586c34
19d3672
* Wed Oct 30 2019 Scott K Logan <logans@cottsay.net> - 0.1.9-1
19d3672
- Update to 0.1.9 (rhbz#1762208)
19d3672
c9d60b4
* Mon Sep 30 2019 Scott K Logan <logans@cottsay.net> - 0.1.8-1
c9d60b4
- Update to 0.1.8 (rhbz#1753048)
c9d60b4
7908f26
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.1.7-3
7908f26
- Rebuilt for Python 3.8
7908f26
2fbc97f
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.7-2
2fbc97f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
2fbc97f
12f7b3e
* Fri Apr 12 2019 Scott K Logan <logans@cottsay.net> - 0.1.7-1
12f7b3e
- Update to 0.1.7
12f7b3e
- Use Python 3 Sphinx
12f7b3e
a8c6011
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.6-3
a8c6011
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
a8c6011
a062b4b
* Tue Jan 15 2019 Scott K Logan <logans@cottsay.net> - 0.1.6-2
a062b4b
- Remove Python 2 subpackage from f30+ (rhbz#1666189)
a062b4b
76dab3b
* Thu Nov 15 2018 Scott K Logan <logans@cottsay.net> - 0.1.6-1
76dab3b
- Update to 0.1.6
76dab3b
76dab3b
* Fri Sep 14 2018 Scott K Logan <logans@cottsay.net> - 0.1.5-1
052d577
- Update to 0.1.5 (rhbz#1593273)
052d577
903347e
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-3
903347e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
903347e
f649e08
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.1.4-2
f649e08
- Rebuilt for Python 3.7
f649e08
7b1ab1e
* Sun May 27 2018 Rich Mates <richmattes@gmail.com> - 0.1.4-1
7b1ab1e
- Update to release 0.1.4 (rhbz#1459873)
7b1ab1e
- Remove upstream flake8 compatibility patch (rhbz#1377139)
7b1ab1e
cced2f9
* Mon Mar 26 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.1.2-7
cced2f9
- Update Python 2 dependency declarations to new packaging standards
cced2f9
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
cced2f9
6c0de0d
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-6
6c0de0d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
6c0de0d
8824037
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-5
8824037
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
8824037
97947f9
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-4
97947f9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
97947f9
c93afea
* Wed Dec 21 2016 Rich Mattes <richmattes@gmail.com> - 0.1.2-3
c93afea
- Fix FTBFS by adding upstream patch to use flake8 command line (rhbz#1377139)
c93afea
- Use 'python3-flake8' for python 3 tests
c93afea
c920490
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.1.2-3
c920490
- Rebuild for Python 3.6
c920490
531f629
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.2-2
531f629
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
531f629
fdc8cf2
* Mon Apr 18 2016 Scott K Logan <logans@cottsay.net> - 0.1.2-1
fdc8cf2
- Initial package