[X2go-Commits] pyhoca-cli.git - build-main (branch) updated: 0.1.3.3-6-g7d859c5

X2go dev team git-admin at x2go.org
Fri Jun 24 17:11:09 CEST 2011


The branch, build-main has been updated
       via  7d859c5a132df3f94245ccafad69406e1e662080 (commit)
       via  976a7bf469b52fa3c710df05afa963468f653036 (commit)
       via  094def207ad62d51d01ed58b8fc0813cf750a9f1 (commit)
      from  b28599992f16ed7fdd4da1fbd3653dff450dc0be (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:
 .build_man2html/html/{ => man1}/pyhoca-cli.1.html |    6 +-
 Makefile.man2html                                 |   19 +++--
 debian/changelog                                  |    9 ++
 debian/control                                    |    2 +-
 debian/pyhoca-cli.manpages                        |    2 +-
 man/{ => man1}/pyhoca-cli.1                       |    8 ++
 pyhoca-cli                                        |   11 ++-
 pyhoca/cli/frontend.py                            |  100 +++++++++++++++------
 8 files changed, 111 insertions(+), 46 deletions(-)
 rename .build_man2html/html/{ => man1}/pyhoca-cli.1.html (98%)
 rename man/{ => man1}/pyhoca-cli.1 (94%)

The diff of changes is:
diff --git a/.build_man2html/html/pyhoca-cli.1.html b/.build_man2html/html/man1/pyhoca-cli.1.html
similarity index 98%
rename from .build_man2html/html/pyhoca-cli.1.html
rename to .build_man2html/html/man1/pyhoca-cli.1.html
index a79ce10..c2ae09c 100644
--- a/.build_man2html/html/pyhoca-cli.1.html
+++ b/.build_man2html/html/man1/pyhoca-cli.1.html
@@ -4,7 +4,7 @@ Content-type: text/html
 <HTML><HEAD><TITLE>Man page of pyhoca-cli</TITLE>
 </HEAD><BODY>
 <H1>pyhoca-cli</H1>
-Section: X2go Application (1)<BR>Updated: 21 May 2011<BR><A HREF="#index">Index</A>
+Section: X2go Application (1)<BR>Updated: 26 May 2011<BR><A HREF="#index">Index</A>
 <A HREF="../index.html">Return to Main Contents</A><HR>
 
 <A NAME="lbAB"> </A>
@@ -88,7 +88,7 @@ List user's X2go sessions on server.
 
 <DL COMPACT>
 <DT><B>-P, --session-profile</B><DD>
-The name of the session profile to be used to make the connection.
+The name of the session profile to be used to make the connection.B
 <DT><B>-c, --command</B> <I><CMD></I> <DD>
 Command to run with <B>--new</B> mode on server (default: xterm).
 <DT><B>-u, --username</B> <I><USERNAME></I> <DD>
@@ -208,6 +208,6 @@ Mike Gabriel <<A HREF="mailto:mike.gabriel at das-netzwerkteam.de">mike.gabriel@
 This document was created by
 <A HREF="/cgi-bin/man/man2html">man2html</A>,
 using the manual pages.<BR>
-Time: 09:53:50 GMT, May 26, 2011
+Time: 09:14:04 GMT, May 30, 2011
 </BODY>
 </HTML>
diff --git a/Makefile.man2html b/Makefile.man2html
index 8f7798b..0b9f91d 100644
--- a/Makefile.man2html
+++ b/Makefile.man2html
@@ -1,13 +1,16 @@
 #!/usr/bin/make -f
 
-man_pages = pyhoca-cli.1
+MAN2HTML_BIN = man2html
+MAN2HTML_SRC   = man
+MAN2HTML_DEST = .build_man2html/html
 
-MAN2HTML = man2html
-SRC   = man
-DEST = .build_man2html/html
+man_pages = `cd $(MAN2HTML_SRC) && find * -type f`
 
-all: $(man_pages)
+all: build
 
-pyhoca-cli.1:
-	mkdir -p $(DEST)
-	$(MAN2HTML) -r $(SRC)/$@ > $(DEST)/$@.html
+build: build_man2html
+
+build_man2html:
+	mkdir -p $(MAN2HTML_DEST)
+	for man_page in $(man_pages); do mkdir -p `dirname $(MAN2HTML_DEST)/$$man_page`; done
+	for man_page in $(man_pages); do $(MAN2HTML_BIN) -r $(MAN2HTML_SRC)/$$man_page > $(MAN2HTML_DEST)/$$man_page.html; done
diff --git a/debian/changelog b/debian/changelog
index 53f20b3..af0b49d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+pyhoca-cli (0.1.4.0-0~x2go4) UNRELEASED; urgency=low
+
+  * New upstream version (0.1.4.0):
+    - Add X2go desktop sharing support.
+    - Terminate shared desktop sessions of Ctrl-C (instead of 
+      suspending them.
+
+ -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 24 Jun 2011 17:08:12 +0200
+
 pyhoca-cli (0.1.3.3-0~x2go2) unstable; urgency=low
 
   * fixes build-sequence
diff --git a/debian/control b/debian/control
index c646d66..4b28217 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Architecture: all
 Depends: 
  ${misc:Depends},
  python,
- python-x2go (>=0.1.0.0-0~0),
+ python-x2go (>=0.1.1.0-0~0),
  python-argparse,
  python-setproctitle
 Description: A command line X2go client written in Python
diff --git a/debian/pyhoca-cli.manpages b/debian/pyhoca-cli.manpages
index 6a255bf..2ff1bd1 100644
--- a/debian/pyhoca-cli.manpages
+++ b/debian/pyhoca-cli.manpages
@@ -1 +1 @@
-man/pyhoca-cli.1
\ No newline at end of file
+man/man1/pyhoca-cli.1
\ No newline at end of file
diff --git a/man/pyhoca-cli.1 b/man/man1/pyhoca-cli.1
similarity index 94%
rename from man/pyhoca-cli.1
rename to man/man1/pyhoca-cli.1
index 10a2161..ef69c0f 100644
--- a/man/pyhoca-cli.1
+++ b/man/man1/pyhoca-cli.1
@@ -64,6 +64,11 @@ Start a new X2go session on server (default mode if no mode is explicitly specif
 \*(T<\fB\-R, \-\-resume\fR \fI<SESSION_NAME>\fR\*(T> 
 Resume existing X2go session <SESSION_NAME> on server.
 .TP 
+\*(T<\fB\-D, \-\-share-desktop\fR \fI<USER>@<DISPLAY>\fR\*(T>
+Share an X2go session on the remote server specified by <USER>@<DISPLAY>,
+whereas <USER> can be the same user that is starting the share mode session or any
+other user that grants X2go desktop sharing for the current user.
+.TP 
 \*(T<\fB\-S, \-\-suspend\fR \fI<SESSION_NAME>\fR\*(T> 
 Suspend running X2go session <SESSION_NAME>.
 .TP 
@@ -106,6 +111,9 @@ A comma separated list of local folders that shall be made available in the remo
 \*(T<\fB\-\-printing\fR\*(T> 
 Use X2go printing (default: disabled).
 .TP 
+\*(T<\fB\-\-share-mode\fR \fI{0|1}\fR\*(T> 
+Share mode for X2go desktop sharing (0: view-only, 1: full access).
+.TP
 \*(T<\fB\-\-clean-sessions\fR\*(T> 
 Clean all of the user's suspended/running sessions before starting a new one on the named X2go server.
 .TP 
diff --git a/pyhoca-cli b/pyhoca-cli
index 394a118..9838a98 100755
--- a/pyhoca-cli
+++ b/pyhoca-cli
@@ -92,9 +92,11 @@ liblogger = x2go.X2goLogger()
 action_options =   [ 
                    {'args':['-N','--new'], 'default': False, 'action': 'store_true', 'help': 'start a new X2go session on server (default)', },
                    {'args':['-R','--resume'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'resume a suspended X2go session with name SESSION_NAME', },
+                   {'args':['-D','--share-desktop'], 'default': None, 'metavar': 'USER at DISPLAY', 'help': 'share an X2go session on server specified by USER at DISPLAY', },
                    {'args':['-S','--suspend'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'suspend running X2go session SESSION_NAME', },
                    {'args':['-T','--terminate'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'terminate running X2go session SESSION_NAME', },
                    {'args':['-L','--list-sessions'], 'default': False, 'action': 'store_true', 'help': 'list user\'s X2go sessions on server', },
+                   {'args':['--list-desktops'], 'default': False, 'action': 'store_true', 'help': 'list X2go desktop sessions that are available for sharing', },
                    {'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', },
                  ]
@@ -116,6 +118,7 @@ x2go_options =   [
                    {'args':['--add-to-known-hosts'], 'default': False, 'action': 'store_true', 'help': 'add RSA host key fingerprint to ~/.ssh/known_hosts if authenticity of server can\'t be established (default: not set)', },
                    {'args':['--sound'], 'default': 'pulse', 'choices': ('pulse', 'esd', 'none'), 'help': 'X2go server sound system (default: \'pulse\')', },
                    {'args':['--printing'], 'default': False, 'action': 'store_true', 'help': 'use X2go printing (default: disabled)', },
+                   {'args':['--share-mode'], 'default': 0, 'help': 'share mode for X2go desktop sharing (0: view-only, 1: full access)', },
                    {'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':['--time-to-wait'], 'default': '8', 'help': 'time to wait for session startup/resume (default: 8s)', },
@@ -217,9 +220,9 @@ Possible values for the --pack NX option are:
             runtime_error ("argument --server 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
-        if bool(a.new) + bool(a.resume) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) > 1:
-            runtime_error ("modes --new, --resume, --suspend, --terminate and --list-sessions are mutually exclusive", parser=p, exitcode=2)
-        if bool(a.new) + bool(a.resume) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) == 0:
+        if bool(a.new) + bool(a.resume) + bool(a.share_desktop) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) + bool(a.list_desktops) + bool(a.list_profiles)> 1:
+            runtime_error ("modes --new, --resume, --share-desktop, --suspend, --terminate, --list-sessions, --list-desktops and --list-profiles are mutually exclusive", parser=p, exitcode=2)
+        if bool(a.new) + bool(a.resume) + bool(a.share_desktop) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) + bool(a.list_desktops) +  bool(a.list_profiles) == 0:
             a.new = True
 
         # check if pack method is available
@@ -227,7 +230,7 @@ Possible values for the --pack NX option are:
             runtime_error("unknown pack method '%s'" % args.pack, parser=p, exitcode=10)
 
     else:
-        if not (a.resume or a.suspend or a.terminate or a.list_sessions or a.list_profiles):
+        if not (a.resume or a.share_desktop or a.suspend or a.terminate or a.list_sessions or a.list_desktops or a.list_profiles):
             a.new = True
 
     # X2go printing
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index af9a894..8b58146 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -86,27 +86,48 @@ class PyHocaCLI(x2go.X2goClient):
         print "Username: %s" % self._X2goClient__get_session_username(s_hash)
         print 
         session_infos = self._X2goClient__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
+        if session_infos:
+            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
         else:
             print "No running/suspended sessions found on X2go server."
             print
 
+    def list_desktops(self, s_hash):
+        """\
+        STILL UNDOCUMENTED
+        """
+        # retrieve a desktop list
+        print
+        print "X2go desktops available for sharing"
+        print "==================================="
+        _peername = self._X2goClient__get_session_server_peername(s_hash)
+        print "Host: %s - [%s]:%s" % (self._X2goClient__get_session_server_hostname(s_hash), _peername[0], _peername[1])
+        print "Username: %s" % self._X2goClient__get_session_username(s_hash)
+        print 
+        desktop_list = self._X2goClient__list_desktops(s_hash)
+        if desktop_list:
+            for desktop_name in desktop_list:
+                print desktop_name
+        else:
+            print "No X2go desktop sessions found that are available for desktop sharing."
+            print
+
     def list_profiles(self):
         # retrieve a session list
         print
@@ -133,7 +154,6 @@ class PyHocaCLI(x2go.X2goClient):
         self.logger('cleaning up all running sessions from X2go server: %s' % _server, loglevel=x2go.loglevel_NOTICE, )
         self._X2goClient__clean_sessions(s_hash)
 
-
     def new_session(self, s_hash):
         """\
         STILL UNDOCUMENTED
@@ -146,7 +166,6 @@ class PyHocaCLI(x2go.X2goClient):
             self.logger('command from session profile to run is: %s' % self.session_registry(self.x2go_session_hash).get_session_cmd(), loglevel=x2go.loglevel_DEBUG, )
         self._X2goClient__start_session(s_hash)
 
-
     def resume_session(self, s_hash):
         """\
         STILL UNDOCUMENTED
@@ -159,6 +178,19 @@ class PyHocaCLI(x2go.X2goClient):
         else:
             self._runtime_error('requested session not available on X2go server [%s]:%s' % (self.args.server, self.args.remote_ssh_port), exitcode=20)
 
+    def share_desktop_session(self, s_hash):
+        """\
+        STILL UNDOCUMENTED
+        """
+        # start a new session and run a command
+        _desktop = self.args.share_desktop
+        _share_mode = self.args.share_mode
+        self.logger('sharing X2go session: %s' % _desktop, loglevel=x2go.loglevel_INFO, )
+        try:
+            self._X2goClient__share_desktop_session(s_hash, desktop=_desktop, share_mode=_share_mode)
+        except x2go.X2goDesktopSharingException, e:
+            self._runtime_error('%s' % str(e), exitcode=54)
+
 
     def suspend_session(self, s_hash):
         """\
@@ -172,7 +204,6 @@ class PyHocaCLI(x2go.X2goClient):
         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):
         """\
         STILL UNDOCUMENTED
@@ -185,7 +216,6 @@ class PyHocaCLI(x2go.X2goClient):
         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):
         """\
         STILL UNDOCUMENTED
@@ -245,7 +275,6 @@ class PyHocaCLI(x2go.X2goClient):
                                                            share_local_folders=self.args.share_local_folders,
                                                            cmd=self.args.command)
 
-
     def authenticate(self):
         """\
         STILL UNDOCUMENTED
@@ -289,7 +318,6 @@ class PyHocaCLI(x2go.X2goClient):
         except socket.error, e:
             self._runtime_error('a socket error occured while establishing the connection: %s' % str(e), exitcode=-245)
 
-
     def MainLoop(self):
         """\
         STILL UNDOCUMENTED
@@ -306,6 +334,11 @@ class PyHocaCLI(x2go.X2goClient):
                 self.list_sessions(self.x2go_session_hash)
                 sys.exit(0)
 
+            if self.args.list_desktops:
+                # print a beautified desktop list for the user
+                self.list_desktops(self.x2go_session_hash)
+                sys.exit(0)
+
             if self.args.list_profiles:
                 # print a beautified profile list for the user
                 self.list_profiles()
@@ -314,6 +347,9 @@ class PyHocaCLI(x2go.X2goClient):
             if self.args.resume:
                 self.resume_session(self.x2go_session_hash)
 
+            if self.args.share_desktop:
+                self.share_desktop_session(self.x2go_session_hash)
+
             elif self.args.suspend:
                 self.suspend_session(self.x2go_session_hash)
 
@@ -324,7 +360,7 @@ class PyHocaCLI(x2go.X2goClient):
                 self.new_session(self.x2go_session_hash)
 
             # finally call the MainLoop of PyHocaCLI
-            if not (self.args.new or self.args.resume or self.args.session_profile):
+            if not (self.args.new or self.args.resume or self.args.share_desktop or self.args.session_profile):
                 sys.exit(0)
 
             # give the session some time to come up...
@@ -362,11 +398,17 @@ class PyHocaCLI(x2go.X2goClient):
                         self._pyhoca_logger("X2go session %s has been moved to a different screen" % session_name, loglevel=x2go.loglevel_NOTICE, )
 
                 except KeyboardInterrupt:
-                    self._pyhoca_logger("Suspending X2go session %s" % session_name, loglevel=x2go.loglevel_INFO, )
-                    self._X2goClient__suspend_session(self.x2go_session_hash)
-                    # giving nxproxy's SSH tunnel some time to settle
-                    time.sleep(2)
-                    self._pyhoca_logger("X2go session %s has been suspended" % session_name, loglevel=x2go.loglevel_NOTICE, )
+                    if self.args.share_desktop:
+                        self._pyhoca_logger("Terminating X2go shared desktop session %s" % session_name, loglevel=x2go.loglevel_INFO, )
+                        self._X2goClient__terminate_session(self.x2go_session_hash)
+                        time.sleep(2)
+                        self._pyhoca_logger("X2go session %s has been terminated" % session_name, loglevel=x2go.loglevel_NOTICE, )
+                    else:
+                        self._pyhoca_logger("Suspending X2go session %s" % session_name, loglevel=x2go.loglevel_INFO, )
+                        self._X2goClient__suspend_session(self.x2go_session_hash)
+                        # giving nxproxy's SSH tunnel some time to settle
+                        time.sleep(2)
+                        self._pyhoca_logger("X2go session %s has been suspended" % session_name, loglevel=x2go.loglevel_NOTICE, )
 
         except x2go.X2goSessionException, e:
             self._pyhoca_logger("X2goSessionException occured:", loglevel=x2go.loglevel_ERROR)


hooks/post-receive
-- 
pyhoca-cli.git (Python X2go Client (command line client))

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 "pyhoca-cli.git" (Python X2go Client (command line client)).




More information about the x2go-commits mailing list