def proj_create(args, config, _extra_args):
"""Creates a new em-managed project."""
tmpl_repo = config['project']['template_repo']
try:
pygit2.clone_repository(tmpl_repo, args.dest)
# delete history of template
shutil.rmtree(osp.join(args.dest, '.git'), ignore_errors=True)
pygit2.init_repository(args.dest)
except ValueError:
pass # already in a repo
for em_dir in ['experiments', 'data']:
dpath = osp.join(args.dest, em_dir)
if not osp.isdir(dpath):
os.mkdir(dpath)
with shelve.open(osp.join(args.dest, '.em')) as emdb:
emdb['__em__'] = {}
评论列表
文章目录