Files
chat_rebot-connect-with-one…/c/tools/pkgmanager/pkginstall.c

40 lines
781 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}