Commit 958d78d8 authored by Guolin Ke's avatar Guolin Ke
Browse files

fix #655

parent f3d5c9d3
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
Contributors: https://github.com/Microsoft/LightGBM/graphs/contributors Contributors: https://github.com/Microsoft/LightGBM/graphs/contributors
""" """
from __future__ import absolute_import from __future__ import absolute_import
from .basic import Booster, Dataset from .basic import Booster, Dataset
from .callback import (early_stopping, print_evaluation, record_evaluation, from .callback import (early_stopping, print_evaluation, record_evaluation,
reset_parameter) reset_parameter)
from .engine import cv, train from .engine import cv, train
import os
try: try:
from .sklearn import LGBMModel, LGBMRegressor, LGBMClassifier, LGBMRanker from .sklearn import LGBMModel, LGBMRegressor, LGBMClassifier, LGBMRanker
...@@ -20,8 +20,11 @@ try: ...@@ -20,8 +20,11 @@ try:
except ImportError: except ImportError:
pass pass
version = '2.0.1'
if os.path.isfile('./VERSION.txt'):
version = open('./VERSION.txt').read().strip()
__version__ = 0.2 __version__ = version
__all__ = ['Dataset', 'Booster', __all__ = ['Dataset', 'Booster',
'train', 'cv', 'train', 'cv',
......
...@@ -32,6 +32,8 @@ if __name__ == "__main__": ...@@ -32,6 +32,8 @@ if __name__ == "__main__":
sys.argv = sys.argv[0:2] sys.argv = sys.argv[0:2]
except getopt.GetoptError as err: except getopt.GetoptError as err:
pass pass
if os.path.isfile('../VERSION.txt'):
distutils.file_util.copy_file("../VERSION.txt", "./lightgbm/")
if not use_precompile or build_sdist: if not use_precompile or build_sdist:
if not os.path.isfile('./_IS_SOURCE_PACKAGE.txt'): if not os.path.isfile('./_IS_SOURCE_PACKAGE.txt'):
if os.path.exists("../include"): if os.path.exists("../include"):
...@@ -54,7 +56,6 @@ if __name__ == "__main__": ...@@ -54,7 +56,6 @@ if __name__ == "__main__":
else: else:
raise Exception('Cannot copy ../compute folder') raise Exception('Cannot copy ../compute folder')
distutils.file_util.copy_file("../CMakeLists.txt", "./lightgbm/") distutils.file_util.copy_file("../CMakeLists.txt", "./lightgbm/")
distutils.file_util.copy_file("../VERSION.txt", "./lightgbm/")
if build_sdist: if build_sdist:
file_flag = open("./_IS_SOURCE_PACKAGE.txt", 'w') file_flag = open("./_IS_SOURCE_PACKAGE.txt", 'w')
file_flag.close() file_flag.close()
...@@ -102,8 +103,6 @@ if __name__ == "__main__": ...@@ -102,8 +103,6 @@ if __name__ == "__main__":
version = '2.0.1' version = '2.0.1'
if os.path.isfile('./lightgbm/VERSION.txt'): if os.path.isfile('./lightgbm/VERSION.txt'):
version = open('./lightgbm/VERSION.txt').read().strip() version = open('./lightgbm/VERSION.txt').read().strip()
elif os.path.isfile('../VERSION.txt'):
version = open('../VERSION.txt').read().strip()
setup(name='lightgbm', setup(name='lightgbm',
version=version, version=version,
description='LightGBM Python Package', description='LightGBM Python Package',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment