feat: add installp/uninstallp command

This commit is contained in:
lanvent
2023-04-06 18:06:14 +08:00
parent 40563c1e96
commit 3c6d42b22e
13 changed files with 126 additions and 12 deletions

15
common/package_manager.py Normal file
View File

@@ -0,0 +1,15 @@
import pip
def install(package):
pip.main(['install', package])
def install_requirements(file):
pip.main(['install', '-r', file, "--upgrade"])
def check_dulwich():
try:
import dulwich
return
except ImportError:
install('dulwich')
raise ImportError("Unable to import dulwich")