anirudh2290 closed pull request #13359: [MXNET-1110] find the path to include 
header files
URL: https://github.com/apache/incubator-mxnet/pull/13359
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/python/mxnet/libinfo.py b/python/mxnet/libinfo.py
index 7c783ab99fb..0669a03c652 100644
--- a/python/mxnet/libinfo.py
+++ b/python/mxnet/libinfo.py
@@ -76,6 +76,31 @@ def find_lib_path():
         os.environ['PATH'] = os.environ['PATH'] + ';' + 
os.path.dirname(lib_path[0])
     return lib_path
 
+def find_include_path():
+    """Find MXNet included header files.
+
+    Returns
+    -------
+    incl_path : string
+        Path to the header files.
+    """
+    incl_from_env = os.environ.get('MXNET_INCLUDE_PATH')
+    if incl_from_env:
+        if os.path.isdir(incl_from_env):
+            if not os.path.isabs(incl_from_env):
+                logging.warning("MXNET_INCLUDE_PATH should be an absolute 
path, instead of: %s",
+                                incl_from_env)
+            else:
+                return incl_from_env
+        else:
+            logging.warning("MXNET_INCLUDE_PATH '%s' doesn't exist", 
incl_from_env)
+
+    curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
+    incl_path = os.path.join(curr_path, '../../include/')
+    if not os.path.isdir(incl_path):
+        raise RuntimeError('Cannot find the MXNet include path.\n')
+    return incl_path
+
 
 # current version
 __version__ = "1.4.0"
diff --git a/tests/python/unittest/test_libinfo.py 
b/tests/python/unittest/test_libinfo.py
new file mode 100644
index 00000000000..66bf03111d4
--- /dev/null
+++ b/tests/python/unittest/test_libinfo.py
@@ -0,0 +1,30 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import mxnet as mx
+from mxnet import libinfo
+
+def test_include_path():
+    incl_path = libinfo.find_include_path()
+    assert os.path.exists(incl_path)
+    assert os.path.isdir(incl_path)
+
+
+if __name__ == '__main__':
+    import nose
+    nose.runmodule()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to