mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
added install/uninstall packages for python
This commit is contained in:
@@ -29,6 +29,21 @@ def do_uninstall(pkg):
|
||||
error("Python package management tool 'pip' not found. Please install 'pip'", ERROR_NO_PACKAGING_TOOLS)
|
||||
return pip.main(['uninstall', '-y', pkg])
|
||||
|
||||
def do_install(pkg, options):
|
||||
"""
|
||||
simple realization for install packages
|
||||
"""
|
||||
#TODO: test install
|
||||
try:
|
||||
import pip
|
||||
except ImportError:
|
||||
error("Python package management tool 'pip' not found. Please install 'pip'", ERROR_NO_PACKAGING_TOOLS)
|
||||
|
||||
if options:
|
||||
return pip.main(['install', pkg, options])
|
||||
else:
|
||||
return pip.main(['install', pkg])
|
||||
|
||||
def main():
|
||||
retcode = 0
|
||||
try:
|
||||
@@ -41,10 +56,11 @@ def main():
|
||||
usage()
|
||||
do_list()
|
||||
elif cmd == 'install':
|
||||
if len(sys.argv) != 3:
|
||||
if len(sys.argv) < 3:
|
||||
usage()
|
||||
pkg = sys.argv[2]
|
||||
retcode = do_install(pkg)
|
||||
options = sys.argv[3]
|
||||
retcode = do_install(pkg, options)
|
||||
elif cmd == 'uninstall':
|
||||
if len(sys.argv) != 3:
|
||||
usage()
|
||||
|
||||
Reference in New Issue
Block a user