示例#1
0
文件: gitshell.py 项目: Vulcaine/APPI
def RegisterGitRemote(remote):

    if assertsh.AssertGitInstalled():
        if assertsh.AssertCall("git remote add origin {}".format(remote)):
            sh.Call("git remote -v")
            return Logger.Success("git setup complete on: {}".format(remote))
        else:
            return Logger.Failed("Could not add git remote: {}".format(remote))
    else:
        return Logger.Failed("Unexpected error during git installation.")
示例#2
0
def DownloadAndInstallWindowsService(service, serviceName):
    conf = config.GetConfig()

    exeName = serviceName + '.exe'
    exePath = conf['temp-download-folder'] + '/' + serviceName + '/' + exeName

    if DownloadTo(service['url'], serviceName, exeName):
        Logger.Success("Download finished")
        Logger.Info("Installing {}.. Follow the instructions.".format(exeName),
                    end=' ')

        if InstallExe(exePath):
            return Logger.Success("Install finished")

        return Logger.Failed("Unexpected error during installation..")

    return Logger.Failed("Unexpected error during download..")
示例#3
0
def AddToPath(syspath):
    if not IsAdmin():
        return Logger.Failed("You have no permission to modify the path.")

    Logger.Info("Trying to add {} to path..".format(syspath), end=' ')

    if not syspath in os.environ['PATH']:
        if sys.platform == "win32":
            path = os.pathsep + syspath
            oldpath = os.environ['PATH']
            Call('setx OLDPATH {}'.format(oldpath))
            Call('setx /M PATH "%PATH%;{}"'.format(path))
        return Logger.Success("OK")
    else:
        return Logger.Success("Path already defined, skipping")