Skip to content

Commit eba043e

Browse files
jmontleonfabianvf
authored andcommitted
RPM Spec updates
1 parent f9ff1fa commit eba043e

File tree

1 file changed

+82
-55
lines changed

1 file changed

+82
-55
lines changed

python-openshift.spec

Lines changed: 82 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1-
%global with_python3 0
1+
%if 0%{?rhel} == 7
2+
%bcond_with python3
3+
%bcond_without python2
4+
%else
5+
%bcond_with python2
6+
%bcond_without python3
7+
%endif
28

39
%global library openshift
410

11+
%if 0%{?rhel} == 7
12+
13+
%global py3 python%{python3_pkgversion}
14+
%else
15+
%global py3 python3
16+
%endif
17+
518
Name: python-%{library}
619
Version: 0.8.4
720
Release: 1%{?dist}
8-
Summary: Python client for the OpenShift API
9-
License: MIT
21+
Summary: Python client for the OpenShift API
22+
License: ASL 2.0
1023
URL: https://github.com/openshift/openshift-restclient-python
11-
Source0: https://github.com/openshift/openshift-restclient-python/python-openshift-%{version}.tar.gz
24+
Source0: https://github.com/openshift/openshift-restclient-python/archive/v%{version}.tar.gz
1225
BuildArch: noarch
1326
Epoch: 1
1427

28+
%if 0%{?with_python2}
1529
%package -n python2-%{library}
16-
Summary: Python client for the OpenShift API
30+
Summary: Python client for the OpenShift API
1731
%{?python_provide:%python_provide python2-%{library}}
1832

1933
BuildRequires: python2-devel
@@ -31,111 +45,124 @@ Requires: python-jinja2
3145

3246
%description -n python2-%{library}
3347
Python client for the kubernetes API.
34-
35-
%if 0%{?with_python3}
36-
%package -n python3-%{library}
37-
Summary: Python client for the OpenShift API
38-
%if 0%{?rhel}
39-
%{?python_provide:%python_provide python%{python3_pkgversion}-%{library}}
40-
%else
41-
%{?python_provide:%python_provide python3-%{library}}
4248
%endif
4349

44-
%if 0%{?rhel}
45-
BuildRequires: python%{python3_pkgversion}-devel
46-
BuildRequires: python%{python3_pkgversion}-setuptools
47-
%else
48-
BuildRequires: python3-devel
49-
BuildRequires: python3-setuptools
50-
%endif
50+
%if 0%{?with_python3}
51+
%package -n %{py3}-%{library}
52+
Summary: Python client for the OpenShift API
53+
BuildRequires: %{py3}-devel
54+
BuildRequires: %{py3}-setuptools
5155
BuildRequires: git
5256

53-
%if 0%{?rhel}
54-
Requires: python%{python3_pkgversion}
55-
Requires: python%{python3_pkgversion}-dictdiffer
56-
Requires: python%{python3_pkgversion}-jinja2
57-
Requires: python%{python3_pkgversion}-kubernetes
58-
Requires: python%{python3_pkgversion}-string_utils
59-
Requires: python%{python3_pkgversion}-ruamel-yaml
60-
Requires: python%{python3_pkgversion}-six
57+
Requires: %{py3}
58+
Requires: %{py3}-dictdiffer
59+
Requires: %{py3}-kubernetes
60+
Requires: %{py3}-string_utils
61+
Requires: %{py3}-requests
62+
Requires: %{py3}-ruamel-yaml
63+
Requires: %{py3}-six
64+
Requires: %{py3}-jinja2
65+
66+
%description -n %{py3}-%{library}
67+
Python client for the OpenShift API
68+
%endif # with_python3
6169

70+
#recommonmark not available for docs in EPEL
71+
%if 0%{?fedora}
72+
%package doc
73+
Summary: Documentation for %{name}.
74+
%if 0%{?with_python3}
75+
BuildRequires: %{py3}-sphinx
76+
BuildRequires: %{py3}-recommonmark
6277
%else
63-
Requires: python3
64-
Requires: python3-dictdiffer
65-
Requires: python3-jinja2
66-
Requires: python3-kubernetes
67-
Requires: python3-string_utils
68-
Requires: python3-ruamel-yaml
69-
Requires: python3-six
78+
BuildRequires: python2-sphinx
79+
BuildRequires: python2-recommonmark
80+
%endif
81+
%description doc
82+
%{summary}
7083
%endif
71-
72-
%description -n python3-%{library}
73-
Python client for the OpenShift API
74-
%endif # with_python3
7584

7685
%description
77-
Python client for the OpenShift API
86+
Python client for the OpenShift API
7887

