python 用于Git的Python脚本克隆每个Apelon-VA ISAAC + OCHER框架

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 用于Git的Python脚本克隆每个Apelon-VA ISAAC + OCHER框架相关的知识,希望对你有一定的参考价值。

#! /usr/bin/python
#
# Pull each Apelon-VA Repo
#

import subprocess 
import os

def git(*args):
    return subprocess.Popen(['git'] + list(args), shell=True, stdout=subprocess.PIPE).communicate()[0]

projects = ['va-isaac-parent', 'va-ochre', 'va-isaac-metadata', 'va-isaac-mojo', 'va-newtons-cradle', 'va-logic', 'va-query-service', 'va-solor-goods', 'va-isaac-gui', 'va-expression-service']

for project in projects:
	repoUrl = "https://github.com/Apelon-VA/" + project + ".git"
	gitArgs = ['git', 'clone', repoUrl]

	print("Attempting to clone: " + repoUrl)
	print("GIT Command: ")
	print(list(gitArgs))
	
	output = subprocess.Popen(gitArgs, shell=True, stdout=subprocess.PIPE).communicate()[0]
	# output = git("clone", repoUrl)
	
	# TODO: What is printed when a Git Clone fails, add that to L21
	if "usage: git [--version]" in output: 
		print("GIT COMMAND PROBLEM. Fix the Git Command")
		print(output)
	elif "git error" in output:
		print("GIT ERROR")
		print("GIT ERROR!")
		if output:
			print(output)
		raise Exception("GIT ERROR!")
	else: 
		print("GIT SUCCESS!")
		print(output)
		output = None	
	break

	# Add a hook at the end of the loop to manually create a Eclipse Project in the .project file and import these repos... dope
	
	os.chdir(os.pardir)
	
	
	

以上是关于python 用于Git的Python脚本克隆每个Apelon-VA ISAAC + OCHER框架的主要内容,如果未能解决你的问题,请参考以下文章

git clone 私人仓库的更好方法是啥?

你在哪里克隆Python模块git存储库?

用于安装 aur 包的 python 脚本

如何使用 Python 和 PyGithub/GitPython 克隆我的 git 存储库?

python django -7 Git与项目

python django -7 Git与项目