[X2Go-Commits] [python-x2go] 02/02: python-x2go.spec: correctly pythonize package, for Fedora, RHEL/EPEL and OpenSuSE.

git-admin at x2go.org git-admin at x2go.org
Sat Jun 2 00:52:35 CEST 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit ba085225177ccc0dd44e5fd3055d17a04e9c6ea7
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Jun 2 00:42:13 2018 +0200

    python-x2go.spec: correctly pythonize package, for Fedora, RHEL/EPEL and OpenSuSE.
    
    It's more verbose than needs to be, but OpenSuSE Leap 42.2 - which is
    still supported currently - does not have python-rpm-macros and we
    generally want to disable the Python 3 package for now.
    
    For EPEL/RHEL versions lower than 8, we strip Python 3 stuff out
    completely and rename the package to python-x2go.
---
 debian/changelog |   6 ++
 python-x2go.spec | 170 +++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 132 insertions(+), 44 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 11620de..5d9bc20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,12 @@ python-x2go (0.5.99.1-0x2go1) UNRELEASED; urgency=medium
   * New upstream version (0.5.99.0):
   * python-x2go.spec:
     - Also add fdupes package as a build dependency for RHEL-based distros.
+    - Correctly pythonize package, for Fedora, RHEL/EPEL and OpenSuSE. It's
+      more verbose than needs to be, but OpenSuSE Leap 42.2 - which is still
+      supported currently - does not have python-rpm-macros and we generally
+      want to disable the Python 3 package for now. For EPEL/RHEL versions
+      lower than 8, we strip Python 3 stuff out completely and rename the
+      package to python-x2go.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 22 Sep 2017 14:15:05 +0200
 
diff --git a/python-x2go.spec b/python-x2go.spec
index caae032..24941cc 100644
--- a/python-x2go.spec
+++ b/python-x2go.spec
@@ -1,6 +1,11 @@
-#if 0%{?fedora}
-#global with_python3 1
-#endif
+# Add conditional and disable by default.
+%bcond_with     python3
+
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%else
+%{?!python_module:%define python_module() python-%{**}}
+%endif
 
 Name:           python-x2go
 Version:        0.5.99.1
@@ -17,30 +22,32 @@ URL:            http://www.x2go.org/
 Source0:        http://code.x2go.org/releases/source/%{name}/%{name}-%{version}.tar.gz
 
 BuildArch:      noarch
-%if 0%{?suse_version}
+# OpenSuSE Leap or SLE and either OpenSuSE Leap 42.2 or lower               or        SLE
+%if 0%{?sle_version} && ( ( 0%{?sle_version} < 120300 && 0%{?is_opensuse} ) || ( ! 0%{?is_opensuse} ) )
 BuildRequires:  python-devel
 %else
 BuildRequires:  python2-devel
 %endif
-BuildRequires:  fdupes
-BuildRequires:  python-future
-BuildRequires:  python-setuptools
-%if 0%{?with_python3}
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
 BuildRequires:  python3-devel
-BuildRequires:  python3-future
-%endif # if with_python3
+%endif
+%if 0%{?sle_version} && 0%{?sle_version} >= 120300 && 0%{?is_opensuse}
+BuildRequires:  python-rpm-macros
+%endif
+BuildRequires:  fdupes
+BuildRequires:  %{python_module setuptools}
 # For doc build
 %if 0%{?suse_version}
-BuildRequires:  python3-Sphinx
+BuildRequires:  %{python_module Sphinx}
 %else
-BuildRequires:  python3-sphinx
+BuildRequires:  %{python_module sphinx}
 %endif
-BuildRequires:  python3-gevent
-BuildRequires:  python3-paramiko
-BuildRequires:  python3-xlib
-BuildRequires:  python3-requests
-BuildRequires:  python3-simplejson
-Requires:       nxproxy
+BuildRequires:  %{python_module future}
+BuildRequires:  %{python_module gevent}
+BuildRequires:  %{python_module paramiko}
+BuildRequires:  %{python_module xlib}
+BuildRequires:  %{python_module requests}
+BuildRequires:  %{python_module simplejson}
 
 %description
 X2Go is a server based computing environment with:
@@ -59,20 +66,47 @@ Python applications by providing a Python-based X2Go client API.
 Summary:        Python X2Go client API documentation
 Group:          Documentation
 Requires:       %{name} = %{version}-%{release}
+
+%description    doc
+This package contains the Python X2Go client API documentation.
+
+# Let's assume that RHEL/EPEL 8 finally introduce proper Python 3 support...
+%if 0%{?rhel} && 0%{?rhel} < 8
+%package -n python2-x2go
+%else
+%package -n python-x2go
+%endif
+Summary:        %{summary}
+Group:          Development/Languages
 Requires:       python-gevent
 Requires:       python-paramiko >= 1.15.1
 Requires:       python-xlib
 Requires:       python-requests
 Requires:       python-simplejson
 Requires:       python-future
