Skip to content

Commit

Permalink
Get the correct include path in pip package (apache#13452)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
apeforest authored and anirudh2290 committed Nov 30, 2018
1 parent 07a4319 commit 9adf214
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions python/mxnet/libinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9adf214

Please sign in to comment.