为提高性能,改用c替换原本的flask
This commit is contained in:
40
c/tools/pkgmanager/pkginstall.c
Normal file
40
c/tools/pkgmanager/pkginstall.c
Normal file
@ -0,0 +1,40 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "pkginstall.h"
|
||||
|
||||
int check_python(pkger *self)
|
||||
{
|
||||
//只需要检查pip是否存在,即可确定python是否存在
|
||||
int pip_ex = system("pip -V >/dev/null 2>&1");
|
||||
if(WIFEXITED(pip_ex) && WEXITSTATUS(pip_ex) == 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//TO_DO 完成一下函数实现
|
||||
|
||||
int install_dependence(pkger *self)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int check_dir(pkger *self)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int packup(pkger *self)
|
||||
{
|
||||
|
||||
}//运行包安装器时执行此函数,注意所有函数通过结构体内部调用。
|
||||
|
||||
pkger *init_pkginstaller()
|
||||
{
|
||||
pkger *self = (pkger*)malloc(sizeof(pkger));
|
||||
self->check_dir = check_dir;
|
||||
self->check_python = check_python;
|
||||
self->install_dependence = install_dependence;
|
||||
self->packup = packup;
|
||||
}
|
Reference in New Issue
Block a user