Blob Blame History Raw
%{?!_without_python2:%global with_python2 0%{?_with_python2:1} || !(0%{?rhel} >= 8 || 0%{?fedora} >= 31)}
%{?!_without_python3:%global with_python3 0%{?_with_python3:1} || !0%{?rhel} || 0%{?rhel} >= 7}
%{?!_without_tests:%global with_tests 0%{?_with_tests:1} || !0%{?rhel}}

%global srcname jenkins

Name:           python-%{srcname}
Version:        1.6.0
Release:        1%{?dist}
Summary:        Python bindings for the remote Jenkins API

License:        BSD
URL:            https://python-jenkins.readthedocs.org/en/latest
Source0:        https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz

BuildRequires:  %{_bindir}/sphinx-build
BuildArch:      noarch

%description
Python Jenkins is a library for the remote API of the Jenkins continuous
integration server. It is useful for creating and managing jobs as well as
build nodes.


%if 0%{?with_python2}
%package -n python2-%{srcname}
Summary:        %{summary}
BuildRequires:  python2-devel
BuildRequires:  python-kerberos
BuildRequires:  python2-mock
BuildRequires:  python2-multi_key_dict
BuildRequires:  python-nose
BuildRequires:  python2-pbr >= 0.8.2
BuildRequires:  python2-requests
BuildRequires:  python2-requests-mock
BuildRequires:  python2-six >= 1.3.0
BuildRequires:  python-testscenarios
BuildRequires:  python-testtools

%if %{undefined __pythondist_requires}
Requires:       python2-multi_key_dict
Requires:       python-pbr >= 0.8.2
Requires:       python2-requests
Requires:       python-six >= 1.3.0
%endif # __pythondist_requires

%if 0%{?!rhel} || 0%{?rhel} >= 8
Recommends:     python-kerberos
%endif # !rhel || rhel >= 8

%description -n python2-%{srcname}
Python Jenkins is a library for the remote API of the Jenkins continuous
integration server. It is useful for creating and managing jobs as well as
build nodes.
%endif # with_python2


%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{summary}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-multi_key_dict
BuildRequires:  python%{python3_pkgversion}-pbr >= 0.8.2
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-six >= 1.3.0
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

%if 0%{?with_tests}
BuildRequires:  python%{python3_pkgversion}-kerberos
BuildRequires:  python%{python3_pkgversion}-mock
BuildRequires:  python%{python3_pkgversion}-nose
BuildRequires:  python%{python3_pkgversion}-requests
BuildRequires:  python%{python3_pkgversion}-requests-mock
BuildRequires:  python%{python3_pkgversion}-testscenarios
BuildRequires:  python%{python3_pkgversion}-testtools
%endif # with_tests

%if %{undefined __pythondist_requires}
Requires:       python%{python3_pkgversion}-multi_key_dict
Requires:       python%{python3_pkgversion}-pbr >= 0.8.2
Requires:       python%{python3_pkgversion}-requests
Requires:       python%{python3_pkgversion}-six >= 1.3.0
%endif # __pythondist_requires

%if 0%{?!rhel} || 0%{?rhel} >= 8
Recommends:     python%{python3_pkgversion}-kerberos
%endif # !rhel || rhel >= 8

%description -n python%{python3_pkgversion}-%{srcname}
Python Jenkins is a library for the remote API of the Jenkins continuous
integration server. It is useful for creating and managing jobs as well as
build nodes.
%endif # with_python3


%prep
%autosetup -p1

# Remove env from __init__.py
sed -i '1{s|^#!/usr/bin/env python||}' jenkins/__init__.py


%build
export PBR_VERSION=%{version}

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

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

PYTHONDONTWRITEBYTECODE=1 \
  PYTHONPATH=$PWD \
  %make_build -C doc html man
rm doc/build/html/.buildinfo


%install
%if 0%{?with_python2}
%py2_install
install -p -D -m0644 doc/build/man/pythonjenkins.1 %{buildroot}%{_mandir}/man1/pythonjenkins.1
%endif

%if 0%{?with_python3}
%py3_install
install -p -D -m0644 doc/build/man/pythonjenkins.1 %{buildroot}%{_mandir}/man1/python3jenkins.1
%endif # with_python3


%check
%if 0%{?with_python2}
%{__python2} -m testtools.run discover tests
%endif # with_python2

%if 0%{?with_tests}
%if 0%{?with_python3}
%{__python3} -m testtools.run discover tests
%endif # with_python3
%endif # with_tests


%if 0%{?with_python2}
%files -n python2-%{srcname}
%doc AUTHORS ChangeLog README.rst doc/build/html
%license COPYING
%{python2_sitelib}/%{srcname}/
%{python2_sitelib}/python_jenkins-%{version}-py%{python2_version}.egg-info/
%{_mandir}/man1/pythonjenkins.1.*
%endif # with_python2

%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%doc AUTHORS ChangeLog README.rst doc/build/html
%license COPYING
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/python_jenkins-%{version}-py%{python3_version}.egg-info/
%{_mandir}/man1/python3jenkins.1.*
%endif # with_python3


%changelog
* Sun Feb 16 2020 Scott K Logan <logans@cottsay.net> - 1.6.0-1
- Update to 1.6.0

* Sun Feb 16 2020 Scott K Logan <logans@cottsay.net> - 0.4.16-1
- Update to 0.4.16
- Add weak dependency on python-kerberos
- Align spec file between Fedora and EPEL
- Use a subpackage for python 2 on EPEL
- Enable python 3 subpackage for EPEL
- Handle automatic dependency generation (f30+)

* Sun May 21 2017 Scott K Logan <logans@cottsay.net> - 0.4.14-2
- Work around nose on Fedora as well (LP: #872887)

* Sat May 13 2017 Ken Dreyer <ktdreyer@ktdreyer.com> 0.4.14-1
- Update to 0.4.14 (rhbz#1267414)
- Use HTTPS homepage URL
- New Source0 PyPI URL
- Avoid nose on el7 (LP: #872887)
- BR: python-kerberos to make the tests get a bit further

* Tue Aug 25 2015 Scott K Logan <logans@cottsay.net> - 0.4.8-1
- Update to 0.4.8

* Tue Jun 30 2015 Scott K Logan <logans@cottsay.net> - 0.4.7-1
- Update to 0.4.7

* Sun Apr 12 2015 Scott K Logan <logans@cottsay.net> - 0.4.5-1
- Update to 0.4.5
- Update to latest python packaging guidelines

* Wed Nov 12 2014 Scott K Logan <logans@cottsay.net> - 0.4.1-1
- Update to 0.4.1 (RHBZ #1162743)
- Switch to PyPI upstream
- Add python3 package

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

* Fri Feb 21 2014 Scott K Logan <logans@cottsay.net> - 0.2.1-1
- Initial package