[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sun Mar 27 14:47:10 PDT 2016


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/d44c9b732d8a/
Changeset:   d44c9b732d8a
Branch:      yt
User:        atmyers
Date:        2016-03-20 21:39:06+00:00
Summary:     do not print a warning about Embree not being set up unless an Embree test compile fails
Affected #:  1 file

diff -r ff8cdfb114c333124655223ef7b0aaffd01455bc -r d44c9b732d8a13bac7e9d374e50c345466ff7a13 setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -74,17 +74,58 @@
     '''
 
     rd = os.environ.get('EMBREE_DIR')
-    if rd is not None:
-        return rd
-    print("EMBREE_DIR not set. Attempting to read embree.cfg")
+    if rd is None:
+        try:
+            rd = open("embree.cfg").read().strip()
+        except IOError:
+            rd = '/usr/local'
+
+    fail_msg = "Pyembree is installed, but I could not compile Embree test code. \n" + \
+               "Attempted to find Embree headers in %s. \n" % rd + \
+               "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."
+
+    # Create a temporary directory
+    tmpdir = tempfile.mkdtemp()
+    curdir = os.getcwd()
+
     try:
-        rd = open("embree.cfg").read().strip()
-        return rd
-    except IOError:
-        print("Reading Embree location from embree.cfg failed.")
-        print("If compilation fails, please place the base directory")
-        print("of your Embree install in embree.cfg and restart.")
-        return '/usr/local'
+        os.chdir(tmpdir)
+
+        # Get compiler invocation
+        compiler = os.getenv('CXX', 'c++')
+        compiler = compiler.split(' ')
+
+        # Attempt to compile a test script.
+        filename = r'test.cpp'
+        file = open(filename, 'wt', 1)
+        file.write(
+            '#include "embree2/rtcore.h"\n'
+            'int main() {\n'
+            'return 0;\n'
+            '}'
+        )
+        file.flush()
+        with open(os.devnull, 'w') as fnull:
+            exit_code = subprocess.call(compiler + ['-I%s/include/' % rd, filename],
+                             stdout=fnull, stderr=fnull)
+
+        # Clean up
+        file.close()
+
+    except OSError:
+        print fail_msg
+
+    finally:
+        os.chdir(curdir)
+        shutil.rmtree(tmpdir)
+
+    if exit_code != 0:
+        print fail_msg
+
+    return rd
 
 
 def get_mercurial_changeset_id(target_dir):


https://bitbucket.org/yt_analysis/yt/commits/6753e090c2b5/
Changeset:   6753e090c2b5
Branch:      yt
User:        atmyers
Date:        2016-03-20 21:45:58+00:00
Summary:     update install instructions, and give an example embree.cfg file
Affected #:  1 file

diff -r d44c9b732d8a13bac7e9d374e50c345466ff7a13 -r 6753e090c2b5c4e0df8e16d9741e65b2e40e30c7 doc/source/visualizing/unstructured_mesh_rendering.rst
--- a/doc/source/visualizing/unstructured_mesh_rendering.rst
+++ b/doc/source/visualizing/unstructured_mesh_rendering.rst
@@ -14,7 +14,7 @@
 
 .. code-block:: bash
 
-    conda install -c http://use.yt/with_conda/ yt=3.3_dev
+    conda install -c http://use.yt/with_conda/ yt
 
 If you want to install from source, you can use the ``get_yt.sh`` script.
 Be sure to set the INST_YT_SOURCE and INST_UNSTRUCTURED flags to 1 at the 
@@ -73,7 +73,13 @@
 
 as usual. Finally, if you create a file called embree.cfg in the yt-hg directory with
 the location of the embree installation, the setup script will find this and use it, 
-provided EMBREE_DIR is not set. We recommend one of the later two methods, especially
+provided EMBREE_DIR is not set. An example embree.cfg file could like this:
+
+.. code-block:: bash
+
+   /opt/local/
+
+We recommend one of the later two methods, especially
 if you plan on re-compiling the cython extensions regularly. Note that none of this is
 neccessary if you installed embree into a location that is in your default path, such
 as /usr/local.


https://bitbucket.org/yt_analysis/yt/commits/2e201168417d/
Changeset:   2e201168417d
Branch:      yt
User:        atmyers
Date:        2016-03-20 22:01:31+00:00
Summary:     use new form for print
Affected #:  1 file

diff -r 6753e090c2b5c4e0df8e16d9741e65b2e40e30c7 -r 2e201168417ded751a8bec33dea6d08949c82c65 setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -116,14 +116,14 @@
         file.close()
 
     except OSError:
-        print fail_msg
+        print(fail_msg)
 
     finally:
         os.chdir(curdir)
         shutil.rmtree(tmpdir)
 
     if exit_code != 0:
-        print fail_msg
+        print(fail_msg)
 
     return rd
 


https://bitbucket.org/yt_analysis/yt/commits/b74883e05fc4/
Changeset:   b74883e05fc4
Branch:      yt
User:        atmyers
Date:        2016-03-21 01:32:29+00:00
Summary:     style fix to warning message string
Affected #:  1 file

diff -r 2e201168417ded751a8bec33dea6d08949c82c65 -r b74883e05fc41293c260a12eae43a18718641cbb setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -80,12 +80,12 @@
         except IOError:
             rd = '/usr/local'
 
-    fail_msg = "Pyembree is installed, but I could not compile Embree test code. \n" + \
-               "Attempted to find Embree headers in %s. \n" % rd + \
-               "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."
+    fail_msg = ("Pyembree is installed, but I could not compile Embree test code. \n"
+               "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)
 
     # Create a temporary directory
     tmpdir = tempfile.mkdtemp()


https://bitbucket.org/yt_analysis/yt/commits/be993079427c/
Changeset:   be993079427c
Branch:      yt
User:        atmyers
Date:        2016-03-27 21:47:01+00:00
Summary:     Merged in atmyers/yt (pull request #2057)

Improve the unstructured mesh rendering build process.
Affected #:  2 files

diff -r 5a08905d2e438f08244ca4819d523f62dfc4e86d -r be993079427c300e09b4b6430e3c8d90af0c3500 doc/source/visualizing/unstructured_mesh_rendering.rst
--- a/doc/source/visualizing/unstructured_mesh_rendering.rst
+++ b/doc/source/visualizing/unstructured_mesh_rendering.rst
@@ -14,7 +14,7 @@
 
 .. code-block:: bash
 
-    conda install -c http://use.yt/with_conda/ yt=3.3_dev
+    conda install -c http://use.yt/with_conda/ yt
 
 If you want to install from source, you can use the ``get_yt.sh`` script.
 Be sure to set the INST_YT_SOURCE and INST_UNSTRUCTURED flags to 1 at the 
@@ -73,7 +73,13 @@
 
 as usual. Finally, if you create a file called embree.cfg in the yt-hg directory with
 the location of the embree installation, the setup script will find this and use it, 
-provided EMBREE_DIR is not set. We recommend one of the later two methods, especially
+provided EMBREE_DIR is not set. An example embree.cfg file could like this:
+
+.. code-block:: bash
+
+   /opt/local/
+
+We recommend one of the later two methods, especially
 if you plan on re-compiling the cython extensions regularly. Note that none of this is
 neccessary if you installed embree into a location that is in your default path, such
 as /usr/local.

diff -r 5a08905d2e438f08244ca4819d523f62dfc4e86d -r be993079427c300e09b4b6430e3c8d90af0c3500 setupext.py
--- a/setupext.py
+++ b/setupext.py
@@ -76,17 +76,58 @@
     '''
 
     rd = os.environ.get('EMBREE_DIR')
-    if rd is not None:
-        return rd
-    print("EMBREE_DIR not set. Attempting to read embree.cfg")
+    if rd is None:
+        try:
+            rd = open("embree.cfg").read().strip()
+        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"
+               "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)
+
+    # Create a temporary directory
+    tmpdir = tempfile.mkdtemp()
+    curdir = os.getcwd()
+
     try:
-        rd = open("embree.cfg").read().strip()
-        return rd
-    except IOError:
-        print("Reading Embree location from embree.cfg failed.")
-        print("If compilation fails, please place the base directory")
-        print("of your Embree install in embree.cfg and restart.")
-        return '/usr/local'
+        os.chdir(tmpdir)
+
+        # Get compiler invocation
+        compiler = os.getenv('CXX', 'c++')
+        compiler = compiler.split(' ')
+
+        # Attempt to compile a test script.
+        filename = r'test.cpp'
+        file = open(filename, 'wt', 1)
+        file.write(
+            '#include "embree2/rtcore.h"\n'
+            'int main() {\n'
+            'return 0;\n'
+            '}'
+        )
+        file.flush()
+        with open(os.devnull, 'w') as fnull:
+            exit_code = subprocess.call(compiler + ['-I%s/include/' % rd, filename],
+                             stdout=fnull, stderr=fnull)
+
+        # Clean up
+        file.close()
+
+    except OSError:
+        print(fail_msg)
+
+    finally:
+        os.chdir(curdir)
+        shutil.rmtree(tmpdir)
+
+    if exit_code != 0:
+        print(fail_msg)
+
+    return rd
 
 
 def get_mercurial_changeset_id(target_dir):

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/20160327/ac646a0a/attachment.html>


More information about the yt-svn mailing list