40 lines
781 B
C
40 lines
781 B
C
#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;
|
||
} |