7988
%prep
80-
%autosetup -S git
89+
%autosetup -n openshift-restclient-python-%{version} -S git
8190
#there is no include in RHEL7 setuptools find_packages
8291
#the requirements are also done in an non-backwards compatible way
8392
%if 0%{?rhel}
8493
sed -i -e "s/find_packages(include='openshift.*')/['openshift', 'openshift.ansiblegen', 'openshift.client', 'openshift.client.apis', 'openshift.client.models', 'openshift.config', 'openshift.docs', 'openshift.dynamic', 'openshift.helper', 'openshift.test']/g" setup.py
85-
sed -i -e '30s/^/REQUIRES = [\n "certifi",\n "ipaddress",\n "oauth2client",\n "setuptools",\n "six",\n "urllib3!=1.21",\n "python-dateutil",\n "pyyaml",\n "websocket-client",\n]\n/g' setup.py
94+
sed -i -e '30s/^/REQUIRES = [\n "dictdiffer",\n "jinja2",\n "kubernetes",\n "setuptools",\n "six",\n "ruamel.yaml",\n "python-string-utils",\n]\n/g' setup.py
8695
sed -i -e "s/extract_requirements('requirements.txt')/REQUIRES/g" setup.py
8796
#sed -i -e '14,21d' setup.py
8897
%endif
8998

9099
%build
91-
%if 0%{?rhel}
92-
%py_build
93-
%else
100+
%if 0%{?with_python2}
94101
%py2_build
95102
%endif
96103
%if 0%{?with_python3}
97104
%py3_build
98105
%endif
99106

107+
%if 0%{?fedora}
108+
sphinx-build doc/source/ html
109+
%{__rm} -rf html/.buildinfo
110+
%{__rm} -rf html/.doctrees
111+
%endif
112+
100113
%install
101-
%if 0%{?rhel}
102-
%py_install
103-
%else
114+
%if 0%{?with_python2}
104115
%py2_install
105116
%endif
106117
%if 0%{?with_python3}
107118
%py3_install
108119
%endif
109120

110121
%check
122+
#test dependencies are unpackaged
111123

124+
%if 0%{?with_python2}
112125
%files -n python2-%{library}
113126
%license LICENSE
114127
%{python2_sitelib}/%{library}/*
115128
%{python2_sitelib}/%{library}-*.egg-info
116129
%exclude %{python2_sitelib}/scripts
117130
%exclude /usr/requirements.txt/requirements.txt
118131
%exclude /usr/custom_objects_spec.json/custom_objects_spec.json
119-
#TODO: What about for python3?
120-
%if %{with_python3} == 0
121132
%{_bindir}/openshift-ansible-gen
122133
%endif
123134

124135
%if 0%{?with_python3}
125-
%files -n python3-%{library}
136+
%files -n %{py3}-%{library}
126137
%license LICENSE
127138
%{python3_sitelib}/%{library}/*
128139
%{python3_sitelib}/%{library}-*.egg-info
129140
%exclude %{python3_sitelib}/scripts
141+
%exclude /usr/requirements.txt/requirements.txt
142+
%exclude /usr/custom_objects_spec.json/custom_objects_spec.json
130143
%{_bindir}/openshift-ansible-gen
131-
%endif # with_python3
144+
%endif
145+
146+
%if 0%{?fedora}
147+
%files doc
148+
%license LICENSE
149+
%doc html
150+
%endif
132151

133152
%changelog
153+
* Thu Dec 20 2018 Daniel Mellado <[email protected]> 0.8.1-2
154+
- Ensure .doctrees directory is also cleaned up
155+
- Remove unnecessary provides name setting
156+
134157
* Tue Nov 06 2018 Jason Montleon <[email protected]> 0.8.1-1
135158
- Bump version ([email protected])
136159
- [release-0.8] When searching for resources, prefer non-List matches (#232)
137160
138161
- Version + dependency bump ([email protected])
162+
- Disable python2 builds for Fedora and python3 for EPEL by default
163+
164+
* Tue Nov 06 2018 Jason Montleon <[email protected]> 0.8.0-1
165+
- Fix tag condition ([email protected])
139166
- Add watch to dynamic client (#221) ([email protected])
140167
- Pin flake8 ([email protected])
141168
- Do not decode response data in Python2 (#225)
@@ -244,7 +271,7 @@ sed -i -e "s/extract_requirements('requirements.txt')/REQUIRES/g" setup.py
244271
245272

246273
* Fri Nov 03 2017 Jason Montleon <[email protected]> 0.3.4-2
247-
- Update version
274+
- Update version
248275

249276
* Fri Nov 03 2017 Jason Montleon <[email protected]> 0.3.3-8
250277
- Bug 1508969 - Add foreground propagation policy ([email protected])
@@ -267,13 +294,13 @@ sed -i -e "s/extract_requirements('requirements.txt')/REQUIRES/g" setup.py
267294
- ignore requirements.txt in packaging
268295

269296
* Fri Oct 06 2017 Jason Montleon <[email protected]> 0.3.2-4
270-
-
297+
-
271298

272299
* Fri Oct 06 2017 Jason Montleon <[email protected]> 0.3.2-3
273300
- make source name match package name
274301

275302
* Fri Oct 06 2017 Jason Montleon <[email protected]> 0.3.2-2
276-
- Fix source name
303+
- Fix source name
277304

278305
* Fri Oct 06 2017 Jason Montleon <[email protected]> 0.3.2-1
279306
- new package built with tito

0 commit comments

Comments
 (0)