mailr22184 - in /trunk: prompt/interpreter.py relax.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by tlinnet on February 14, 2014 - 11:22:
Author: tlinnet
Date: Fri Feb 14 11:22:57 2014
New Revision: 22184

URL: http://svn.gna.org/viewcvs/relax?rev=22184&view=rev
Log:
Modified the help text to explain that -p will launch relax in prompt mode 
after running any optionally supplied scripts.

Fix for sr #3117, (https://gna.org/support/?3117) - Functionality to inspect 
interactively after running script - The equivalence to python -i

This is to allow the -p --prompt option to be given without a script. relax 
should support this so that a user doesn't get too confused when
trying to start in prompt mode with the --prompt flag and support the 
--prompt argument without a script being supplied.

Modified:
    trunk/prompt/interpreter.py
    trunk/relax.py

Modified: trunk/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/prompt/interpreter.py?rev=22184&r1=22183&r2=22184&view=diff
==============================================================================
--- trunk/prompt/interpreter.py (original)
+++ trunk/prompt/interpreter.py Fri Feb 14 11:22:57 2014
@@ -336,14 +336,18 @@
         # Reverse the system path so that the script path is first.
         sys.path.reverse()
 
-        # Execute the script as a module.
-        #if dep_check.runpy_module:
-        #    runpy.run_module(module, globals)
+        # Execute the script as a module if the inspect interactively prompt 
flag is not true.
+        if dep_check.runpy_module and not status.prompt:
+            runpy.run_module(module, globals)
+
+        # Execute the script as a module if the inspect interactively prompt 
flag is not true.
+        elif dep_check.runpy_module and not status.prompt:
+            runpy.run_module(module, globals)
 
         # Allow scripts to run under Python <= 2.4.
-        #else:
-        #    exec(compile(open(name).read(), name, 'exec'), globals)
-        exec(compile(open(name).read(), name, 'exec'), globals)
+        else:
+            exec(compile(open(name).read(), name, 'exec'), globals)
+
 
     finally:
         # Switch back to the original working directory.

Modified: trunk/relax.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/relax.py?rev=22184&r1=22183&r2=22184&view=diff
==============================================================================
--- trunk/relax.py (original)
+++ trunk/relax.py Fri Feb 14 11:22:57 2014
@@ -215,7 +215,7 @@
             # Only import the module in the test modes (to improve program 
start up speeds).
             from test_suite.test_suite_runner import Test_suite_runner
 
-            # Load the interpreter and turn intros on.
+            # Load the interpreter and turn intros on.launch relax in prompt 
mode after running any optionally supplied scripts
             self.interpreter = interpreter.Interpreter(show_script=False, 
raise_relax_error=True)
             self.interpreter.on()
 
@@ -280,7 +280,7 @@
         parser.add_option('-t', '--tee', action='store', type='string', 
dest='tee', help='tee relax output to stdout and the file LOG_FILE', 
metavar='LOG_FILE')
         parser.add_option('-g', '--gui', action='store_true', dest='gui', 
default=0, help='launch the relax GUI')
         parser.add_option('-e', '--escalate', action='store_true', 
dest='escalate', default=0, help='escalate all warnings to errors')
-        parser.add_option('-p', '--prompt', action='store_true', 
dest='prompt', default=0, help='execute the given script and continue into 
the prompt mode to allow for interactive inspection')
+        parser.add_option('-p', '--prompt', action='store_true', 
dest='prompt', default=0, help='launch relax in prompt mode after running any 
optionally supplied scripts')
         parser.add_option('--test', action='store_true', dest='test', 
default=0, help='run relax in test mode')
         parser.add_option('-x', '--test-suite', action='store_true', 
dest='test_suite', default=0, help='execute the relax test suite')
         parser.add_option('-s', '--system-tests', action='store_true', 
dest='system_tests', default=0, help='execute the relax system/functional 
tests (part of the test suite)')




Related Messages


Powered by MHonArc, Updated Fri Feb 14 12:00:04 2014