mailr24252 - /branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py


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

Header


Content

Posted by edward on June 23, 2014 - 16:42:
Author: bugman
Date: Mon Jun 23 16:42:48 2014
New Revision: 24252

URL: http://svn.gna.org/viewcvs/relax?rev=24252&view=rev
Log:
Improved the relax version printouts for the dispersion model master 
profiling script.

This now reports both relax versions.


Modified:
    
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py

Modified: 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py?rev=24252&r1=24251&r2=24252&view=diff
==============================================================================
--- 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py
    (original)
+++ 
branches/disp_spin_speed/test_suite/shared_data/dispersion/profiling/disp_profile_all.py
    Mon Jun 23 16:42:48 2014
@@ -44,12 +44,6 @@
 from shutil import copyfile
 from subprocess import PIPE, Popen
 import sys
-
-# Modify the system path to add the base directory of the current relax 
version.
-sys.path.append(path.join(pardir, pardir, pardir, pardir))
-
-# relax module imports.
-import version
 
 
 # The number of iterations to run each script for the statistics.
@@ -86,15 +80,36 @@
     path2 = sys.argv[2]
 elif len(sys.argv) == 2:
     path2 = sys.argv[1]
+current = False
+if path1 == '.':
+    current = True
+    path1 = path.join(pardir, pardir, pardir, pardir)
 
 # The Python executable name.
 python = 'python'
 
 
-# First a printout of the relax version.
-sys.stdout.write("\n\nCurrent relax version:  ")
-sys.stdout.write(version.version_full())
+# First a printout of the relax versions.
+data = [
+    ['1st', path1],
+    ['2nd', path2]
+]
 sys.stdout.write("\n\n")
+for iter, path in data:
+    # Intro text.
+    sys.stdout.write("\n%s relax version:  " % iter)
+
+    # The command to obtain the version.
+    cmd = "cd %s; %s -c \"import version; print(version.version_full())\"" % 
(path, python)
+    pipe = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, 
close_fds=False)
+
+    # Close the pipe.
+    pipe.stdin.close()
+
+    # Write out the output.
+    for line in pipe.stdout.readlines():
+        sys.stdout.write(line[:-1])
+sys.stdout.write("\n\n")
 
 # Copy the current scripts to the base directory of the alternative relax 
version.
 for i in range(len(models)):
@@ -102,7 +117,7 @@
     model, script, iter, scaling_factor = models[i]
 
     # Copy to the first path.
-    if path1 != '.':
+    if current:
         print("Copying to '%s': model=%s script=%s iterations=%s scale=%s" % 
(path1, model, script, iter, scaling_factor))
         copyfile(script, path1+sep+script)
 
@@ -130,7 +145,7 @@
         model, script, iter, scaling_factor = models[i]
         # The commands to run.
         cmds = []
-        if path1 == '.':
+        if current:
             cmds.append("%s %s" % (python, script))
         else:
             cmds.append("%s %s %s" % (python, path1+sep+script, path1))




Related Messages


Powered by MHonArc, Updated Mon Jun 23 17:00:03 2014