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
97d5758f
Unverified
Commit
97d5758f
authored
Aug 11, 2020
by
Nikita Titov
Committed by
GitHub
Aug 11, 2020
Browse files
[python] try to use bundled distutils to setuptools during setup (#3294)
parent
e6bf4090
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
python-package/setup.py
python-package/setup.py
+18
-17
No files found.
python-package/setup.py
View file @
97d5758f
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
"""Setup lightgbm package."""
"""Setup lightgbm package."""
from
__future__
import
absolute_import
from
__future__
import
absolute_import
import
distutils
import
io
import
io
import
logging
import
logging
import
os
import
os
...
@@ -16,6 +15,8 @@ from setuptools import find_packages, setup
...
@@ -16,6 +15,8 @@ from setuptools import find_packages, setup
from
setuptools.command.install
import
install
from
setuptools.command.install
import
install
from
setuptools.command.install_lib
import
install_lib
from
setuptools.command.install_lib
import
install_lib
from
setuptools.command.sdist
import
sdist
from
setuptools.command.sdist
import
sdist
from
distutils.dir_util
import
copy_tree
from
distutils.file_util
import
copy_file
def
find_lib
():
def
find_lib
():
...
@@ -35,7 +36,7 @@ def copy_files(use_gpu=False):
...
@@ -35,7 +36,7 @@ def copy_files(use_gpu=False):
if
os
.
path
.
exists
(
src
):
if
os
.
path
.
exists
(
src
):
dst
=
os
.
path
.
join
(
CURRENT_DIR
,
'compile'
,
folder_name
)
dst
=
os
.
path
.
join
(
CURRENT_DIR
,
'compile'
,
folder_name
)
shutil
.
rmtree
(
dst
,
ignore_errors
=
True
)
shutil
.
rmtree
(
dst
,
ignore_errors
=
True
)
distutils
.
dir_util
.
copy_tree
(
src
,
dst
,
verbose
=
0
)
copy_tree
(
src
,
dst
,
verbose
=
0
)
else
:
else
:
raise
Exception
(
'Cannot copy {0} folder'
.
format
(
src
))
raise
Exception
(
'Cannot copy {0} folder'
.
format
(
src
))
...
@@ -44,20 +45,20 @@ def copy_files(use_gpu=False):
...
@@ -44,20 +45,20 @@ def copy_files(use_gpu=False):
copy_files_helper
(
'src'
)
copy_files_helper
(
'src'
)
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
)):
os
.
makedirs
(
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
))
os
.
makedirs
(
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
))
distutils
.
file_util
.
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"windows"
,
"LightGBM.sln"
),
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"windows"
,
"LightGBM.sln"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
,
"LightGBM.sln"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
,
"LightGBM.sln"
),
verbose
=
0
)
verbose
=
0
)
distutils
.
file_util
.
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"windows"
,
"LightGBM.vcxproj"
),
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"windows"
,
"LightGBM.vcxproj"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
,
"LightGBM.vcxproj"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"windows"
,
"LightGBM.vcxproj"
),
verbose
=
0
)
verbose
=
0
)
if
use_gpu
:
if
use_gpu
:
copy_files_helper
(
'compute'
)
copy_files_helper
(
'compute'
)
distutils
.
file_util
.
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"CMakeLists.txt"
),
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"CMakeLists.txt"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"CMakeLists.txt"
),
os
.
path
.
join
(
CURRENT_DIR
,
"compile"
,
"CMakeLists.txt"
),
verbose
=
0
)
verbose
=
0
)
distutils
.
file_util
.
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"LICENSE"
),
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
"LICENSE"
),
os
.
path
.
join
(
CURRENT_DIR
,
"LICENSE"
),
os
.
path
.
join
(
CURRENT_DIR
,
"LICENSE"
),
verbose
=
0
)
verbose
=
0
)
def
clear_path
(
path
):
def
clear_path
(
path
):
...
@@ -258,9 +259,9 @@ if __name__ == "__main__":
...
@@ -258,9 +259,9 @@ if __name__ == "__main__":
LOG_PATH
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'~'
),
'LightGBM_compilation.log'
)
LOG_PATH
=
os
.
path
.
join
(
os
.
path
.
expanduser
(
'~'
),
'LightGBM_compilation.log'
)
LOG_NOTICE
=
"The full version of error log was saved into {0}"
.
format
(
LOG_PATH
)
LOG_NOTICE
=
"The full version of error log was saved into {0}"
.
format
(
LOG_PATH
)
if
os
.
path
.
isfile
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
'VERSION.txt'
)):
if
os
.
path
.
isfile
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
'VERSION.txt'
)):
distutils
.
file_util
.
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
'VERSION.txt'
),
copy_file
(
os
.
path
.
join
(
CURRENT_DIR
,
os
.
path
.
pardir
,
'VERSION.txt'
),
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm'
,
'VERSION.txt'
),
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm'
,
'VERSION.txt'
),
verbose
=
0
)
verbose
=
0
)
version
=
io
.
open
(
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm'
,
'VERSION.txt'
),
encoding
=
'utf-8'
).
read
().
strip
()
version
=
io
.
open
(
os
.
path
.
join
(
CURRENT_DIR
,
'lightgbm'
,
'VERSION.txt'
),
encoding
=
'utf-8'
).
read
().
strip
()
readme
=
io
.
open
(
os
.
path
.
join
(
CURRENT_DIR
,
'README.rst'
),
encoding
=
'utf-8'
).
read
()
readme
=
io
.
open
(
os
.
path
.
join
(
CURRENT_DIR
,
'README.rst'
),
encoding
=
'utf-8'
).
read
()
...
...
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