Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 68 additions & 49 deletions python-openshift.spec
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
%global with_python3 0
%if 0%{?rhel} == 7
%bcond_with python3
%bcond_without python2
%else
%bcond_with python2
%bcond_without python3
%endif

%global library openshift

%if 0%{?rhel} == 7

%global py3 python%{python3_pkgversion}
%else
%global py3 python3
%endif

Name: python-%{library}
Version: 0.9.0
Release: 1%{?dist}
Summary: Python client for the OpenShift API
License: MIT
License: ASL 2.0
URL: https://github.com/openshift/openshift-restclient-python
Source0: https://github.com/openshift/openshift-restclient-python/python-openshift-%{version}.tar.gz
Source0: https://github.com/openshift/openshift-restclient-python/archive/v%{version}.tar.gz
BuildArch: noarch
Epoch: 1

%if 0%{?with_python2}
%package -n python2-%{library}
Summary: Python client for the OpenShift API
%{?python_provide:%python_provide python2-%{library}}
Expand All @@ -31,53 +45,49 @@ Requires: python-jinja2

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

%if 0%{?with_python3}
%package -n python3-%{library}
%package -n %{py3}-%{library}
Summary: Python client for the OpenShift API
%if 0%{?rhel}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{library}}
%else
%{?python_provide:%python_provide python3-%{library}}
%endif

%if 0%{?rhel}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%else
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
BuildRequires: %{py3}-devel
BuildRequires: %{py3}-setuptools
BuildRequires: git

%if 0%{?rhel}
Requires: python%{python3_pkgversion}
Requires: python%{python3_pkgversion}-dictdiffer
Requires: python%{python3_pkgversion}-jinja2
Requires: python%{python3_pkgversion}-kubernetes
Requires: python%{python3_pkgversion}-string_utils
Requires: python%{python3_pkgversion}-ruamel-yaml
Requires: python%{python3_pkgversion}-six

%else
Requires: python3
Requires: python3-dictdiffer
Requires: python3-jinja2
Requires: python3-kubernetes
Requires: python3-string_utils
Requires: python3-ruamel-yaml
Requires: python3-six
%endif
Requires: %{py3}
Requires: %{py3}-dictdiffer
Requires: %{py3}-kubernetes
Requires: %{py3}-string_utils
Requires: %{py3}-requests
Requires: %{py3}-ruamel-yaml
Requires: %{py3}-six
Requires: %{py3}-jinja2

%description -n python3-%{library}
%description -n %{py3}-%{library}
Python client for the OpenShift API
%endif # with_python3

#recommonmark not available for docs in EPEL
%if 0%{?fedora}
%package doc
Summary: Documentation for %{name}.
Provides: %{name}-doc
%if 0%{?with_python3}
BuildRequires: %{py3}-sphinx
BuildRequires: %{py3}-recommonmark
%else
BuildRequires: python2-sphinx
BuildRequires: python2-recommonmark
%endif
%description doc
%{summary}
%endif

%description
Python client for the OpenShift API

%prep
%autosetup -S git
%autosetup -n openshift-restclient-python-%{version} -S git
#there is no include in RHEL7 setuptools find_packages
#the requirements are also done in an non-backwards compatible way
%if 0%{?rhel}
Expand All @@ -88,50 +98,59 @@ sed -i -e "s/extract_requirements('requirements.txt')/REQUIRES/g" setup.py
%endif

%build
%if 0%{?rhel}
%py_build
%else
%if 0%?{with_python2}
%py2_build
%endif
%if 0%{?with_python3}
%py3_build
%endif

%if 0%{?fedora}
sphinx-build doc/source/ html
%{__rm} -rf html/.buildinfo
%endif

%install
%if 0%{?rhel}
%py_install
%else
%if 0%?{with_python2}
%py2_install
%endif
%if 0%{?with_python3}
%py3_install
%endif

%check
#test dependencies are unpackaged

%if 0%?{with_python2}
%files -n python2-%{library}
%license LICENSE
%{python2_sitelib}/%{library}/*
%{python2_sitelib}/%{library}-*.egg-info
%exclude %{python2_sitelib}/scripts
%exclude /usr/requirements.txt/requirements.txt
#TODO: What about for python3?
%if %{with_python3} == 0
%{_bindir}/openshift-ansible-gen
%endif

%if 0%{?with_python3}
%files -n python3-%{library}
%files -n %{py3}-%{library}
%license LICENSE
%{python3_sitelib}/%{library}/*
%{python3_sitelib}/%{library}-*.egg-info
%exclude %{python3_sitelib}/scripts
%exclude /usr/requirements.txt/requirements.txt
%{_bindir}/openshift-ansible-gen
%endif # with_python3
%endif

%if 0%{?fedora}
%files doc
%license LICENSE
%doc html
%endif

%changelog
* Sun Jan 13 2019 Jason Montleon <jmontleo@redhat.com> 0.9.0-1
* Update to 0.9.0
* Tue Dec 4 2018 Jason Montleon <jmontleo@redhat.com> 0.9.0-1
- Bump Version to 0.9.0
- Disable python 2 and enable python 3 builds for Fedora

* Tue Nov 06 2018 Jason Montleon <jmontleo@redhat.com> 0.8.0-1
- Fix tag condition (fabian@fabianism.us)
Expand Down