Author: wade
Date: 2007-05-31 19:46:24 -0400 (Thu, 31 May 2007)
New Revision: 78385

Modified:
   trunk/release/pyutils/buildenv.py
   trunk/release/pyutils/tests/test_remote_code.py
Log:
use the shell that's been configured for the environment
(usually bash, but definitely not 'sh')



Modified: trunk/release/pyutils/buildenv.py
===================================================================
--- trunk/release/pyutils/buildenv.py   2007-05-31 23:45:17 UTC (rev 78384)
+++ trunk/release/pyutils/buildenv.py   2007-05-31 23:46:24 UTC (rev 78385)
@@ -150,9 +150,13 @@
 
                return self.modes[mode].execute_command(command, logger=logger)
 
-       def execute_code(self, code, working_dir="", interpreter='sh', 
exec_as_root=False, output_timeout=0, max_output_size=0, terminate_reg="", 
env={}, logger=""):
+       def execute_code(self, code, working_dir="", interpreter="", 
exec_as_root=False, output_timeout=0, max_output_size=0, terminate_reg="", 
env={}, logger=""):
                """ interpreter can be anything that works... mcs *.cs; mono, 
perl, python, etc... """
 
+               # Default to shell code, but can be overwritten
+               if not interpreter:
+                       interpreter = self.env['shell_path']
+
                # get code as a string if a file was passed in
                if os.path.isfile(code):
                        fd = open(code)

Modified: trunk/release/pyutils/tests/test_remote_code.py
===================================================================
--- trunk/release/pyutils/tests/test_remote_code.py     2007-05-31 23:45:17 UTC 
(rev 78384)
+++ trunk/release/pyutils/tests/test_remote_code.py     2007-05-31 23:46:24 UTC 
(rev 78385)
@@ -7,13 +7,23 @@
 
 import packaging
 
-conf = packaging.buildconf('suse-102-x86_64')
+conf = packaging.buildconf('sunos-8-sparc')
 
-code = """
+shell_code = """
 for i in `ls /tmp` ; do echo $i ; echo "manual" ; done
+
+if [ "test" == "test2" ] ; then
+       echo "no match!"
+fi
+
+if [ "test2" == "test2" ] ; then
+       echo "match!"
+fi
+
+
 """
 
-code = """
+python_code = """
 
 import os
 
@@ -24,14 +34,14 @@
 
 os.system('ls')
 os.system('hostname')
+os.system('ls')
        
 """
 
-#code = 'test.sh'
-
 env = {}
 env['test'] = 'tes t3'
 env['test2'] = 'test4'
 
-status, output = conf.buildenv.execute_code(code, env=env, 
interpreter="python", working_dir='/home')
+status, output = conf.buildenv.execute_code(shell_code, env=env, 
working_dir='/tmp')
+status, output = conf.buildenv.execute_code(python_code, env=env, 
interpreter='python', working_dir='/tmp')
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to