From 84c6474f19e36b938337ac0d7c4297f27d53b908 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 30 Sep 2016 18:11:22 +0000 Subject: [PATCH] allow the proxy server to run on python3 git-svn-id: https://xpra.org/svn/Xpra/trunk@13939 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/setup.py | 11 ++++++++--- src/xpra/server/server_core.py | 9 ++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/setup.py b/src/setup.py index e355e95efb..52f7ff347a 100755 --- a/src/setup.py +++ b/src/setup.py @@ -135,6 +135,7 @@ def is_msvc(): from xpra.platform.features import LOCAL_SERVERS_SUPPORTED, SHADOW_SUPPORTED shadow_ENABLED = SHADOW_SUPPORTED and not PYTHON3 and DEFAULT #shadow servers use some GTK2 code.. server_ENABLED = (LOCAL_SERVERS_SUPPORTED or shadow_ENABLED) and not PYTHON3 and DEFAULT +proxy_ENABLED = DEFAULT client_ENABLED = DEFAULT x11_ENABLED = DEFAULT and not WIN32 and not OSX @@ -223,7 +224,9 @@ def is_msvc(): "gtk2", "gtk3", "html5", "pam", "sound", "opengl", "printing", "rebuild", - "annotate", "warn", "strict", "shadow", "debug", "PIC", + "annotate", "warn", "strict", + "shadow", "proxy", + "debug", "PIC", "Xdummy", "Xdummy_wrapper", "verbose", "tests", "bundle_tests"] if WIN32: SWITCHES.append("zip") @@ -1896,7 +1899,9 @@ def osx_pkgconfig(*pkgs_options, **ekw): toggle_packages(dbus_ENABLED, "xpra.dbus") -toggle_packages(server_ENABLED, "xpra.server", "xpra.server.auth", "xpra.server.proxy", "xpra.server.window") +toggle_packages(server_ENABLED or proxy_ENABLED, "xpra.server") +toggle_packages(proxy_ENABLED, "xpra.server.proxy") +toggle_packages(server_ENABLED, "xpra.server.auth", "xpra.server.window") toggle_packages(server_ENABLED and shadow_ENABLED, "xpra.server.shadow") toggle_packages(server_ENABLED or (client_ENABLED and gtk2_ENABLED), "xpra.clipboard") #cannot use toggle here as py2exe will complain if we try to exclude this module: @@ -2020,7 +2025,7 @@ def osx_pkgconfig(*pkgs_options, **ekw): toggle_packages(client_ENABLED or server_ENABLED, "xpra.keyboard") if client_ENABLED or server_ENABLED: add_modules("xpra.scripts.config", "xpra.scripts.exec_util", "xpra.scripts.fdproxy", "xpra.scripts.version") -if server_ENABLED: +if server_ENABLED or proxy_ENABLED: add_modules("xpra.scripts.server") if WIN32 and client_ENABLED and (gtk2_ENABLED or gtk3_ENABLED): add_modules("xpra.scripts.gtk_info") diff --git a/src/xpra/server/server_core.py b/src/xpra/server/server_core.py index 1a04c2ca69..c38042894b 100644 --- a/src/xpra/server/server_core.py +++ b/src/xpra/server/server_core.py @@ -7,7 +7,6 @@ # later version. See the file COPYING for details. import binascii -import types import os import sys import time @@ -31,7 +30,7 @@ from xpra.scripts.config import InitException, parse_bool from xpra.net.bytestreams import SocketConnection, log_new_connection, inject_ssl_socket_info, pretty_socket, SOCKET_TIMEOUT from xpra.platform import set_name -from xpra.os_util import load_binary_file, get_machine_id, get_user_uuid, platform_name, SIGNAMES +from xpra.os_util import load_binary_file, get_machine_id, get_user_uuid, platform_name, bytestostr, SIGNAMES from xpra.version_util import version_compat_check, get_version_info_full, get_platform_info, get_host_info, local_version from xpra.net.protocol import Protocol, get_network_caps, sanity_checks from xpra.net.crypto import crypto_backend_init, new_cipher_caps, get_salt, \ @@ -1207,10 +1206,10 @@ def get_socket_info(self): def process_packet(self, proto, packet): + packet_type = None + handler = None try: - handler = None - packet_type = packet[0] - assert isinstance(packet_type, types.StringTypes), "packet_type %s is not a string: %s..." % (type(packet_type), str(packet_type)[:100]) + packet_type = bytestostr(packet[0]) handler = self._default_packet_handlers.get(packet_type) if handler: netlog("process packet %s", packet_type)