Selectively install through pip (#139)

Selectively install through pip 
* update setup.py
This commit is contained in:
Zejun Lin 2018-09-29 17:18:24 +08:00 коммит произвёл fishyds
Родитель 0619de20b7
Коммит 1d174836d3
1 изменённых файлов: 28 добавлений и 13 удалений

Просмотреть файл

@ -29,9 +29,35 @@ def read(fname):
class CustomInstallCommand(install):
'''a customized install class in pip module'''
user_options = install.user_options + [
('sdk-only', None, '<add --sdk-only if you want to only install nni sdk')
]
def initialize_options(self):
install.initialize_options(self)
self.sdk_only = None
def install_requires(self):
self.install_requires_list = [
'astor',
'hyperopt',
'json_tricks',
'numpy',
'psutil',
'pyyaml',
'requests',
'scipy',
'schema',
'pyhdfs'
]
for pkg in self.install_requires_list:
subprocess.run(['python3', '-m', 'pip', 'install', pkg], check=True)
def run(self):
super().run()
subprocess.run(['make', 'pip-install'], check=True)
if self.sdk_only is None:
subprocess.run(['make', 'pip-install'], check=True)
self.install_requires()
setup(
name = 'NNI',
@ -52,18 +78,7 @@ setup(
},
package_data = {'nni': ['**/requirements.txt']},
python_requires = '>=3.5',
install_requires = [
'astor',
'hyperopt',
'json_tricks',
'numpy',
'psutil',
'pyyaml',
'requests',
'scipy',
'schema',
'pyhdfs'
],
cmdclass={
'install': CustomInstallCommand