def crear_repo(package_name):
md5hash_pn = md5(package_name).hexdigest()
first_pref = md5hash_pn[0:2]
second_pref = md5hash_pn[2:4]
workingdir = root_git_dir+"/"+first_pref+"/"+second_pref+"/" + package_name
if not(os.access(root_git_dir+"/"+first_pref, os.F_OK)):
os.mkdir(root_git_dir+"/"+first_pref)
os.mkdir(root_git_dir+"/"+first_pref+"/"+second_pref)
elif not(os.access(root_git_dir+"/"+first_pref+"/"+second_pref, os.F_OK)):
os.mkdir(root_git_dir+"/"+first_pref+"/"+second_pref)
repo = pygit2.init_repository(workingdir)
dashed_package_name=package_name.replace('.','-').lower()
myRemote = repo.remotes.create(package_name, gitlab_url+'/marvin/'+dashed_package_name+'.git')
gl = Gitlab (gitlab_url, gitlab_token)
gl.auth()
p = gl.Project({'name': package_name, 'public':True})
p.save()
return repo
评论列表
文章目录