feat: 调用pip解决依赖

This commit is contained in:
Rock Chin
2023-01-16 21:34:35 +08:00
parent 82d845b5c8
commit 78c73def8a
3 changed files with 67 additions and 0 deletions

View File

@@ -5,6 +5,12 @@ import pkg.utils.context
def update_all() -> bool:
"""使用dulwich更新源码"""
try:
import pkg.utils.pkgmgr
pkg.utils.pkgmgr.ensure_dulwich()
except:
pass
try:
import dulwich
except ModuleNotFoundError:
@@ -37,6 +43,12 @@ def update_all() -> bool:
def get_current_version_info() -> str:
"""获取当前版本信息"""
try:
import pkg.utils.pkgmgr
pkg.utils.pkgmgr.ensure_dulwich()
except:
pass
try:
import dulwich
except ModuleNotFoundError:
@@ -62,6 +74,12 @@ def get_current_version_info() -> str:
def get_commit_id_and_time_and_msg() -> str:
"""获取当前提交id和时间和提交信息"""
try:
import pkg.utils.pkgmgr
pkg.utils.pkgmgr.ensure_dulwich()
except:
pass
try:
import dulwich
except ModuleNotFoundError:
@@ -79,6 +97,12 @@ def get_commit_id_and_time_and_msg() -> str:
def get_current_commit_id() -> str:
"""检查是否有新版本"""
try:
import pkg.utils.pkgmgr
pkg.utils.pkgmgr.ensure_dulwich()
except:
pass
try:
import dulwich
except ModuleNotFoundError:
@@ -97,6 +121,12 @@ def get_current_commit_id() -> str:
def is_new_version_available() -> bool:
"""检查是否有新版本"""
try:
import pkg.utils.pkgmgr
pkg.utils.pkgmgr.ensure_dulwich()
except:
pass
try:
import dulwich
except ModuleNotFoundError: