X2Go dev team | 10 Dec 14:53 2012

pyhoca-cli.git - build-main (branch) updated:

The branch, build-main has been updated
       via  5130c68a32059081564bea14d8c497dd83a32918 (commit)
       via  28400324571e4e4dd66974a548a08004ab4a4352 (commit)
       via  ee08a8ebff88830fbe319be357b0ed15707c0865 (commit)
       via  0030b69eeb79b9d7b6aa34e8e0e1f2552a1bfeb6 (commit)
       via  63934b80f7207db2def899451b9f36f71ee02997 (commit)
       via  dd6a9ef228a597ce6e5cb14af2746489675e83f1 (commit)
       via  410289b22b14fbb1ddb97be965406c01e384a86f (commit)
       via  825b50999110441eebcb81782cd79234344ae0c3 (commit)
       via  d8f65485337578f6a0075495b13d9710cb007a1d (commit)
       via  e047a7607e02a2ab9bbcd9c98692e429f20e6910 (commit)
       via  7deba5343c345baf7d347c6c6363e870e45c766d (commit)
       via  fd23c68a8afe2c105fc87a0e0de15431af552dc9 (commit)
       via  be31a062f20be2f8070892ca12695193976d17c5 (commit)
       via  506e2e7cf69dc9bc29e10092e3d29739484b41d0 (commit)
       via  7feaee0c3c7773c1a18189f111e447175cb569a2 (commit)
       via  ec4d9d6b5754539766b92594c4bb21ab8ebcc184 (commit)
       via  03eb8165d43acb4e1bbf56594d8179e7b563b4de (commit)
       via  49aa9fef7e76a274a62bdbc801244ba875565532 (commit)
       via  84999ab5f157d234b1854aa8b7f3ca13bdbcd9cb (commit)
       via  83a392d159e4f817b3977ae274a80489e8d5b50b (commit)
       via  f1fa7df429bbd37e146b36f688ad32dc0a16889d (commit)
       via  6aae7a97b952b6211d8993cea97ec05564cff287 (commit)
      from  0bea1484b609f45b77cae90dafd096525e2dbcbe (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 -----------------------------------------------------------------
commit 5130c68a32059081564bea14d8c497dd83a32918
Author: Mike Gabriel <mike.gabriel@...>
Date:   Mon Dec 10 14:52:10 2012 +0100



Summary of changes:
 debian/changelog       |   22 ++++++++++++++++++++++
 debian/control         |    8 ++++----
 debian/rules           |    4 ++--
 man/man1/pyhoca-cli.1  |   24 ++++++++++++++++--------
 pyhoca-cli             |   28 +++++++++++++++++++---------
 pyhoca/cli/__init__.py |    2 +-
 pyhoca/cli/frontend.py |   24 ++++++++++++++----------
 7 files changed, 78 insertions(+), 34 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index a076235..7521d2c 100644
--- a/debian/changelog
+++ b/debian/changelog
 <at>  <at>  -1,3 +1,25  <at>  <at> 
+pyhoca-cli ( unstable; urgency=low
+  * New upstream version (
+    - Add cmdline option --from-stdin that facilitates lightdm remote login
+      session startup.
+    - The option ,,password'' is not allowed for session registration.
+    - When finishing the application, update session status before reporting
+      back to the user what happened to the session.
+    - Remove cmdline option --time-to-wait, Python X2Go now offers a progress
+      status for session startup/resumption. So we query this status instead.
+  * /debian/control:
+    + Maintainer change in package: X2Go Developers <x2go-dev@...>.
+    + Reduce python version in Build-Depends to allow build on Ubuntu 10.04.
+    + Depend on python-x2go (>=
+  * /debian/rules:
+    + Allow package build on systems with missing dh_python2.
+  * /man/man1/pyhoca-cli.1:
+    + Mention keyboard auto detection switch.
+    + Mention possible geometry value: maximize.
+ -- Mike Gabriel <mike.gabriel@...>  Mon, 10 Dec
2012 14:51:11 +0100
 pyhoca-cli ( unstable; urgency=low

   * New upstream version (
diff --git a/debian/control b/debian/control
index ce61f60..dfcb0f1 100644
--- a/debian/control
+++ b/debian/control
 <at>  <at>  -1,13 +1,13  <at>  <at> 
 Source: pyhoca-cli
 Section: python
 Priority: optional
-Maintainer: X2Go Packaging Team <pkg-x2go-devel@...>
+Maintainer: X2Go Developers <x2go-dev@...>
  Mike Gabriel <mike.gabriel@...>
  debhelper (>= 7.0.50~),
  man2html-base | man2html,
- python (>=2.6.6-3~),
+ python (>=2.6.5-0~),
 Standards-Version: 3.9.3
 <at>  <at>  -21,14 +21,14  <at>  <at>  Architecture: all
- python-x2go (>=,
+ python-x2go (>=,
  python-support (>=0.90)
 Description: Command line X2Go client written in Python
  X2Go is a server based computing environment with
     - session resuming
-    - low bandwith support
+    - low bandwidth support
     - LDAP support
     - client side mass storage mounting support
     - client side printing support
diff --git a/debian/rules b/debian/rules
index 8f217cb..c8ce66b 100755
--- a/debian/rules
+++ b/debian/rules
 <at>  <at>  -3,10 +3,10  <at>  <at> 
 # Based on sample debian/rules file - for GNU Hello (1.3).
 # Copyright 2010-2012 by Mike Gabriel <mike.gabriel@...>

-PYVERS=$(shell pyversions -vr)
+WITH_PYTHON2 = $(shell test -f /usr/bin/dh_python2 && echo "--with python2")

-	dh ${ <at> } --with python2
+	dh ${ <at> } ${WITH_PYTHON2}

 	rm -Rf PyHoca_CLI.egg-info/
diff --git a/man/man1/pyhoca-cli.1 b/man/man1/pyhoca-cli.1
index 0407536..d88b486 100644
--- a/man/man1/pyhoca-cli.1
+++ b/man/man1/pyhoca-cli.1
 <at>  <at>  -5,7 +5,7  <at>  <at> 
 \\$2 \(la\\$1\(ra\\$3
 .if \n(.g .mso www.tmac
-.TH pyhoca-cli 1 "Apr 2012" "Version 0.1.4.x" "X2Go Application"
+.TH pyhoca-cli 1 "Nov 2012" "Version 0.2.1.x" "X2Go Application"
 pyhoca-cli \- X2Go command line client written in Python
 <at>  <at>  -85,8 +85,19  <at>  <at>  Suspend running X2Go session <SESSION_NAME>. A special value for <SESSION_NAME>
 \*(T<\fB\-T, \-\-terminate\fR \fI<SESSION_NAME>\fR\*(T> 
 Terminate running X2Go session <SESSION_NAME>. A special value for <SESSION_NAME> is ,,ALL'' (will
terminate all sessions of the connected user).
-\*(T<\fB\-L, \-\-list-sessions\fR\*(T> 
+\*(T<\fB\-L, \-\-list-sessions\fR\*(T>
 List user's X2Go sessions on server.
+For LightDM remote login integration: read <username> <password> <host[:port]> <desktopshell> from
STDIN' and start a new session, transfer
+a running session or resume a suspended session.
+If there are several sessions running/suspended of the same desktop shell, then the first
+session found will be transferred/resumed. If there are several sessions running with a different
desktop shell as session type (or even
+rootless sessions) none of these session will be touched unless any of the discovered sessions match in
the requested desktop shell (i.e.
+X2Go session type).
+This option is only available for the Linux version of \fBpyhoca-cli\fR.
 \fBpyhoca-cli\fR actions can be tweaked by these options:
 <at>  <at>  -129,9 +140,6  <at>  <at>  Use X2Go printing (default: disabled).
 \*(T<\fB\-\-share-mode\fR \fI{0|1}\fR\*(T> 
 Share mode for X2Go desktop sharing (0: view-only, 1: full access).
-Time to wait for session startup/resume (default: 8s). There should be no need to touch this, unless on
very slow network connections.
 \*(T<\fB\-\-auth-attempts\fR \fI{0,1,2,3,...}\fR\*(T> 
 Number of interactive authentication attempts in case authentication with the server fails (wrong
password?). A value that equals 0
 disables interactive authentication completely and requires that a private SSH key has been given on the
command line or in the
 <at>  <at>  -141,7 +149,7  <at>  <at>  LDAP support is planned to be added into \fBpyhoca-cli\fR in the near future. So
 .SH NX OPTIONS (Version 3) 
-\*(T<\fB\-g, \-\-geometry\fR \fI{<WIDTH>x<HEIGHT>|fullscreen}\fR\*(T> 
+\*(T<\fB\-g, \-\-geometry\fR \fI{<WIDTH>x<HEIGHT>|fullscreen|maximize}\fR\*(T> 
 Screen geometry (default: '800x600').
 \*(T<\fB\-q, \-\-link\fR \fI{modem|isdn|adsl|wan|lan}\fR\*(T> 
 <at>  <at>  -158,8 +166,8  <at>  <at>  Compression method (see below for possible values).
 \*(T<\fB\-\-kbd\-layout\fR \fI{us|de|fr|...}\fR\*(T>
 Use keyboard layout (default: 'us').
-\*(T<\fB\-\-kbd\-type\fR \fI{pc105/us|pc105/de|...}\fR\*(T>
-Set Keyboard type (default 'pc105/us').
+\*(T<\fB\-\-kbd\-type\fR \fI{auto|pc105/us|pc105/de|...}\fR\*(T>
+Set Keyboard type (default 'pc105/us'). Use \fIauto\fR as value here to enable X2Go's keyboard
auto-detection code.
 \fBpyhoca-cli\fR aims at being fully compatible with all command line options and session config files of
the X2Go project's X2Go command
 line client \fBx2goclient-cli\fR as well as the \fBx2goclient\fR GUI. This is still work in progress. 
diff --git a/pyhoca-cli b/pyhoca-cli
index fcd02fb..4e48dee 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
 <at>  <at>  -71,7 +71,7  <at>  <at>  if hasattr(sys, 'frozen') and sys.frozen in ("windows_exe", "console_exe"):

 app = sys.argv[0]
 if app.startswith('./'):
-    sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
+    sys.path.insert(0, os.getcwd())
     os.environ['PYTHONX2GO_LOCAL'] = '1'

 PROG_OPTIONS = sys.argv[1:]
 <at>  <at>  -137,6 +137,11  <at>  <at>  action_options =   [
                    {'args':['-l','--list-profiles'], 'default': False, 'action': 'store_true', 'help': 'list user\'s
X2Go pre-configured session profiles', },
                    {'args':['-P','--session-profile'], 'default': None, 'help': 'load x2goclient session profiles and
use the session profile SESSION_PROFILE', },
+if _X2GOCLIENT_OS == "Linux":
+    action_options.append(
+                   {'args':['--from-stdin'], 'default': False, 'action': 'store_true', 'help': 'for LightDM remote
login: read <username> <password> <host[:port]> <desktopshell> from STDIN', },
+    )
 # debug options...
 debug_options =  [ 
                    {'args':['-d','--debug'], 'default': False, 'action': 'store_true', 'help': 'enable application
debugging code', },
 <at>  <at>  -160,7 +165,6  <at>  <at>  x2go_options =   [
                    {'args':['-F', '--share-local-folders'], 'metavar': '<folder1>[,<folder2[,...]]', 'default':
None, 'help': 'a comma separated list of local folder names to mount in the X2Go session', },
                    {'args':['--clean-sessions'], 'default': False, 'action': 'store_true', 'help': 'clean all
suspended sessions before starting a new one', },
                    {'args':['--terminate-on-ctrl-c'], 'default': False, 'action': 'store_true', 'help': 'terminate
the connected session when pressing CTRL+C (instead of suspending the session)', },
-                   {'args':['--time-to-wait'], 'default': '8', 'help': 'time to wait for session startup/resume
(default: 8s)', },
                    {'args':['--auth-attempts'], 'default': 3, 'help': 'number of authentication attempts before
authentication fails (default: 3)', },
 print_options =  [ 
 <at>  <at>  -251,16 +255,10  <at>  <at>  Possible values for the --pack NX option are:
     if a.username is None and not a.session_profile:
         a.username = current_user

-    # time-to-wait needs to be an integer
-    try:
-        a.time_to_wait = int(a.time_to_wait)
-    except ValueError:
-        runtime_error("--time_to_wait value needs to be an integer value", parser=p, exitcode=80)
     if not (a.session_profile or a.list_profiles):

         # the --server (or --session-profile) option is required for most operations
-        if not a.server:
+        if not a.server and not a.from_stdin:
             runtime_error ("argument --server (or --session-profile) is required", parser=p, exitcode=1)

         # check for mutual exclusiveness of -N, -R, -S, -T and -L, -N is default if none of them is set
 <at>  <at>  -365,6 +363,18  <at>  <at>  Possible values for the --pack NX option are:
     if not a.ssh_privkey and os.path.isfile('%s/.ssh/id_dsa' % current_home):
         a.ssh_privkey = '%s/.ssh/id_dsa' % current_home

+    # lightdm remote login magic takes place here
+    if a.from_stdin:
+        lightdm_remote_login_buffer = sys.stdin.readline()
+        (a.username, a.server, a.command) = lightdm_remote_login_buffer.split()[0:3]
+        a.password = " ".join(lightdm_remote_login_buffer.split()[3:])
+        if ":" in a.server:
+            a.remote_ssh_port = a.server.split(':')[-1]
+            a.server = ':'.join(a.server.split(':')[:-1])
+        a.command = a.command.upper()
+        a.geometry = 'fullscreen'
     return p, a

diff --git a/pyhoca/cli/__init__.py b/pyhoca/cli/__init__.py
index 428dbc9..dcc9c61 100644
--- a/pyhoca/cli/__init__.py
+++ b/pyhoca/cli/__init__.py
 <at>  <at>  -25,6 +25,6  <at>  <at>  For further information on X2Go, please visit the X2Go wiki:

-__VERSION__ = ""
+__VERSION__ = ""

 from frontend import *
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index 7636399..d1fc341 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
 <at>  <at>  -71,11 +71,9  <at>  <at>  class PyHocaCLI(x2go.X2goClient):
     x2go_session_hash = None

     def _runtime_error(self, m, exitcode=-1):
         runtime_error(m, exitcode=exitcode)

     def list_sessions(self, s_hash):
         List up server-side available sessions for the logged in user.
 <at>  <at>  -377,7 +375,6  <at>  <at>  class PyHocaCLI(x2go.X2goClient):
             self.x2go_session_hash = self._X2goClient__register_session(args.server,
-                                                           password=self.args.password,
                                                            profile_name = 'Pyhoca-Client_Session',
 <at>  <at>  -492,7 +489,7  <at>  <at>  class PyHocaCLI(x2go.X2goClient):
                 self._pyhoca_logger("give the X2Go session some time to come up...", loglevel=x2go.loglevel_NOTICE, )

-            while i < self.args.time_to_wait:
+            while 0 < self.get_session(self.x2go_session_hash).get_progress_status() < 100:

 <at>  <at>  -502,12 +499,15  <at>  <at>  class PyHocaCLI(x2go.X2goClient):
                 session_name = self._X2goClient__get_session_name(self.x2go_session_hash)
                 self._pyhoca_logger("X2Go session is now running, the X2Go client's profile name is: %s" %
profile_name, loglevel=x2go.loglevel_INFO, )
                 self._pyhoca_logger("X2Go session name is: %s" % session_name, loglevel=x2go.loglevel_INFO, )
-                if self.args.share_desktop:
-                    self._pyhoca_logger("Press CTRL+C to end desktop sharing for this session...",
loglevel=x2go.loglevel_NOTICE, )
-                elif self.args.terminate_on_ctrl_c:
-                    self._pyhoca_logger("Press CTRL+C to terminate the running session...",
loglevel=x2go.loglevel_NOTICE, )
-                else:
-                    self._pyhoca_logger("Press CTRL+C to suspend the running session...",
loglevel=x2go.loglevel_NOTICE, )
+                if not self.args.from_stdin:
+                    if self.args.share_desktop:
+                        self._pyhoca_logger("Press CTRL+C to end desktop sharing for this session...",
loglevel=x2go.loglevel_NOTICE, )
+                    elif self.args.terminate_on_ctrl_c:
+                        self._pyhoca_logger("Press CTRL+C to terminate the running session...",
loglevel=x2go.loglevel_NOTICE, )
+                    else:
+                        self._pyhoca_logger("Press CTRL+C to suspend the running session...",
loglevel=x2go.loglevel_NOTICE, )


 <at>  <at>  -521,6 +521,10  <at>  <at>  class PyHocaCLI(x2go.X2goClient):
                     # wait a little while before telling the user what has happened

+                    # refresh session status so we can be most accurate on what we report below
+                    self._X2goClient__list_sessions(self.x2go_session_hash)
+                    # report about the session status once we get here...
                     if self._X2goClient__has_session_terminated(self.x2go_session_hash):
                         self._pyhoca_logger("X2Go session %s has terminated" % session_name,
loglevel=x2go.loglevel_NOTICE, )
                     elif self._X2goClient__is_session_suspended(self.x2go_session_hash):