Author: duncan
Date: Thu Feb 21 16:50:31 2008
New Revision: 10416

Log:
Consolidated differencies between rel-1 and rel-1-7


Modified:
   branches/rel-1-7/freevo/freevo
   branches/rel-1/freevo/freevo

Modified: branches/rel-1-7/freevo/freevo
==============================================================================
--- branches/rel-1-7/freevo/freevo      (original)
+++ branches/rel-1-7/freevo/freevo      Thu Feb 21 16:50:31 2008
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
-# vim:tabstop=4:softtabstop=4:shiftwidth=4:expandtab:filetype=python:
 # -*- coding: iso-8859-1 -*-
+# vim:tabstop=4:softtabstop=4:shiftwidth=4:expandtab:filetype=python:
 # -----------------------------------------------------------------------
 # freevo - the main entry point to the whole suite of applications
 # -----------------------------------------------------------------------
@@ -38,7 +38,6 @@
 from signal import *
 
 
-debug = 0
 cmdfile = None
 def _debug_(message, level=1):
     global debug
@@ -67,8 +66,9 @@
 freevo [ script | options]
 options:
   -fs            start freevo in a new x session in full-screen
-  -doc           create api documentation (for developers)
-  -trace         activate full trace (useful for debugging)
+  --doc          create api documentation (for developers)
+  --trace        activate full trace (useful for debugging)
+  --profile      activate cProfile and write stats to /tmp
   setup          run freevo setup to scan your environment
   start          start freevo as daemon in background
   stop           stop the current freevo process
@@ -85,7 +85,7 @@
 script you want to execute. E.g. put a link imdb pointing to freevo
 in your path to access the imdb helper script
 
-Example: ln -s path-to-freevo imdb
+Example: ln -s /path/to/freevo imdb
          imdb --help
 
 Before running freevo the first time, you need to run \'freevo setup\'
@@ -99,15 +99,15 @@
     get the newest version of python [ with freevo installed ]
     """
     _debug_('version=%r' % (sys.version)) 
-    if float(sys.version[0:3]) >= 2.3:
+    if sys.hexversion >= 0x02040000:
         # python seems to be ok
         search = ('python', 'python2')
-    elif float(sys.version[0:3]) >= 2.2:
-        # try python2.3, else take python
-        search = ('python2.3', 'python')
+    elif sys.hexversion >= 0x02030000:
+        # try python2.4, else take python
+        search = ('python2.4', 'python')
     else:
-        # python is too old, try to find python2.3 or python2
-        search = ('python2.3', 'python2')
+        # python is too old, try to find python2.4 or python2
+        search = ('python2.4', 'python2')
 
     for python in search:
         for path in os.environ['PATH'].split(':'):
@@ -277,9 +277,13 @@
 
#--------------------------------------------------------------------------------
 # Main block
 
#--------------------------------------------------------------------------------
-while len(sys.argv) > 1 and sys.argv[1] in ('--debug', '-d'):
+debug = 0
+while '--debug' in sys.argv or '-d' in sys.argv:
     debug += 1
-    sys.argv.pop(1)
+    if '--debug' in sys.argv:
+        sys.argv.remove('--debug')
+    else:
+        sys.argv.remove('-d')
 if debug >= 2:
     cmdfile = open('/tmp/freevo-gdb.sh', 'w')
     print >>cmdfile,'#!/bin/bash'
@@ -321,7 +325,7 @@
         #
         python = get_python(0)
         if not python:
-            print 'Can\'t find python >= 2.3'
+            print 'Can\'t find python >= 2.4'
             sys.exit(0)
         python = [ python ]
         runapp = ''
@@ -381,6 +385,14 @@
 proc  = [ os.path.abspath(os.path.join(freevo_python, 'main.py')) ]
 name  = os.path.splitext(os.path.basename(os.path.abspath(sys.argv[0])))[0]
 check = 1 # check running instance
+profile = 0
+
+if '--profile' in sys.argv or '-p' in sys.argv:
+    profile = 1
+    if '--profile' in sys.argv:
+        sys.argv.remove('--profile')
+    else:
+        sys.argv.remove('-p')
 
 if len(sys.argv) > 1:
     arg = sys.argv[1]
@@ -388,6 +400,7 @@
     arg = ''
 
 # check the args
+
 if arg in ('--help', '-h'):
     # show help
     show_help()
@@ -411,7 +424,7 @@
             break
         server_num += 1
     sys.stdin.close()
-    os.execvp('xinit', [ 'xinit', freevo_script, '-force-fs',  '--', 
':'+str(server_num) ] + sys.argv[2:])
+    os.execvp('xinit', [ 'xinit', freevo_script, '--force-fs',  '--', 
':'+str(server_num) ] + sys.argv[2:])
 
 elif arg == 'execute':
     # execute a python script
@@ -425,6 +438,7 @@
 elif arg == 'prompt':
     # only run python inside the freevo env
     proc = []
+    profile = 0
     check = 0
 
 elif arg == 'runapp':
@@ -450,7 +464,7 @@
         else:
             sys.argv = [ sys.argv[0] ] + sys.argv[2:]
 
-elif arg and name == 'freevo' and not (arg in ['-force-fs', '-trace', '-doc']):
+elif arg and name == 'freevo' and not (arg in ['--force-fs', '--trace', 
'--doc']):
     # ok, don't know about that arg, freevo should be started, but
     # it's also no freevo arg
     print 'unknown command line option: %s' % sys.argv[1:]
@@ -480,4 +494,10 @@
         print 'freevo still running, run \'freevo stop\' to stop'
     sys.exit(0)
 
-start(name, python + proc , bg, check)
+if profile:
+    if sys.hexversion > 0x02050000:
+        python += ['-m', 'cProfile', '-o', '/tmp/%s.stats' % name]
+    else:
+        python += ['-m', 'profile', '-o', '/tmp/%s.stats' % name]
+    
+start(name, python+proc, bg, check)

Modified: branches/rel-1/freevo/freevo
==============================================================================
--- branches/rel-1/freevo/freevo        (original)
+++ branches/rel-1/freevo/freevo        Thu Feb 21 16:50:31 2008
@@ -272,7 +272,6 @@
                 if store and os.path.isfile(f.name):
                     os.unlink(f.name)
     else:
-        #print 'os.execvp(arg[0]=%r, arg=%r)' % (arg[0], arg)
         os.execvp(arg[0], arg)
 
 
#--------------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to