[X2Go-Commits] python-x2go.git - release/0.4.0.x (branch) updated: da8d017de45587adfc537bf1e68e9ccbd1674f05

X2Go dev team git-admin at x2go.org
Tue Jan 7 16:16:03 CET 2014


The branch, release/0.4.0.x has been updated
       via  da8d017de45587adfc537bf1e68e9ccbd1674f05 (commit)
      from  41869db5d84ee8dfc5c46fb6d60789a2235f52e4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 x2go/defaults.py |   12 ++++++------
 x2go/inifiles.py |    6 ++++++
 x2go/xserver.py  |   47 ++++++++++++++++++++++++-----------------------
 3 files changed, 36 insertions(+), 29 deletions(-)

The diff of changes is:
diff --git a/x2go/defaults.py b/x2go/defaults.py
index fefd815..4091bdb 100644
--- a/x2go/defaults.py
+++ b/x2go/defaults.py
@@ -167,14 +167,14 @@ if X2GOCLIENT_OS == 'Windows':
         },
         'Cygwin-X': {
             'process_name': 'XWin.exe',
-            'test_available': '%s\cygwin\bin\startxwin.exe' % os.environ['SystemDrive'],
-            'run_command':'%s\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe' % os.environ['SystemDrive'],
+            'test_installed': os.path.join(os.environ['SystemDrive'], '\\', 'cygwin', 'bin', 'startxwin.exe'),
+            'run_command':os.path.join(os.environ['SystemDrive'], '\\', 'cygwin', 'bin', 'run.exe') + ' /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe',
             'parameters':[],
             },
-        'XMing': {
-            'process_name': 'XMing.exe',
-            'test_available':'%s\Xming\Xming.exe' % os.environ['ProgramFiles'], 
-            'run_command':'%s\Xming\Xming.exe' % os.environ['ProgramFiles'],
+        'Xming': {
+            'process_name': 'Xming.exe',
+            'test_installed': os.path.join(os.environ['ProgramFiles'], 'Xming', 'Xming.exe'), 
+            'run_command': os.path.join(os.environ['ProgramFiles'], 'Xming', 'Xming.exe'),
             'parameters': [':0', '-clibboard', '-multiwindow',],
             },
         }
diff --git a/x2go/inifiles.py b/x2go/inifiles.py
index 3b19532..7762005 100644
--- a/x2go/inifiles.py
+++ b/x2go/inifiles.py
@@ -219,6 +219,12 @@ class X2goIniFile(object):
                 return self.iniConfig.getboolean(section, key)
             elif key_type is types.IntType:
                 return self.iniConfig.getint(section, key)
+            elif key_type is types.ListType:
+                val = self.iniConfig.get(section, key)
+                if val.startswith('[') and val.endswith(']'):
+                    return eval(val)
+                else:
+                    raise TypeError
             else:
                 return self.iniConfig.get(section, key)
     get = get_value
diff --git a/x2go/xserver.py b/x2go/xserver.py
index 4175afe..de3df50 100644
--- a/x2go/xserver.py
+++ b/x2go/xserver.py
@@ -25,12 +25,19 @@
 # Other contributors:
 #       none so far
 
-import os
-
 __NAME__ = 'x2gosettings-pylib'
 
+from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS
+
+if _X2GOCLIENT_OS not in ("Windows"):
+    import exceptions
+    class OSNotSupportedException(exceptions.StandardError): pass
+    raise OSNotSupportedException('x2go.xserver module is for Windows only' % platform.system())
+
 # modules
 import os
+import wmi
+import subprocess
 import threading
 
 # Python X2go modules
@@ -39,11 +46,6 @@ from defaults import X2GO_XCONFIG_CONFIGFILES
 from defaults import X2GO_CLIENTXCONFIG_DEFAULTS
 import inifiles
 
-from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS
-if _X2GOCLIENT_OS in ("Windows"):
-    import subprocess
-else:
-    import gevent_subprocess as subprocess
 
 
 class X2goClientXConfig(inifiles.X2goIniFile):
@@ -75,9 +77,9 @@ class X2goClientXConfig(inifiles.X2goIniFile):
 
     def get_xserver_config(self, xserver_name):
         _xserver_config = {}
-        for option in self.iniConfig.options(_profile_id):
-            _profile_config[option] = self.get(_profile_id, option, key_type=self.get_profile_option_type(option))
-        return _profile_config
+        for option in self.iniConfig.options(xserver_name):
+            _xserver_config[option] = self.get(xserver_name, option, key_type=self.get_type(xserver_name, option))
+        return _xserver_config
 
     @property
     def known_xservers(self):
@@ -95,27 +97,28 @@ class X2goClientXConfig(inifiles.X2goIniFile):
         """
         _installed = []
         for xserver_name in self.known_xservers:
-            if os.path.exists(os.path.normpath(self.get_xserver_config(xserver_name)):
+            if os.path.exists(os.path.normpath(self.get_xserver_config(xserver_name)['test_installed'])):
                 _installed.append(xserver_name)
         return _installed
 
+    @property
     def running_xservers(self):
         """\
         STILL UNDOCUMENTED
 
         """
         _running = []
-        for xserver_name in self.known_xservers:
-
+        _wmi = wmi.WMI()
+        _p_names = []
+        for process in _wmi.Win32_Process():
+            _p_names.append(process.Name)
+            
+        for xserver_name in self.installed_xservers:
             process_name = self.get_xserver_config(xserver_name)['process_name']
-            for line in os.popen("ps xa"):
-                fields = line.split()
-                pid = fields[0]
-                process = fields[4]
-
-                if process.find(process_name) > 0:
-                    # XServer is already running
-                    _running.append(nick_name)
+            if process_name in _p_names:
+                # XServer is already running
+                _running.append(xserver_name)
+                continue
         return _running
 
 
@@ -127,8 +130,6 @@ class X2goXServer(threading.Thread):
 
     def __init__(self, XServerParms):
 
-        for 
-
         process_name = XServerParms.process_name
         for line in os.popen("ps xa"):
             fields = line.split()


hooks/post-receive
-- 
python-x2go.git (Python X2Go Client API)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).




More information about the x2go-commits mailing list