Blob Blame History Raw

# Python3 support in OpenStack starts with version 3.5,
# which is only in Fedora 24+
%if 0%{?fedora} >= 24 || 0%{?rhel} > 7
%bcond_with    python2
%bcond_without python3
%else
%bcond_without python2
%bcond_with    python3
%endif

%global base_commit 07ef6263685802ee5a8532662bf589adaa07b592

%global library kubernetes

Name:       python-%{library}
Version:    7.0.0
Release:    1%{?dist}
Summary:    Python client for the kubernetes API.
License:    ASL 2.0
URL:        https://pypi.python.org/pypi/kubernetes

Source0:    https://github.com/kubernetes-incubator/client-python/archive/v7.0.0.tar.gz
Source1:    https://github.com/kubernetes-client/python-base/archive/%{base_commit}.tar.gz

BuildArch:  noarch

%description
Python client for the kubernetes API.

%if %{with python2}
%package -n python2-%{library}
Summary:    Kubernetes Python Client
%{?python_provide:%python_provide python2-%{library}}

BuildRequires:  git
BuildRequires:  python2-adal
BuildRequires:  python2-devel
BuildRequires:  python2-nose
BuildRequires:  python2-py
BuildRequires:  python2-mock
BuildRequires:  python2-certifi
BuildRequires:  python2-six
BuildRequires:  python2-dateutil
BuildRequires:  python2-requests
BuildRequires:  python2-setuptools
BuildRequires:  python2-urllib3
BuildRequires:  python2-google-auth
BuildRequires:  python2-oauthlib
BuildRequires:  python2-requests-oauthlib
BuildRequires:  PyYAML
%if 0%{?fedora} > 0
BuildRequires:  python2-ipaddress
BuildRequires:  python2-websocket-client
%else
BuildRequires:  python-ipaddress
BuildRequires:  python-websocket-client
%endif

Requires:  python2-adal
Requires:  python2-certifi
Requires:  python2-six
Requires:  python2-dateutil
Requires:  python2-setuptools
Requires:  python2-urllib3
Requires:  python2-google-auth
Requires:  python2-requests
Requires:  python2-requests-oauthlib
Requires:  PyYAML
%if 0%{?fedora} > 0
Requires:  python2-ipaddress
Requires:  python2-websocket-client
%else
Requires:  python-ipaddress
Requires:  python-websocket-client
%endif

%description -n python2-%{library}
Python client for the kubernetes API.


%package -n python2-%{library}-tests
Summary:    Tests python-kubernetes library

Requires:  python2-nose
Requires:  python2-py
Requires:  python2-mock
Requires:  python2-%{library} = %{version}-%{release}


%description -n python2-%{library}-tests
Tests python-kubernetes library
%endif

%if 0%{?with_python3}
%package -n python3-%{library}
Summary:    Kubernetes Python Client
%{?python_provide:%python_provide python3-%{library}}

BuildRequires:  python3-adal
BuildRequires:  python3-devel
BuildRequires:  python3-nose
BuildRequires:  python3-py
BuildRequires:  python3-mock
BuildRequires:  python3-certifi
BuildRequires:  python3-six
BuildRequires:  python3-dateutil
BuildRequires:  python3-requests
BuildRequires:  python3-setuptools 
BuildRequires:  python3-urllib3
BuildRequires:  python3-PyYAML
BuildRequires:  python3-google-auth
BuildRequires:  python3-oauthlib
BuildRequires:  python3-requests-oauthlib
BuildRequires:  python3-websocket-client

Requires:  python3-adal
Requires:  python3-certifi
Requires:  python3-six
Requires:  python3-dateutil
Requires:  python3-setuptools 
Requires:  python3-urllib3
Requires:  python3-PyYAML
Requires:  python3-google-auth
Requires:  python3-websocket-client
Requires:  python3-requests
Requires:  python3-requests-oauthlib

%description -n python3-%{library}
Python client for the kubernetes API.


%package -n python3-%{library}-tests
Summary:    Tests python-kubernetes library

Requires:  python3-nose
Requires:  python3-py
Requires:  python3-mock
Requires:  python3-%{library} = %{version}-%{release}


%description -n python3-%{library}-tests
Tests python-kubernetes library


%endif # with_python3

%prep
%autosetup -n python-7.0.0 -S git

