Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
c9fb514a
Commit
c9fb514a
authored
May 05, 2017
by
Tsukasa OMOTO
Committed by
Guolin Ke
May 05, 2017
Browse files
docs: fix loading library (#492)
parent
152df4db
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
docs/conf.py
docs/conf.py
+11
-1
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+1
-1
python-package/lightgbm/libpath.py
python-package/lightgbm/libpath.py
+4
-0
No files found.
docs/conf.py
View file @
c9fb514a
...
@@ -19,14 +19,24 @@
...
@@ -19,14 +19,24 @@
#
#
import
os
import
os
import
sys
import
sys
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'../python-package'
))
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
libpath
=
os
.
path
.
join
(
curr_path
,
'../python-package/'
)
sys
.
path
.
insert
(
0
,
libpath
)
from
recommonmark.parser
import
CommonMarkParser
from
recommonmark.parser
import
CommonMarkParser
from
recommonmark.transform
import
AutoStructify
from
recommonmark.transform
import
AutoStructify
# -- mock out modules
from
unittest.mock
import
Mock
MOCK_MODULES
=
[
'numpy'
,
'scipy'
,
'scipy.sparse'
,
'sklearn'
,
'matplotlib'
,
'pandas'
,
'graphviz'
]
for
mod_name
in
MOCK_MODULES
:
sys
.
modules
[
mod_name
]
=
Mock
()
# -- General configuration ------------------------------------------------
# -- General configuration ------------------------------------------------
os
.
environ
[
'LIGHTGBM_BUILD_DOC'
]
=
'1'
# If your documentation needs a minimal Sphinx version, state it here.
# If your documentation needs a minimal Sphinx version, state it here.
#
#
# needs_sphinx = '1.0'
# needs_sphinx = '1.0'
...
...
python-package/lightgbm/basic.py
View file @
c9fb514a
...
@@ -22,7 +22,7 @@ def _load_lib():
...
@@ -22,7 +22,7 @@ def _load_lib():
"""Load LightGBM Library."""
"""Load LightGBM Library."""
lib_path
=
find_lib_path
()
lib_path
=
find_lib_path
()
if
len
(
lib_path
)
==
0
:
if
len
(
lib_path
)
==
0
:
r
aise
Exception
(
"cannot find LightGBM library"
)
r
eturn
None
lib
=
ctypes
.
cdll
.
LoadLibrary
(
lib_path
[
0
])
lib
=
ctypes
.
cdll
.
LoadLibrary
(
lib_path
[
0
])
lib
.
LGBM_GetLastError
.
restype
=
ctypes
.
c_char_p
lib
.
LGBM_GetLastError
.
restype
=
ctypes
.
c_char_p
return
lib
return
lib
...
...
python-package/lightgbm/libpath.py
View file @
c9fb514a
...
@@ -11,6 +11,10 @@ def find_lib_path():
...
@@ -11,6 +11,10 @@ def find_lib_path():
lib_path: list(string)
lib_path: list(string)
List of all found library path to LightGBM
List of all found library path to LightGBM
"""
"""
if
os
.
environ
.
get
(
'LIGHTGBM_BUILD_DOC'
,
False
):
# we don't need lib_lightgbm while building docs
return
[]
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
curr_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
os
.
path
.
expanduser
(
__file__
)))
dll_path
=
[
curr_path
,
os
.
path
.
join
(
curr_path
,
'../../lib/'
),
dll_path
=
[
curr_path
,
os
.
path
.
join
(
curr_path
,
'../../lib/'
),
os
.
path
.
join
(
curr_path
,
'../../'
),
os
.
path
.
join
(
curr_path
,
'../../'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment