package_management.py 733 Bytes
Newer Older
liuzhe-lz's avatar
liuzhe-lz committed
1
2
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
QuanluZhang's avatar
QuanluZhang committed
3
4

import os
chicm-ms's avatar
chicm-ms committed
5
import nni
QuanluZhang's avatar
QuanluZhang committed
6
from .constants import PACKAGE_REQUIREMENTS
chicm-ms's avatar
chicm-ms committed
7
from .common_utils import print_error
8
from .command_utils import install_requirements_command
QuanluZhang's avatar
QuanluZhang committed
9
10
11
12
13
14

def process_install(package_name):
    if PACKAGE_REQUIREMENTS.get(package_name) is None:
        print_error('{0} is not supported!' % package_name)
    else:
        requirements_path = os.path.join(nni.__path__[0], PACKAGE_REQUIREMENTS[package_name])
15
        install_requirements_command(requirements_path)
QuanluZhang's avatar
QuanluZhang committed
16
17
18
19

def package_install(args):
    '''install packages'''
    process_install(args.name)
20

QuanluZhang's avatar
QuanluZhang committed
21
22
23
def package_show(args):
    '''show all packages'''
    print(' '.join(PACKAGE_REQUIREMENTS.keys()))
24