From 1c54f4bb705ea7b4dd7b95e2a50c3e9bc0d59dba Mon Sep 17 00:00:00 2001
From: valerio <valerio@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Thu, 17 Jun 2010 12:54:15 +0000
Subject: [PATCH] Tm tools fixes for MacOS X

Fixed darwin_macports.txt so that tm tools can be built using the g95 compiler in macports. Fixed problem with systel call being interrupted.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2414 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 build_configs/darwin_macports.txt |  1 +
 modules/bindings/pymod/tmtools.py | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/build_configs/darwin_macports.txt b/build_configs/darwin_macports.txt
index aca42ad9d..535a2e381 100644
--- a/build_configs/darwin_macports.txt
+++ b/build_configs/darwin_macports.txt
@@ -4,3 +4,4 @@ set(BOOST_ROOT "/opt/local" CACHE PATH "prefix for the boost")
 set(PYTHON_ROOT "/opt/local" CACHE PATH "prefix for python")
 set(QT_QMAKE_EXECUTABLE "/opt/local/bin/qmake-mac" CACHE PATH 
     "absolute path to qt executable")
+set(CMAKE_Fortran_FLAGS "-freal-loops" CACHE STRING "fortran compiler flags")
diff --git a/modules/bindings/pymod/tmtools.py b/modules/bindings/pymod/tmtools.py
index a9c18a707..a8aae7100 100644
--- a/modules/bindings/pymod/tmtools.py
+++ b/modules/bindings/pymod/tmtools.py
@@ -69,11 +69,15 @@ def _RunTmAlign(tmalign, tmp_dir):
   if platform.system() == "Windows":
     tmalign_path=settings.Locate('tmalign.exe', explicit_file_name=tmalign)
     command="\"%s\" %s %s" %(os.path.normpath(tmalign_path), model1_filename, model2_filename)
+    command=command+" > "+tmp_dir+"/tmalign_output"
   else:
     tmalign_path=settings.Locate('tmalign', explicit_file_name=tmalign)  
     command="%s '%s' '%s'" %(tmalign_path, model1_filename, model2_filename)
-  ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
-  lines=ps.stdout.readlines()
+    command=command+" > "+tmp_dir+"/tmalign_output"
+  ps=subprocess.call(command, shell=True, stdout=subprocess.PIPE)
+  tmalign_f=open(tmp_dir+"/tmalign_output","r")
+  lines=tmalign_f.readlines()
+  tmalign_f.close()
   if (len(lines))<22:
     raise RuntimeError("tmalign superposition failed")
   return _ParseTmAlign(lines)
@@ -113,11 +117,15 @@ def _RunTmScore(tmscore, tmp_dir):
   if platform.system() == "Windows":
     tmscore_path=settings.Locate('tmscore.exe', explicit_file_name=tmscore)
     command="\"%s\" %s %s" %(os.path.normpath(tmscore_path), model1_filename, model2_filename)
+    command=command+" > "+tmp_dir+"/tmscore_output"
   else:
     tmscore_path=settings.Locate('tmscore', explicit_file_name=tmscore)
     command="%s '%s' '%s'" %(tmscore_path, model1_filename, model2_filename)
+    command=command+" > "+tmp_dir+"/tmscore_output"
   ps=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
-  lines=ps.stdout.readlines()
+  tmscore_f=open(tmp_dir+"/tmscore_output","r")
+  lines=tmscore_f.readlines()
+  tmscore_f.close()
   if (len(lines))<22:
     raise RuntimeError("tmscore superposition failed")
   return _ParseTmScore(lines)
@@ -139,4 +147,4 @@ def TMScore(model1, model2, tmscore=None):
   result=_RunTmScore(tmscore, tmp_dir_name)
   model1.handle.RequestXCSEditor().ApplyTransform(result.transform)  
   _CleanupFiles(tmp_dir_name)
-  return result
\ No newline at end of file
+  return result
-- 
GitLab