[X2Go-Commits] [x2goclient] 04/94: * completely egg'ified / class'ified PyHocaCLI -> PyHocaCLI(args, logger, liblogger) can now be called from within your programmes
git-admin at x2go.org
git-admin at x2go.org
Fri Dec 15 21:04:29 CET 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to annotated tag 0.1.4.0
in repository x2goclient.
commit 052f0527497ec8b9a5a327dbad270c4c6bb47490
Author: mike <mike at cdb5e8f1-f799-4276-8919-bce57fd91830>
Date: Thu Oct 28 21:19:05 2010 +0000
* completely egg'ified / class'ified PyHocaCLI
-> PyHocaCLI(args, logger, liblogger) can now be called from within
your programmes
git-svn-id: https://svn.das-netzwerkteam.de/x2go/pyhoca-cli/trunk@13 cdb5e8f1-f799-4276-8919-bce57fd91830
---
debian/changelog | 6 +
pyhoca-cli | 260 ++++----------------------------
pyhoca/__init__.py | 19 +++
pyhoca/cli/{__init.py__ => __init__.py} | 2 +
pyhoca/cli/frontend.py | 226 ++++++++++++++++++++++++++-
pyhoca/cli/x2go | 2 +-
setup.py | 7 +-
x2go | 2 +-
8 files changed, 284 insertions(+), 240 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index cadeb438..0ff76868 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pyhoca-cli (0.1.0-0~nwt1) lucid maverick testing unstable; urgency=low
+
+ * class'ified and egg'ified: PyHocaCLI is now a class
+
+ -- Mike Gabriel <m.gabriel at das-netzwerkteam.de> Thu, 28 Oct 2010 23:30:00 +0200
+
pyhoca-cli (0.0.15-0~nwt1) lucid maverick testing unstable; urgency=low
* updated man page
diff --git a/pyhoca-cli b/pyhoca-cli
index 12da2004..fdda7332 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
@@ -1,28 +1,26 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-"""
- Copyright (C) 2010 by Mike Gabriel <m.gabriel at das-netzwerkteam.de>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the
- Free Software Foundation, Inc.,
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
- Contributors to the code of this programme:
- Jörg Sawatzki <joerg.sawatzki at web.de>
-"""
-
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel at das-netzwerkteam.de>
+#
+# PyHoca CLI is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# PyHoca CLI is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Contributors to the code of this programme:
+# 2010 Dick Kniep <dick.kniep at lindix.nl>
+# 2010 Jörg Sawatzki <joerg.sawatzki at web.de>
###
### module section
@@ -41,15 +39,18 @@ import pprint
# Python X2go provides the current local username (OS independent)
from x2go.defaults import CURRENT_LOCAL_USER as current_user
+
from x2go.defaults import X2GO_PRINT_ACTIONS
from x2go.defaults import DEFAULT_PDFVIEW_CMD
from x2go.defaults import DEFAULT_PDFSAVE_LOCATION
from x2go.defaults import DEFAULT_PRINTCMD_CMD
+from pyhoca.cli import PyHocaCLI
+
# version information
PROG_NAME = os.path.basename(sys.argv[0])
PROG_PID = os.getpid()
-VERSION="0.0.14"
+VERSION="0.1.0"
VERSION_TEXT="""
%s[%s] - an X2go command line client written in Python
----------------------------------------------------------------------
@@ -59,32 +60,11 @@ VERSION: %s
""" % (PROG_NAME, PROG_PID, VERSION)
+PRINT_ACTIONS = X2GO_PRINT_ACTIONS.keys()
+print_actions_args = {}
-def _touch_file(filename):
-
- if not os.path.isfile(filename):
- f = open(filename, 'w')
- f.close()
-
-# ,,constants'' needed for debugging
logger = x2go.X2goLogger(tag='MAIN')
liblogger = x2go.X2goLogger()
-x2go_session_hash = ''
-
-# use current_home as user home dir
-current_home = os.path.expanduser("~")
-
-# define and create known_hosts file (if not there)
-ssh_known_hosts_filename = os.path.join(current_home, '.ssh', 'known_hosts')
-if not os.path.isfile(ssh_known_hosts_filename):
- _touch_file(ssh_known_hosts_filename)
-# define and create ssh_config file (if not there)
-ssh_config_filename = os.path.join(current_home, '.ssh', 'config')
-if not os.path.isfile(ssh_config_filename):
- _touch_file(ssh_config_filename)
-
-PRINT_ACTIONS = X2GO_PRINT_ACTIONS.keys()
-print_action_args = {}
###
### command line arguments
@@ -155,18 +135,11 @@ def version():
sys.exit(0)
-# sometimes we have to fail...
-def runtime_error(m, parser=None, exitcode=-1):
- if parser is not None:
- parser.print_usage()
- sys.stderr.write ("%s: error: %s\n" % (PROG_NAME, m))
- sys.exit(exitcode)
-
-
def parseargs():
global DEBUG
global print_action_args
+ global logger
p = argparse.ArgumentParser(description='X2go command line client implemented in Python.',\
epilog="""
@@ -290,6 +263,7 @@ Possible values for the --pack NX option are:
###
# check if SERVER is in .ssh/config file, extract information from there...
ssh_config = paramiko.SSHConfig()
+ from pyhoca.cli import ssh_config_filename
ssh_config_fileobj = open(ssh_config_filename)
ssh_config.parse(ssh_config_fileobj)
ssh_host = ssh_config.lookup(a.server)
@@ -310,79 +284,8 @@ Possible values for the --pack NX option are:
return p, a
-def list_sessions(cli, s_hash):
- # retrieve a session list
- print
- print "Available runing/suspended X2go sessions"
- print "========================================"
- print "Hostname: [%s]:%s" % cli.get_server(s_hash)
- print "Username: %s" % cli.get_username(s_hash)
- print
- session_infos = cli.list_sessions(s_hash)
- for session_info in session_infos.values():
- print "Session Name: %s" % session_info
- print "-------------"
- print "cookie: %s" % session_info.cookie
- print "agent PID: %s" % session_info.agent_pid
- print "display: %s" % session_info.display
- print "status: %s" % session_info.status
- print "graphic port: %s" % session_info.graphics_port
- print "snd port: %s" % session_info.snd_port
- print "sshfs port: %s" % session_info.sshfs_port
- print "username: %s" % session_info.username
- print "hostname: %s" % session_info.hostname
- # TODO: turn into datetime object
- print "create date: %s" % session_info.date_created
- # TODO: turn into datetime object
- print "suspended since: %s" % session_info.date_suspended
- print
-
-
-def clean_sessions(cli, s_hash):
- # clean all sessions from X2go server
- logger('cleaning up all running sessions from X2go server: %s' % args.server, x2go.loglevel_NOTICE, )
- cli.clean_sessions(s_hash)
-
-
-def new_session(cli, s_hash):
- # start a new session and run a command
- logger('starting a new X2go session', x2go.loglevel_INFO, )
- logger('Command for new session is: %s' % args.command, x2go.loglevel_DEBUG, )
- cli.start_session(s_hash)
-
-
-def resume_session(cli, s_hash):
- # resume a running session
- logger('resuming X2go session: %s' % args.resume, x2go.loglevel_INFO, )
- available_sessions = cli.list_sessions(s_hash)
- if args.resume in available_sessions.keys():
- cli.resume_session(s_hash, args.resume)
- else:
- runtime_error('requested session not available on X2go server [%s]:%s.' % (args.server, args.remote_ssh_port), exitcode=20)
-
-
-def suspend_session(cli, s_hash):
- # send a suspend request to a session
- logger('requesting X2go session suspend of session: %s' % args.suspend, x2go.loglevel_INFO, )
- available_sessions = cli.list_sessions(s_hash)
- if args.suspend in available_sessions.keys():
- cli.suspend_session(s_hash, args.suspend)
- else:
- runtime_error('requested session not available on X2go server [%s]:%s.' % (args.server, args.remote_ssh_port), exitcode=21)
-
-def terminate_session(cli, s_hash):
- # send a terminate request to a session
- logger('requesting X2go session terminate of session: %s' % args.terminate, x2go.loglevel_INFO, )
- available_sessions = cli.list_sessions(s_hash)
- if args.terminate in available_sessions.keys():
- cli.terminate_session(s_hash, args.terminate)
- else:
- runtime_error('requested session not available on X2go server [%s]:%s.' % (args.server, args.remote_ssh_port), exitcode=22)
-
-
if __name__ == '__main__':
-
# parse command line
parser, args = parseargs()
@@ -390,111 +293,10 @@ if __name__ == '__main__':
logger('preparing requested X2go session', x2go.loglevel_NOTICE, )
try:
- x2goclient = x2go.X2goClient(logger=liblogger)
- x2go_session_hash = x2goclient.register_session(args.server, port=int(args.remote_ssh_port),
- username=args.username,
- password=args.password,
- key_filename=args.ssh_privkey,
- add_to_known_hosts=args.add_to_known_hosts,
- profile_name = 'Pyhoca-Client_Session',
- session_type=args.session_type,
- link=args.link,
- geometry=args.geometry,
- pack=args.pack,
- cache_type='unix-kde',
- kblayout=args.kbd_layout,
- kbtype=args.kbd_type,
- snd_system=args.sound,
- printing=args.printing,
- print_action=args.print_action,
- print_action_args=print_action_args,
- cmd=args.command)
- x2goclient.with_session(x2go_session_hash).load_host_keys(ssh_known_hosts_filename)
- connected = False
- force_password_auth = False
- while not connected:
- try:
- x2goclient.connect_session(x2go_session_hash, password=args.password, force_password_auth=force_password_auth)
- connected = True
- except x2go.AuthenticationException:
- force_password_auth = True
- args.password = getpass.getpass()
- except x2go.PasswordRequiredException:
- args.password = getpass.getpass()
- except x2go.BadHostKeyException:
- runtime_error('SSH host key verification for remote host [%s]:%s failed' % (args.server, args.remote_ssh_port), exitcode=-254)
- except x2go.SSHException, e:
- runtime_error(str(e), exitcode=253)
-
- if args.clean_sessions:
- clean_sessions(x2goclient, x2go_session_hash)
-
- # go through the possible X2go client modes
- if args.list_sessions:
- # print a beautified session list for the user
- list_sessions(x2goclient, x2go_session_hash)
- sys.exit(0)
-
- if args.resume:
- resume_session(x2goclient, x2go_session_hash)
-
- elif args.suspend:
- suspend_session(x2goclient, x2go_session_hash)
-
- elif args.terminate:
- terminate_session(x2goclient, x2go_session_hash)
-
- elif args.new:
- new_session(x2goclient, x2go_session_hash)
-
-
- if args.new or args.resume:
- # give the session some time to come up...
- # no CTRL-C is allowed during this phase...
- i=0
- logger("give the X2go session some time to come up...", x2go.loglevel_NOTICE, )
- while i < args.time_to_wait:
- time.sleep(1)
- i+=1
-
- if x2goclient.session_ok(x2go_session_hash):
-
- profile_name = x2goclient.get_profile_name(x2go_session_hash)
- session_name = x2goclient.get_session_name(x2go_session_hash)
- logger("X2go session is now running, the X2go client's profile name is: %s." % profile_name, x2go.loglevel_INFO, )
- logger("X2go session name is: %s." % session_name, x2go.loglevel_INFO, )
- logger("Press CTRL+C to suspend the running session.", x2go.loglevel_NOTICE, )
- try:
-
- session_duration = 0
- mounted = False
- while x2goclient.session_ok(x2go_session_hash):
- time.sleep(2)
- session_duration +=2
-
- if session_duration > 2 and not mounted and args.share_local_folders is not None:
- if x2goclient.with_session(x2go_session_hash).get_transport().reverse_tunnels['sshfs'][1] is not None:
- for _folder in args.share_local_folders:
- x2goclient.share_local_folder(x2go_session_hash, _folder)
- mounted = True
-
- # wait a little longer before telling the user what had happened
- time.sleep(2)
-
- if x2goclient.has_terminated(x2go_session_hash):
- logger("X2go session %s has terminated." % session_name, x2go.loglevel_NOTICE, )
- elif x2goclient.is_suspended(x2go_session_hash):
- logger("X2go session %s has been suspended." % session_name, x2go.loglevel_NOTICE, )
- elif x2goclient.is_running(x2go_session_hash):
- logger("X2go session %s has been moved to a different screen." % session_name, x2go.loglevel_NOTICE, )
-
- except KeyboardInterrupt:
- logger("Suspending X2go session %s." % session_name, x2go.loglevel_INFO, )
- x2goclient.suspend_session(x2go_session_hash)
- # giving nxproxy's SSH tunnel some time to settle
- time.sleep(2)
- logger("X2go session %s has been suspended." % session_name, x2go.loglevel_NOTICE, )
+ thisPyHocaCLI = PyHocaCLI(args, logger=logger, liblogger=liblogger)
+ thisPyHocaCLI.authenticate()
+ thisPyHocaCLI.MainLoop()
sys.exit(0)
except (KeyboardInterrupt, SystemExit), e:
diff --git a/pyhoca/__init__.py b/pyhoca/__init__.py
index e69de29b..6d579482 100644
--- a/pyhoca/__init__.py
+++ b/pyhoca/__init__.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2010 by Dick Kniep <m.gabriel at das-netzwerkteam.de>
+#
+# PyHoca CLI is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# PyHoca CLI is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
diff --git a/pyhoca/cli/__init.py__ b/pyhoca/cli/__init__.py
similarity index 94%
rename from pyhoca/cli/__init.py__
rename to pyhoca/cli/__init__.py
index aa21dc44..aaeed7ba 100644
--- a/pyhoca/cli/__init.py__
+++ b/pyhoca/cli/__init__.py
@@ -20,4 +20,6 @@
"""\
STILL UNDOCUMENTED
"""
+__VERSION__ = "0.1.0"
+
from frontend import *
\ No newline at end of file
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index 47a11461..4c07f325 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -1,6 +1,7 @@
+#!/usr/bin/python
# -*- coding: utf-8 -*-
-# Copyright (C) 2010 by Dick Kniep <dick.kniep at lindix.nl>
+# Copyright (C) 2010 by Mike Gabriel <m.gabriel at das-netzwerkteam.de>
#
# PyHoca CLI is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,10 +16,223 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Contributors to the code of this programme:
+# 2010 Dick Kniep <dick.kniep at lindix.nl>
+# 2010 Jörg Sawatzki <joerg.sawatzki at web.de>
+
+import sys, os
+import time
+import argparse
+import getpass
+import x2go
+import paramiko
+from types import *
+
+# for debugging
+import pprint
+
+# a list of available X2go print actions
+from x2go.defaults import X2GO_PRINT_ACTIONS
+
+# use current_home as user home dir
+current_home = os.path.expanduser("~")
+
+# define and create known_hosts file (if not there)
+ssh_known_hosts_filename = os.path.join(current_home, '.ssh', 'known_hosts')
+if not os.path.isfile(ssh_known_hosts_filename):
+ self._touch_file(ssh_known_hosts_filename)
+# define and create ssh_config file (if not there)
+ssh_config_filename = os.path.join(current_home, '.ssh', 'config')
+if not os.path.isfile(ssh_config_filename):
+ self._touch_file(ssh_config_filename)
+
+def _touch_file(self, filename):
+
+ if not os.path.isfile(filename):
+ f = open(filename, 'w')
+ f.close()
+
+
+class PyHocaCLI(x2go.X2goClient):
+ """\
+ STILL UNDOCUMENTED
+ """
+ x2go_session_hash = None
+
+ # sometimes we have to fail...
+ def runtime_error(self, m, exitcode=-1):
+ sys.stderr.write ("%s: error: %s\n" % (sys.argv[0], m))
+ sys.exit(exitcode)
+
+
+ def list_sessions(self, s_hash):
+ # retrieve a session list
+ print
+ print "Available runing/suspended X2go sessions"
+ print "========================================"
+ print "Hostname: [%s]:%s" % self.get_server(s_hash)
+ print "Username: %s" % self.get_username(s_hash)
+ print
+ session_infos = x2go.X2goClient.list_sessions(self, s_hash)
+ for session_info in session_infos.values():
+ print "Session Name: %s" % session_info
+ print "-------------"
+ print "cookie: %s" % session_info.cookie
+ print "agent PID: %s" % session_info.agent_pid
+ print "display: %s" % session_info.display
+ print "status: %s" % session_info.status
+ print "graphic port: %s" % session_info.graphics_port
+ print "snd port: %s" % session_info.snd_port
+ print "sshfs port: %s" % session_info.sshfs_port
+ print "username: %s" % session_info.username
+ print "hostname: %s" % session_info.hostname
+ # TODO: turn into datetime object
+ print "create date: %s" % session_info.date_created
+ # TODO: turn into datetime object
+ print "suspended since: %s" % session_info.date_suspended
+ print
+
+
+ def clean_sessions(self, s_hash):
+ # clean all sessions from X2go server
+ self.logger('cleaning up all running sessions from X2go server: %s' % self.args.server, x2go.loglevel_NOTICE, )
+ X2goClient.clean_sessions(self, s_hash)
+
+
+ def new_session(self, s_hash):
+ # start a new session and run a command
+ self.logger('starting a new X2go session', x2go.loglevel_INFO, )
+ self.logger('Command for new session is: %s' % self.args.command, x2go.loglevel_DEBUG, )
+ self.start_session(s_hash)
+
+
+ def resume_session(self, s_hash):
+ # resume a running session
+ self.logger('resuming X2go session: %s' % self.args.resume, x2go.loglevel_INFO, )
+ available_sessions = self.list_sessions(s_hash)
+ if self.args.resume in available_sessions.keys():
+ x2go.X2goClient.resume_session(self, s_hash, self.args.resume)
+ else:
+ self.runtime_error('requested session not available on X2go server [%s]:%s.' % (self.args.server, self.args.remote_ssh_port), exitcode=20)
+
+
+ def suspend_session(self, s_hash):
+ # send a suspend request to a session
+ self.logger('requesting X2go session suspend of session: %s' % self.args.suspend, x2go.loglevel_INFO, )
+ available_sessions = self.list_sessions(s_hash)
+ if self.args.suspend in available_sessions.keys():
+ x2go.X2goClient.suspend_session(self, s_hash, self.args.suspend)
+ else:
+ self.runtime_error('requested session not available on X2go server [%s]:%s.' % (self.args.server, self.args.remote_ssh_port), exitcode=21)
+
+
+ def terminate_session(self, s_hash):
+ # send a terminate request to a session
+ self.logger('requesting X2go session terminate of session: %s' % self.args.terminate, x2go.loglevel_INFO, )
+ available_sessions = self.list_sessions(s_hash)
+ if self.args.terminate in available_sessions.keys():
+ x2go.X2goClient.terminate_session(self, s_hash, self.args.terminate)
+ else:
+ self.runtime_error('requested session not available on X2go server [%s]:%s.' % (self.args.server, self.args.remote_ssh_port), exitcode=22)
+
+
+ def __init__(self, args, logger=None, liblogger=None):
+
+ self.args = args
+ if logger is None:
+ logger = x2go.X2goLogger(tag='PyHocaCLI')
+
+ # initialize the X2goClient context and start the connection to the X2go server
+ self.logger('preparing requested X2go session', x2go.loglevel_NOTICE, )
+
+ x2go.X2goClient.__init__(logger=liblogger)
+ self.x2go_session_hash = self.register_session(args.server, port=int(self.args.remote_ssh_port),
+ username=self.args.username,
+ password=self.args.password,
+ key_filename=self.args.ssh_privkey,
+ add_to_known_hosts=self.args.add_to_known_hosts,
+ profile_name = 'Pyhoca-Client_Session',
+ session_type=self.args.session_type,
+ link=self.args.link,
+ geometry=self.args.geometry,
+ pack=self.args.pack,
+ cache_type='unix-kde',
+ kblayout=self.args.kbd_layout,
+ kbtype=self.args.kbd_type,
+ snd_system=self.args.sound,
+ printing=self.args.printing,
+ print_action=self.args.print_action,
+ print_action_args=print_action_args,
+ cmd=self.args.command)
+ self.with_session(self.x2go_session_hash).load_host_keys(ssh_known_hosts_filename)
+
+
+ def authenticate(self):
+
+ connected = False
+ force_password_auth = False
+ while not connected:
+ try:
+ self.connect_session(self.x2go_session_hash, password=self.args.password, force_password_auth=force_password_auth)
+ connected = True
+ except x2go.AuthenticationException:
+ force_password_auth = True
+ self.args.password = getpass.getpass()
+ except x2go.PasswordRequiredException:
+ self.args.password = getpass.getpass()
+ except x2go.BadHostKeyException:
+ self.runtime_error('SSH host key verification for remote host [%s]:%s failed' % (self.args.server, self.args.remote_ssh_port), exitcode=-254)
+ except x2go.SSHException, e:
+ self.runtime_error(str(e), exitcode=253)
+
+
+ def MainLoop(self):
+
+ # give the session some time to come up...
+ # no CTRL-C is allowed during this phase...
+ i=0
+ self.logger("give the X2go session some time to come up...", x2go.loglevel_NOTICE, )
+ while i < self.args.time_to_wait:
+ time.sleep(1)
+ i+=1
+
+ if self.session_ok(self.x2go_session_hash):
+
+ profile_name = self.get_profile_name(self.x2go_session_hash)
+ session_name = self.get_session_name(self.x2go_session_hash)
+ self.logger("X2go session is now running, the X2go client's profile name is: %s." % profile_name, x2go.loglevel_INFO, )
+ self.logger("X2go session name is: %s." % session_name, x2go.loglevel_INFO, )
+ self.logger("Press CTRL+C to suspend the running session.", x2go.loglevel_NOTICE, )
+ try:
+
+ session_duration = 0
+ mounted = False
+ while self.session_ok(self.x2go_session_hash):
+ time.sleep(2)
+ session_duration +=2
+
+ if session_duration > 2 and not mounted and self.args.share_local_folders is not None:
+ if self.with_session(self.x2go_session_hash).get_transport().reverse_tunnels['sshfs'][1] is not None:
+ for _folder in self.args.share_local_folders:
+ self.share_local_folder(self.x2go_session_hash, _folder)
+ mounted = True
+
+ # wait a little longer before telling the user what had happened
+ time.sleep(2)
+
+ if self.has_terminated(self.x2go_session_hash):
+ self.logger("X2go session %s has terminated." % session_name, x2go.loglevel_NOTICE, )
+ elif self.is_suspended(self.x2go_session_hash):
+ self.logger("X2go session %s has been suspended." % session_name, x2go.loglevel_NOTICE, )
+ elif self.is_running(self.x2go_session_hash):
+ self.logger("X2go session %s has been moved to a different screen." % session_name, x2go.loglevel_NOTICE, )
-"""\
-STILL UNDOCUMENTED
-"""
+ except KeyboardInterrupt:
+ self.logger("Suspending X2go session %s." % session_name, x2go.loglevel_INFO, )
+ self.suspend_session(self.x2go_session_hash)
+ # giving nxproxy's SSH tunnel some time to settle
+ time.sleep(2)
+ self.logger("X2go session %s has been suspended." % session_name, x2go.loglevel_NOTICE, )
-class ...
diff --git a/pyhoca/cli/x2go b/pyhoca/cli/x2go
index b7003701..6c7076fe 120000
--- a/pyhoca/cli/x2go
+++ b/pyhoca/cli/x2go
@@ -1 +1 @@
-../../../../python/python-x2go/trunk/x2go
\ No newline at end of file
+../../../../python/python-x2go/trunk/x2go/
\ No newline at end of file
diff --git a/setup.py b/setup.py
index a257db18..3ba5fe43 100755
--- a/setup.py
+++ b/setup.py
@@ -22,13 +22,14 @@ from setuptools import setup, find_packages
import pyhoca.cli
setup(
- name = "pyhoca-cli",
+ name = "PyHoca CLI",
version = pyhoca.cli.__VERSION__,
description = "PyHoca CLI is a cross-platform (Windows, MacOS X, Linux) X2go client for the command line.",
license = 'GPL',
author = 'Mike Gabriel',
url = 'http://www.x2go.org',
- packages = find_packages('.'),
+ packages = [ 'pyhoca.cli', ],
package_dir = {'': '.'},
- install_requires = ['setuptools', ]
+ exclude = [ 'pyhoca.cli.x2go', ],
+ install_requires = [ 'setuptools', ]
)
diff --git a/x2go b/x2go
index 3e762901..74dfe276 120000
--- a/x2go
+++ b/x2go
@@ -1 +1 @@
-../../python/python-x2go/trunk/x2go
\ No newline at end of file
+../../python/python-x2go/trunk/x2go/
\ No newline at end of file
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list