2121%{!?__python3: %global __python3 python3}
2222%{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}
2323
24+ %if ! 0%{?rhel} >= 8 && ! 0%{?suse_version} > 1550
25+ %define py2 1
26+ %endif
27+
2428%global srcname ClusterShell
2529
2630Name: clustershell
@@ -29,31 +33,36 @@ Release: 1%{?dist}
2933Summary: Python framework for efficient cluster administration
3034
3135%if 0%{?suse_version}
32- License: LGPL-2.1
36+ License: LGPL-2.1-or-later
3337%else
3438License: LGPLv2+
3539%endif
3640%if 0%{?suse_version}
3741Group: Productivity/Clustering/Computing
38- %else if 0%{?rhel}
42+ %else
43+ %if 0%{?rhel}
3944Group: System Environment/Base
4045%endif
46+ %endif
4147URL: http://cea-hpc.github.io/clustershell/
4248Source0: https://files.pythonhosted.org/packages/source/C/%{srcname}/%{srcname}-%{version}.tar.gz
4349BuildArch: noarch
44- %if 0%{?rhel} >= 8
45- Requires: python3-%{name} = %{version}-%{release}
46- %else
50+ %if 0%{?py2}
4751Requires: python2-%{name} = %{version}-%{release}
52+ %else
53+ Requires: python3-%{name} = %{version}-%{release}
4854%endif
4955%if 0%{?rhel} >= 7 || 0%{?fedora}
5056Requires: vim-filesystem
51- %else if 0%{?suse_version}
57+ %else
58+ %if 0%{?suse_version}
5259Requires: vim
60+ BuildRequires: fdupes
5361BuildRequires: vim
5462%else
5563Requires: vim-common
5664%endif
65+ %endif
5766Provides: vim-clustershell = %{version}-%{release}
5867Obsoletes: vim-clustershell < 1.7.81-4
5968
@@ -66,7 +75,7 @@ server farms. Command line utilities like clush, clubak and nodeset (or
6675cluset) allow traditional shell scripts to take benefit of the features
6776offered by the library.
6877
69- %if 0%{?rhel} < 8
78+ %if 0%{?py2}
7079%package -n python2-%{name}
7180Summary: ClusterShell module for Python 2
7281BuildRequires: %{python2_pkgprefix}-devel
@@ -89,6 +98,7 @@ BuildRequires: %{python3_pkgprefix}-devel
8998BuildRequires: %{python3_pkgprefix}-setuptools
9099Requires: %{python3_pkgprefix}-PyYAML
91100Requires: %{python3_pkgprefix}-setuptools
101+ %{!?py2:Obsoletes: python2-%{name}}
92102%{?python_provide:%python_provide %{python3_pkgprefix}-%{srcname}}
93103
94104%description -n %{python3_pkgprefix}-%{name}
@@ -100,12 +110,12 @@ ClusterShell Python 3 module and related command line tools.
100110
101111%build
102112%{__python3} setup.py build
103- %{__python2} setup.py build
113+ %{?py2:%{ __python2} setup.py build}
104114
105115%install
106116%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
107117
108- %if 0%{?rhel} < 8
118+ %if 0%{?py2}
109119pushd %{buildroot}%{_bindir}
110120for i in clubak cluset clush nodeset; do
111121 mv $i $i-%{python3_shortver}
@@ -144,14 +154,15 @@ install -d %{buildroot}/%{vimdatadir}/{ftdetect,syntax}
144154install -p -m 0644 doc/extras/vim/ftdetect/clustershell.vim %{buildroot}/%{vimdatadir}/ftdetect/
145155install -p -m 0644 doc/extras/vim/syntax/clushconf.vim %{buildroot}/%{vimdatadir}/syntax/
146156install -p -m 0644 doc/extras/vim/syntax/groupsconf.vim %{buildroot}/%{vimdatadir}/syntax/
157+ %{?suse_version:%fdupes %{buildroot}}
147158
148159%if 0%{?rhel}
149160%clean
150161rm -rf %{buildroot}
151162%endif
152163
153164# Unversioned python3 for rhel8
154- %if 0%{?rhel} < 8
165+ %if 0%{?py2}
155166%files -n python2-%{name}
156167%if 0%{?rhel}
157168%defattr(-,root,root,-)
@@ -192,7 +203,12 @@ rm -rf %{buildroot}
192203%if 0%{?rhel}
193204%defattr(-,root,root,-)
194205%endif
195- %doc ChangeLog COPYING.LGPLv2.1 README.md
206+ %doc ChangeLog README.md
207+ %if 0%{?suse_version} >= 1500
208+ %license COPYING.LGPLv2.1
209+ %else
210+ %doc COPYING.LGPLv2.1
211+ %endif
196212%doc doc/examples
197213%doc doc/sphinx
198214%{_mandir}/man1/clubak.1*
0 commit comments