pushd kubernetes
rm -rf base
tar zxvf %{SOURCE1}
mv python-base-%{base_commit} base
popd

%build
%if %{with python2}
%py2_build
%endif
%if 0%{?with_python3}
%py3_build
%endif

# Currently recommonmark requires an old version of commonmark,
# commonmark (<=0.5.4) wich doesn't exist in fedora rawhide so
# we disable docs generation until recommonmark is fixed to be
# compatible with recent version.
# generate html docs
#%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
#rm -rf html/.{doctrees,buildinfo}

%install
%if %{with python2}
%py2_install
cp -pr kubernetes/test %{buildroot}%{python2_sitelib}/%{library}/
cp -pr kubernetes/e2e_test %{buildroot}%{python2_sitelib}/%{library}/
%endif
%if 0%{?with_python3}
%py3_install
cp -pr kubernetes/test %{buildroot}%{python3_sitelib}/%{library}/
cp -pr kubernetes/e2e_test %{buildroot}%{python3_sitelib}/%{library}/
%endif

%check
# Unit tests fail sometimes because they are leaking thread pools so we are
# ignoring results when buildind (https://github.com/kubernetes-client/python/issues/566)
%if 0%{?with_python3}
/usr/bin/nosetests-3 --cover-package=kubernetes.config,kubernetes.watch --cover-tests || true
%endif
%if %{with python2}
/usr/bin/nosetests --cover-package=kubernetes.config,kubernetes.watch --cover-tests || true
%endif

%if %{with python2}
%files -n python2-%{library}
%license LICENSE
%doc README.md
%{python2_sitelib}/%{library}
%{python2_sitelib}/%{library}-*.egg-info
%exclude %{python2_sitelib}/%{library}/test
%exclude %{python2_sitelib}/%{library}/e2e_test

%files -n python2-%{library}-tests
%license LICENSE
%{python2_sitelib}/%{library}/test
%{python2_sitelib}/%{library}/e2e_test
%endif

%if 0%{?with_python3}
%files -n python3-%{library}
%license LICENSE
%doc README.md
%{python3_sitelib}/%{library}
%{python3_sitelib}/%{library}-*.egg-info
%exclude %{python3_sitelib}/%{library}/test
%exclude %{python3_sitelib}/%{library}/e2e_test

%files -n python3-%{library}-tests
%license LICENSE
%{python3_sitelib}/%{library}/test
%{python3_sitelib}/%{library}/e2e_test
%endif # with_python3

%changelog
* Tue Nov 20 2018 Alfredo Moralejo <amoralej@redhat.com> - 7.0.0-1
- Update to 7.0.0

* Thu Oct 4 2018 Alfredo Moralejo <amoralej@redhat.com> - 7.0.0-0.2
- Remove python2 subpackages (rhbz#1627445)

* Tue Jul 17 2018 Alfredo Moralejo <amoralej@redhat.com> - 7.0.0-0.1
- Update version-release to Fedora recomendation for pre-releases.

* Tue Jul 17 2018 Alfredo Moralejo <mhroncok@redhat.com> - 7.0.0~a1-1
- Bump to v7.0.0a1.
- It includes support for python 3.7.

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 5.0.0-2
- Rebuilt for Python 3.7

* Fri May 04 2018 Alfredo Moralejo <amoralej@redhat.com> 5.0.0-1
- Update to 5.0.0

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jan 31 2018 Jason Montleon <jmontleo@redhat.com> 4.0.0-1
- Update to 4.0.0

* Fri Oct 13 2017 Jason Montleon <jmontleo@redhat.com> 3.0.0-1
- Update to 3.0.0

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon May 22 2017 Alfredo Moralejo <amoralej@redhat.com> 2.0.0-1
- Update to version 2.0.0

* Tue Feb 28 2017 Alfredo Moralejo <amoralej@redhat.com> 1.0.0-0.3.0b3
- Remove BRs for documentation building as it's not creating html docs.

* Mon Feb 27 2017 Alfredo Moralejo <amoralej@redhat.com> 1.0.0-0.2.0b3
- Fixed %files section of python3-kubernetes-tests to contain python3 tests.

* Mon Feb 27 2017 Alfredo Moralejo <amoralej@redhat.com> 1.0.0-0.1.0b3
- Initial spec for release 1.0.0b3