[yt-svn] commit/yt: ngoldbaum: Merged in atmyers/yt (pull request #2160)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 11 11:21:05 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/0b86fcb15765/
Changeset:   0b86fcb15765
Branch:      yt
User:        ngoldbaum
Date:        2016-05-11 18:20:59+00:00
Summary:     Merged in atmyers/yt (pull request #2160)

Print out some useful diagnostic information if check_for_openmp() fails. Closes Issue #1089.
Affected #:  1 file

diff -r 6db4d26078e523630af50bde111952bbee7a1018 -r 0b86fcb157653daf6f3abafcb65518cec55b5a50 setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -1,10 +1,11 @@
 import os
 from pkg_resources import resource_filename
 import shutil
-import subprocess
+from subprocess import Popen, PIPE
 import sys
 import tempfile
 
+
 def check_for_openmp():
     """Returns True if local setup supports OpenMP, False otherwise"""
 
@@ -37,13 +38,21 @@
             "}"
         )
         file.flush()
-        with open(os.devnull, 'w') as fnull:
-            exit_code = subprocess.call(compiler + ['-fopenmp', filename],
-                                        stdout=fnull, stderr=fnull)
+        p = Popen(compiler + ['-fopenmp', filename],
+                  stdin=PIPE, stdout=PIPE, stderr=PIPE)
+        output, err = p.communicate()
+        exit_code = p.returncode
+        
+        if exit_code != 0:
+            print("Compilation of OpenMP test code failed with the error: ")
+            print(err)
+            print("Disabling OpenMP support. ")
 
         # Clean up
         file.close()
     except OSError:
+        print("check_for_openmp() could not find your C compiler. "
+              "Attempted to use '%s'. " % compiler)
         return False
     finally:
         os.chdir(curdir)
@@ -82,12 +91,11 @@
         except IOError:
             rd = '/usr/local'
 
-    fail_msg = ("Pyembree is installed, but I could not compile Embree test code. \n"
-               "I attempted to find Embree headers in %s. \n"
+    fail_msg = ("I attempted to find Embree headers in %s. \n"
                "If this is not correct, please set your correct embree location \n"
                "using EMBREE_DIR environment variable or your embree.cfg file. \n"
                "Please see http://yt-project.org/docs/dev/visualizing/unstructured_mesh_rendering.html "
-                "for more information." % rd)
+                "for more information. \n" % rd)
 
     # Create a temporary directory
     tmpdir = tempfile.mkdtemp()
@@ -110,23 +118,29 @@
             '}'
         )
         file.flush()
-        with open(os.devnull, 'w') as fnull:
-            exit_code = subprocess.call(compiler + ['-I%s/include/' % rd, filename],
-                             stdout=fnull, stderr=fnull)
+        p = Popen(compiler + ['-I%s/include/' % rd, filename], 
+                  stdin=PIPE, stdout=PIPE, stderr=PIPE)
+        output, err = p.communicate()
+        exit_code = p.returncode
+
+        if exit_code != 0:
+            print("Pyembree is installed, but I could not compile Embree test code.")
+            print("The error message was: ")
+            print(err)
+            print(fail_msg)
 
         # Clean up
         file.close()
 
     except OSError:
-        print(fail_msg)
+        print("read_embree_location() could not find your C compiler. "
+              "Attempted to use '%s'. " % compiler)
+        return False
 
     finally:
         os.chdir(curdir)
         shutil.rmtree(tmpdir)
 
-    if exit_code != 0:
-        print(fail_msg)
-
     return rd

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160511/17f83360/attachment.html>


More information about the yt-svn mailing list