+Requires:       nxproxy
+%{?python_provide:%python_provide python2-x2go}
 
-%description    doc
-This package contains the Python X2Go client API documentation.
+%if 0%{?rhel} && 0%{?rhel} < 8
+%description -n python-x2go
+%else
+%description -n python2-x2go
+%endif
+X2Go is a server based computing environment with:
+   - session resuming
+   - low bandwidth support
+   - session brokerage support
+   - client side mass storage mounting support
+   - audio support
+   - authentication by smartcard and USB stick
+
+This Python module allows you to integrate X2Go client support into your
+Python applications by providing a Python-based X2Go client API.
 
 
-%if 0%{?with_python3}
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
 %package -n python3-x2go
-Summary:        Python module providing X2Go client API
+Summary:        %{summary}
 Group:          Development/Languages
 Requires:       python3-gevent
 Requires:       python3-paramiko >= 1.15.1
@@ -80,6 +114,8 @@ Requires:       python3-xlib
 Requires:       python3-requests
 Requires:       python3-simplejson
 Requires:       python3-future
+Requires:       nxproxy
+%{?python_provide:%python_provide python3-%{srcname}}
 
 %description -n python3-x2go
 X2Go is a server based computing environment with:
@@ -97,21 +133,30 @@ Python applications by providing a Python-based X2Go client API.
 
 %prep
 %setup -q
-# Remove shbang from library scipts
+# Remove shbang from library scripts
 find x2go -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python||'
-# Python3
-%if 0%{?with_python3}
-rm -rf %{py3dir}
-cp -a . %{py3dir}
-%endif # with_python3
 
 
 %build
-%{__python} setup.py build
-%if 0%{?with_python3}
-pushd %{py3dir}
-%{__python3} setup.py build
-popd
+%if 0%{?suse_version}
+%if 0%{?sle_version} && ( ( 0%{?sle_version} < 120300 && 0%{?is_opensuse} ) || ( ! 0%{?is_opensuse} ) )
+python2 setup.py build
+%else
+%{python2_build}
+%endif
+%else
+%{py2_build}
+%endif
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
+%if 0%{?suse_version}
+%if 0%{?sle_version} && ( ( 0%{?sle_version} < 120300 && 0%{?is_opensuse} ) || ( ! 0%{?is_opensuse} ) )
+python3 setup.py build
+%else
+%{python3_build}
+%endif
+%else
+%{py3_build}
+%endif
 %endif # with_python3
 
 # Build the docs
@@ -119,25 +164,62 @@ make -f Makefile.docupload docbuild
 
 
 %install
-%if 0%{?with_python3}
-pushd %{py3dir}
-%{__python3} setup.py install --skip-build --root %{buildroot}
-popd
+%if 0%{?suse_version}
+%if 0%{?sle_version} && ( ( 0%{?sle_version} < 120300 && 0%{?is_opensuse} ) || ( ! 0%{?is_opensuse} ) )
+python2 setup.py install --skip-build --root %{buildroot}
+%else
+%{python2_install} --skip-build
+%endif
+%else
+%{py2_install}
+%endif
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
+%if 0%{?suse_version}
+%if 0%{?sle_version} && ( ( 0%{?sle_version} < 120300 && 0%{?is_opensuse} ) || ( ! 0%{?is_opensuse} ) )
+python3 setup.py install --skip-build --root %{buildroot}
+%else
+%{python3_install} --skip-build
+%endif
+%else
+%{py3_install}
+%endif
 %endif # with_python3
-%{__python} setup.py install --skip-build --root %{buildroot}
 %if 0%{?fdupes:1}
-%fdupes %buildroot/%_prefix
+%fdupes %{buildroot}/%{_prefix}
 %endif
 
 
-%files
-%defattr(-,root,root)
-%doc COPYING README* TODO
-%{python_sitelib}/*
-
 %files doc
 %defattr(-,root,root)
 %doc docs/build/html
 
+%if 0%{?rhel} && 0%{?rhel} < 8
+%files -n python-x2go
+%else
+%files -n python2-x2go
+%endif
+%defattr(-,root,root)
+%license COPYING
+%doc README* TODO
+%{python2_sitelib}/*
+%if 0%{?suse_version}
+%if 0%{?sle_version} && 0%{?sle_version} >= 120300 && 0%{?is_opensuse}
+%pycache_only %{python2_sitelib}/__pycache__
+%endif
+%endif
+
+%if 0%{?with_python3} && ( ! ( 0%{?rhel} ) || 0%{?rhel} > 7 )
+%files -n python3-x2go
+%defattr(-,root,root)
+%license COPYING
+%doc README* TODO
+%{python3_sitelib}/*
+%if 0%{?suse_version}
+%if 0%{?sle_version} && 0%{?sle_version} >= 120300 && 0%{?is_opensuse}
+%pycache_only %{python3_sitelib}/__pycache__
+%endif
+%endif
+%endif
+
 
 %changelog

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git


More information about the x2go-commits mailing list