This is an automated email from the ASF dual-hosted git repository.

anirudh2290 pushed a commit to branch v1.4.x
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v1.4.x by this push:
     new ff4c178  Get the correct include path in pip package (#13452)
ff4c178 is described below

commit ff4c178ec4d5a08846eadb71ca1d5547713d48ad
Author: Lin Yuan <apefor...@gmail.com>
AuthorDate: Thu Nov 29 19:23:52 2018 -0800

    Get the correct include path in pip package (#13452)
    
    * add find_include_path API
    
    * address reviewer comment
    
    * change return type from list to string
    
    * add unit test
    
    * address reviewer comment
    
    * address reviewer comment
    
    * address reviewer comment
    
    * address reviewer comment
    
    * fix include path problem in pip package
    
    * add comment
    
    * fix lint error
    
    * address reviewer comment
    
    * address reviewer comment
---
 python/mxnet/libinfo.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/python/mxnet/libinfo.py b/python/mxnet/libinfo.py
index 0669a03..57c73e5 100644
--- a/python/mxnet/libinfo.py
+++ b/python/mxnet/libinfo.py
@@ -96,10 +96,18 @@ def find_include_path():
             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
+    # include path in pip package
+    pip_incl_path = os.path.join(curr_path, 'include/')
+    if os.path.isdir(pip_incl_path):
+        return pip_incl_path
+    else:
+        # include path if build from source
+        src_incl_path = os.path.join(curr_path, '../../include/')
+        if os.path.isdir(src_incl_path):
+            return src_incl_path
+        else:
+            raise RuntimeError('Cannot find the MXNet include path in either ' 
+ pip_incl_path +
+                               ' or ' + src_incl_path + '\n')
 
 
 # current version

Reply via email to