From d93f20474256acc86d7eb4ce7e6dc95cea9b6c24 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 23 Dec 2016 03:43:47 +0000 Subject: [PATCH] #1386: install both python2 and python3 builds with the "xpra" package, use python3 for the sound subprocess on Fedora and CentOS / RedHat git-svn-id: https://xpra.org/svn/Xpra/trunk@14579 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- rpmbuild/xpra.spec | 59 +++++++++++++++++-------------- src/xpra/os_util.py | 6 ++++ src/xpra/platform/xposix/paths.py | 10 ++++++ 3 files changed, 48 insertions(+), 27 deletions(-) diff --git a/rpmbuild/xpra.spec b/rpmbuild/xpra.spec index f7298350ee..000cfde56e 100644 --- a/rpmbuild/xpra.spec +++ b/rpmbuild/xpra.spec @@ -121,16 +121,31 @@ Name: xpra Version: %{version} Release: %{build_no}%{?dist} Summary: Xpra gives you "persistent remote applications" for X. - Group: Networking License: GPL URL: http://xpra.org/ Packager: Antoine Martin Vendor: http://xpra.org/ - Source: xpra-%{version}.tar.bz2 +#rpm falls over itself if we try to make the top-level package noarch: +#BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-root +Requires: xpra-common = %{version}-%{build_no}%{dist} +Requires: python2-xpra = %{version}-%{build_no}%{dist} +Requires: python3-xpra = %{version}-%{build_no}%{dist} +Requires: xpra-html5 + +%description +Xpra gives you "persistent remote applications" for X. That is, unlike normal X applications, applications run with xpra are "persistent" -- you can run them remotely, and they don't die if your connection does. You can detach them, and reattach them later -- even from another computer -- with no loss of state. And unlike VNC or RDP, xpra is for remote applications, not remote desktops -- individual applications show up as individual windows on your screen, managed by your window manager. They're not trapped in a box. + +So basically it's screen for remote X apps. + + +%package -n python2-xpra +Summary: python2 build of xpra +Group: Networking + Requires: python %{requires_opengl} %{requires_sound} %{requires_lzo} %{requires_websockify} %{requires_printing} %{requires_webcam} Requires: python2-lz4 Requires: %{requires_pygtk2} @@ -156,7 +171,6 @@ Requires: ffmpeg-xpra Requires: python2-pynvml Requires: %{numpy} Requires: xpra-common = %{version}-%{build_no}%{dist} -Requires: xpra-html5 %if 0%{?el7} #sshpass is not available! %else @@ -209,21 +223,9 @@ Requires(post): desktop-file-utils Requires(postun): desktop-file-utils Requires: %{requires_crypto} -%if %{with_python3} -BuildRequires: python3-devel -BuildRequires: python3-Cython -BuildRequires: python3-numpy -BuildRequires: gtk3-devel -BuildRequires: python3-gobject -BuildRequires: gobject-introspection-devel -BuildRequires: python3-rencode -%endif - +%description -n python2-xpra +This package contains the python2 build of xpra. -%description -Xpra gives you "persistent remote applications" for X. That is, unlike normal X applications, applications run with xpra are "persistent" -- you can run them remotely, and they don't die if your connection does. You can detach them, and reattach them later -- even from another computer -- with no loss of state. And unlike VNC or RDP, xpra is for remote applications, not remote desktops -- individual applications show up as individual windows on your screen, managed by your window manager. They're not trapped in a box. - -So basically it's screen for remote X apps. #package containing the common bits: %package common @@ -272,27 +274,29 @@ Requires: xorg-x11-drv-dummy Requires: %{requires_xorg} Requires: %{libvpx} %if 0%{?fedora} +BuildRequires: libwebp-devel +BuildRequires: libyuv-devel Requires: libwebp Requires: libyuv %endif Requires: x264-xpra Requires: ffmpeg-xpra -Requires: xpra-common = %{build_no}%{dist} -Requires: xpra-html5 +Requires: xpra-common = %{version}-%{build_no}%{dist} #for running the tests: BuildRequires: %{py3requires_crypto} -%if 0%{?fedora} -BuildRequires: libwebp-devel -BuildRequires: libyuv-devel -%endif +BuildRequires: python3-devel +BuildRequires: python3-Cython +BuildRequires: python3-numpy +BuildRequires: gtk3-devel +BuildRequires: python3-gobject +BuildRequires: gobject-introspection-devel +BuildRequires: python3-rencode %description -n python3-xpra -Xpra gives you "persistent remote applications" for X. That is, unlike normal X applications, applications run with xpra are "persistent" -- you can run them remotely, and they don't die if your connection does. You can detach them, and reattach them later -- even from another computer -- with no loss of state. And unlike VNC or RDP, xpra is for remote applications, not remote desktops -- individual applications show up as individual windows on your screen, managed by your window manager. They're not trapped in a box. +This package contains the python3 build of xpra. -So basically it's screen for remote X apps. %endif - %prep rm -rf $RPM_BUILD_DIR/xpra-%{version}-python2 $RPM_BUILD_DIR/xpra-%{version} bzcat $RPM_SOURCE_DIR/xpra-%{version}.tar.bz2 | tar -xf - @@ -378,6 +382,7 @@ rm -fr ${RPM_BUILD_ROOT}/%{python3_sitearch}/unittests %clean rm -rf $RPM_BUILD_ROOT +%files %files html5 %defattr(-,root,root) @@ -425,7 +430,7 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/selinux/*/cups_xpra.pp %endif -%files +%files -n python2-xpra %{python2_sitearch}/xpra %{python2_sitearch}/xpra-*.egg-info diff --git a/src/xpra/os_util.py b/src/xpra/os_util.py index c98c6583e5..410c28c92a 100644 --- a/src/xpra/os_util.py +++ b/src/xpra/os_util.py @@ -209,6 +209,12 @@ def is_Fedora(): def is_Arch(): return is_distribution_variant(b"Arch") +def is_CentOS(): + return is_distribution_variant(b"CentOS") + +def is_RedHat(): + return is_distribution_variant(b"RedHat") + _linux_distribution = None def get_linux_distribution(): diff --git a/src/xpra/platform/xposix/paths.py b/src/xpra/platform/xposix/paths.py index ab96593d5f..ad2c16c9e4 100644 --- a/src/xpra/platform/xposix/paths.py +++ b/src/xpra/platform/xposix/paths.py @@ -8,6 +8,10 @@ import sys import site +from xpra.util import envbool +from xpra.os_util import is_Fedora, is_CentOS, is_RedHat +SOUND_PYTHON3 = envbool("XPRA_SOUND_PYTHON3", is_Fedora() or is_CentOS() or is_RedHat()) + def do_get_install_prefix(): #special case for "user" installations, ie: @@ -99,3 +103,9 @@ def do_get_default_log_dirs(): if v: return [v, "~/.xpra", "/tmp"] return ["~/.xpra", "/tmp"] + +def do_get_sound_command(): + from xpra.platform.paths import get_xpra_command + if SOUND_PYTHON3: + return ["python3"]+get_xpra_command() + return get_xpra_command()