Skip to content

Commit

Permalink
#1527: add service stub
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@15933 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 23, 2017
1 parent 3239f84 commit f9cb6dc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,7 @@ def add_service_exe(script, icon, base_name):
add_console_exe("xpra/server/auth/sqlite_auth.py", "sqlite.ico", "SQLite_auth_tool")
if CX5:
add_service_exe("xpra/platform/win32/service_config.py", "xpra_txt.ico", "Xpra-Service")
external_includes += ["cx_Logging"]
if client_ENABLED:
add_console_exe("xpra/codecs/loader.py", "encoding.ico", "Encoding_info")
add_console_exe("xpra/platform/paths.py", "directory.ico", "Path_info")
Expand Down
4 changes: 4 additions & 0 deletions src/win32/PY27_MINGW_BUILD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ if [ "$?" != "0" ]; then
tail -n 20 "${CX_FREEZE_LOG}"
exit 1
fi
#fixup cx_Logging, required by the service class before we can patch sys.path to find it:
if [ -e "${DIST}/lib/cx_Logging.pyd" ]; then
mv "${DIST}/lib/cx_Logging.pyd" "${DIST}/"
fi

if [ -e "${DIST}/OpenGL" ]; then
echo "* Adding PyOpenGL to library.zip"
Expand Down
36 changes: 36 additions & 0 deletions src/xpra/platform/win32/service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2017 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import threading
from xpra.log import Logger
from xpra.platform import init, clean

class Handler(object):

def __init__(self):
init("Xpra Service", "Xpra Service")
self.log = Logger("server", "win32")
self.log.info("Service.init()")
self.stopEvent = threading.Event()
self.stopRequestedEvent = threading.Event()

def Initialize(self, configFileName):
self.log.info("Service.Initialize(%s)", configFileName)

def SessionChanged(self, sessionId, eventType):
self.log.info("Service.SessionChanged(%s, %s)", sessionId, eventType)

def Run(self):
self.log.info("Service.Run()")
self.stopRequestedEvent.wait()
self.stopEvent.set()
clean()

def Stop(self):
self.log.info("Service.Stop()")
self.stopRequestedEvent.set()
self.stopEvent.wait()
13 changes: 13 additions & 0 deletions src/xpra/platform/win32/service_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2017 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

NAME = 'Xpra%s'
DISPLAY_NAME = 'Xpra Service - %s'
MODULE_NAME = 'xpra.platform.win32.service'
CLASS_NAME = 'Service'
DESCRIPTION = 'Xpra System Proxy Service'
AUTO_START = True
SESSION_CHANGES = True

0 comments on commit f9cb6dc

Please sign in to comment.