本文整理汇总了Python中pants.scm.git.Git.clone方法的典型用法代码示例。如果您正苦于以下问题:Python Git.clone方法的具体用法?Python Git.clone怎么用?Python Git.clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.scm.git.Git
的用法示例。
在下文中一共展示了Git.clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: select
# 需要导入模块: from pants.scm.git import Git [as 别名]
# 或者: from pants.scm.git.Git import clone [as 别名]
def select(self, context):
self.get_options()
workdir = os.path.join(self.get_options().pants_workdir, self.options_scope,
'versions', self.get_options().version)
tool_path = os.path.join(workdir, 'bin/protoc-gen-go')
if not os.path.exists(tool_path):
safe_mkdir(workdir, clean=True)
# Checkout the git repo at a given version. `go get` always gets master.
repo = Git.clone('https://github.com/golang/protobuf.git',
os.path.join(workdir, 'src/github.com/golang/protobuf'))
repo.set_state(self.get_options().version)
go = GoDistribution.global_instance()
result, go_cmd = go.execute_go_cmd(
cmd='install',
gopath=workdir,
args=['github.com/golang/protobuf/protoc-gen-go'],
workunit_factory=context.new_workunit,
workunit_labels=[WorkUnitLabel.BOOTSTRAP],
)
if result != 0:
raise SubsystemError('{} failed with exit code {}'.format(go_cmd, result))
logger.info('Selected {} binary bootstrapped to: {}'.format(self.options_scope, tool_path))
return tool_path
示例2: fetch
# 需要导入模块: from pants.scm.git import Git [as 别名]
# 或者: from pants.scm.git.Git import clone [as 别名]
def fetch(self, dest, rev=None):
imported_repo = self._meta_tag_reader.get_imported_repo(self.import_path)
if not imported_repo:
raise FetchError('No <meta name="go-import"> tag found, so cannot fetch repo '
'at {}'.format(self.import_path))
if imported_repo.vcs != 'git':
# TODO: Support other vcs systems as needed.
raise FetchError("Don't know how to fetch for vcs type {}.".format(imported_repo.vcs))
# TODO: Do this in a workunit (see https://github.com/pantsbuild/pants/issues/3502).
logger.info('Cloning {} into {}'.format(imported_repo.url, dest))
repo = Git.clone(imported_repo.url, dest)
if rev:
repo.set_state(rev)