Bail out early if libxgboost exists in python setup (#6694)
Skip `copy_tree` when existing build is found.
This commit is contained in:
parent
e8c5c53e2f
commit
9b267a435e
@ -129,12 +129,6 @@ class BuildExt(build_ext.build_ext): # pylint: disable=too-many-ancestors
|
|||||||
self.logger.info('Using system libxgboost.')
|
self.logger.info('Using system libxgboost.')
|
||||||
return
|
return
|
||||||
|
|
||||||
src_dir = 'xgboost'
|
|
||||||
try:
|
|
||||||
copy_tree(os.path.join(CURRENT_DIR, os.path.pardir),
|
|
||||||
os.path.join(self.build_temp, src_dir))
|
|
||||||
except Exception: # pylint: disable=broad-except
|
|
||||||
copy_tree(src_dir, os.path.join(self.build_temp, src_dir))
|
|
||||||
build_dir = self.build_temp
|
build_dir = self.build_temp
|
||||||
global BUILD_TEMP_DIR # pylint: disable=global-statement
|
global BUILD_TEMP_DIR # pylint: disable=global-statement
|
||||||
BUILD_TEMP_DIR = build_dir
|
BUILD_TEMP_DIR = build_dir
|
||||||
@ -145,6 +139,13 @@ class BuildExt(build_ext.build_ext): # pylint: disable=too-many-ancestors
|
|||||||
self.logger.info('Found shared library, skipping build.')
|
self.logger.info('Found shared library, skipping build.')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
src_dir = 'xgboost'
|
||||||
|
try:
|
||||||
|
copy_tree(os.path.join(CURRENT_DIR, os.path.pardir),
|
||||||
|
os.path.join(self.build_temp, src_dir))
|
||||||
|
except Exception: # pylint: disable=broad-except
|
||||||
|
copy_tree(src_dir, os.path.join(self.build_temp, src_dir))
|
||||||
|
|
||||||
self.logger.info('Building from source. %s', libxgboost)
|
self.logger.info('Building from source. %s', libxgboost)
|
||||||
if not os.path.exists(build_dir):
|
if not os.path.exists(build_dir):
|
||||||
os.mkdir(build_dir)
|
os.mkdir(build_dir)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user