]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
ceph-deploy.spec: add support for python3
authorKefu Chai <kchai@redhat.com>
Thu, 1 Oct 2020 08:44:24 +0000 (16:44 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 1 Oct 2020 10:55:05 +0000 (18:55 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
ceph-deploy.spec

index 686613d57c27b40a02a7394c78d523404d71dcd7..23736db7f0de35395f3d341f4c9f71a1533ca0a4 100644 (file)
@@ -2,16 +2,23 @@
 # spec file for package ceph-deploy
 #
 
-%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
+%if 0%{?rhel} >= 8 || 0%{?suse_version} >= 1500
+%bcond_with python2
+%bcond_without python3
+%else
+%bcond_without python2
+%bcond_with python3
 %endif
 
+# Exclude ceph-deploy from the rpmbuild shebang check to allow it to run
+# under Python 2 and 3.
+%global __brp_mangle_shebangs_exclude_from ceph-deploy
+
 #################################################################################
 # common
 #################################################################################
 Name:           ceph-deploy
-Version:       2.0.1
+Version:       2.0.2
 Release:        0
 Summary:        Admin and deploy tool for Ceph
 License:        MIT
@@ -19,24 +26,52 @@ Group:          System/Filesystems
 URL:            http://ceph.com/
 Source0:        %{name}-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-BuildRequires:  python-devel
-BuildRequires:  python-setuptools
-BuildRequires:  python-virtualenv
-BuildRequires:  python-mock
+%if %{with python2}
+BuildRequires:  python2-devel
+BuildRequires:  python2-setuptools
+BuildRequires:  python2-virtualenv
+BuildRequires:  python2-mock
 BuildRequires:  python-tox
+BuildRequires:  git
 %if 0%{?suse_version}
 BuildRequires:  python-pytest
 %else
 BuildRequires:  pytest
 %endif
-BuildRequires:  git
-Requires:       python-argparse
-Requires:       python-configparser
-Requires:       python-remoto
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
+%endif
+%if %{with python3}
+BuildRequires:  python%{python3_pkgversion}-devel
+BuildRequires:  python%{python3_pkgversion}-setuptools
+BuildRequires:  python%{python3_pkgversion}-virtualenv
+BuildRequires:  python%{python3_pkgversion}-mock
+BuildRequires:  python%{python3_pkgversion}-tox
+BuildRequires:  python%{python3_pkgversion}-pytest
+%endif
 BuildArch:      noarch
+%description
+An easy to use admin tool for deploy ceph storage clusters.
+
+
+%if %{with python2}
+%package -n python2-%{name}
+Summary:        %{summary}
+Requires:       python2-argparse
+Requires:       python2-configparser
+Requires:       python2-remoto
+%{?python_provide:%python_provide python2-%{name}}
+Provides:       ceph-deploy
+%description -n python2-%{name}
+An easy to use admin tool for deploy ceph storage clusters.
+%endif
+
+%if %{with python3}
+%package -n python%{python3_pkgversion}-%{name}
+Summary:        %{summary}
+Requires:       python%{python3_pkgversion}-remoto
+%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
+Conflicts:      ceph-deploy < 2.1.0
+%description -n python%{python3_pkgversion}-%{name}
+An easy to use admin tool for deploy ceph storage clusters.
 %endif
 
 #################################################################################
@@ -46,27 +81,49 @@ BuildArch:      noarch
 %py_requires
 %endif
 
-%description
-An easy to use admin tool for deploy ceph storage clusters.
-
 %prep
 #%%setup -q -n %%{name}
 %setup -q
 
 %build
-#python setup.py build
+# %{?with_python2:%py2_build}
+# %{?with_python3:%py3_build}
 
 %install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
-install -m 0755 -D scripts/ceph-deploy $RPM_BUILD_ROOT/usr/bin
+%if %{with python2}
+%py2_install
+mv %{buildroot}%{_bindir}/ceph-deploy %{buildroot}%{_bindir}/ceph-deploy-%{python2_version}
+ln -s ./ceph-deploy-%{python2_version} %{buildroot}%{_bindir}/ceph-deploy-2
+ln -s ./ceph-deploy-2 %{buildroot}%{_bindir}/ceph-deploy
+%endif
+%if %{with python3}
+%py3_install
+mv %{buildroot}%{_bindir}/ceph-deploy %{buildroot}%{_bindir}/ceph-deploy-%{python3_version}
+ln -s ./ceph-deploy-%{python3_version} %{buildroot}%{_bindir}/ceph-deploy-3
+%endif
 
 %clean
 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
 
-%files
+%if %{with python2}
+%files -n python2-%{name}
 %defattr(-,root,root)
-%doc LICENSE README.rst
+%license LICENSE
+%doc README.rst
+%{python2_sitelib}/*
 %{_bindir}/ceph-deploy
-%{python_sitelib}/*
+%{_bindir}/ceph-deploy-2
+%{_bindir}/ceph-deploy-%{python2_version}
+%endif
+
+%if %{with python3}
+%files -n python3-%{name}
+%defattr(-,root,root)
+%license LICENSE
+%doc README.rst
+%{python3_sitelib}/*
+%{_bindir}/ceph-deploy-3
+%{_bindir}/ceph-deploy-%{python3_version}
+%endif
 
 %changelog