本文整理汇总了Python中projects.Projects.is_building方法的典型用法代码示例。如果您正苦于以下问题:Python Projects.is_building方法的具体用法?Python Projects.is_building怎么用?Python Projects.is_building使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects.Projects
的用法示例。
在下文中一共展示了Projects.is_building方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Builder
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import is_building [as 别名]
class Builder(object):
def __init__(self, project):
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
self.build_options = BuildOptions(self.git.workdir)
self.build_container = None
self.workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'),
self.project.name,
)
self.real_workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'), self.project.name
)
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
log.msg("[%s] exec: %s %s [%s]" % (self.project.name, cmd, args, kwargs))
return subprocess.Popen(cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None, commit=None):
if not self.project.is_building():
self.project.start_building()
try:
if (release is not None and version is not None):
log.msg("[%s] git fetch/clone" % (self.project.name,))
if (not self.git.pull()):
self.git.clone(branch)
self.workdir = "%s-%s" % (self.git.workdir, release)
self.real_workspace = "%s-%s" % (self.real_workspace, release)
if (os.path.exists(self.workdir)):
shutil.rmtree(self.workdir, ignore_errors=True)
shutil.copytree(self.git.workdir, self.workdir, True)
log.msg("[%s] shutil.copytree: ok" % (self.project.name,))
if self.build_system == 'rpm':
self.package_builder = BuilderRpm(self)
elif self.build_system == 'deb':
self.package_builder = BuilderDeb(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental' and self.build_options.changelog:
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
if release != None and commit != None:
self.git.checkout_tag(commit)
self.package_builder.build(branch, force_version=version, force_release=release)
self.package_builder.upload(release)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
except Exception, e:
log.msg("[%s] %s" % (self.project.name, traceback.format_exc()))
finally:
示例2: Builder
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import is_building [as 别名]
class Builder(object):
def __init__(self, project):
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
self.build_options = BuildOptions(self.git.workdir)
self.build_container = None
self.workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'),
self.project.name,
)
self.real_workspace = "%s/%s" % (
BrickConfig().get('workspace', 'dir'), self.project.name
)
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
if True or self.build_options.not_found:
return subprocess.Popen(cmd, *args, **kwargs)
else:
chroot_cmd = "chroot %s bash -c \"cd %s; %s\"" % (self.build_container.dir, self.real_workspace, " ".join(cmd))
kwargs.update({'shell': True})
return subprocess.Popen(chroot_cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None, commit=None):
if not self.project.is_building():
self.project.start_building()
try:
self.workdir = "%s-%s" % (self.git.workdir, release)
self.real_workspace = "%s-%s" % (self.real_workspace, release)
shutil.copytree(self.git.workdir, self.workdir)
if self.build_system == 'rpm':
self.package_builder = BuilderRpm(self)
elif self.build_system == 'deb':
self.package_builder = BuilderDeb(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental' and self.build_options.changelog:
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
if release != None and commit != None:
self.git.checkout_tag(commit)
self.package_builder.build(branch, force_version=version, force_release=release)
self.package_builder.upload(release)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
except Exception, e:
log.exception("build failed: %s" % repr(e))
finally:
示例3: __init__
# 需要导入模块: from projects import Projects [as 别名]
# 或者: from projects.Projects import is_building [as 别名]
class Builder:
def __init__(self, project):
self.workspace = BrickConfig().get('workspace', 'dir')
self.project = Projects(project)
self.templates_dir = BrickConfig().get('workspace', 'template_dir')
self.git = git.Git(self.project)
self.build_system = BrickConfig().get('build', 'system')
if self.build_system == 'rpm':
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', '%{buildroot}'
)
elif self.build_system == 'deb' or self.build_system == None:
self.mod_install_cmd = self.project.install_cmd.replace(
'BUILDROOT', 'debian/tmp'
)
if not os.path.isdir(self.workspace):
os.makedirs(self.workspace)
if not os.path.isdir(os.path.join(self.workspace, 'log')):
os.makedirs(os.path.join(self.workspace, 'log'))
self.stdout = None
self.stderr = self.stdout
def _exec(self, cmd, *args, **kwargs):
return subprocess.Popen(cmd, *args, **kwargs)
def build_project(self, branch=None, release=None, version=None):
if not self.project.is_building():
self.project.start_building()
try:
self.workdir = "%s-%s" % (self.git.workdir, release)
shutil.copytree(self.git.workdir, self.workdir)
if self.build_system == 'rpm':
self.package_builder = RpmBuilder(self)
elif self.build_system == 'deb':
self.package_builder = DebBuilder(self)
os.chdir(self.workdir)
self.git.workdir = self.workdir
self.git.checkout_branch(branch)
if release == 'experimental':
self.git.checkout_branch(branch)
self.package_builder.build(branch, release)
self.package_builder.upload(branch)
else:
self.project.last_tag(release, self.git.last_tag(release))
self.git.checkout_tag(self.project.last_tag(release))
self.package_builder.build(branch, self.project.last_tag(release))
self.package_builder.upload(release)
self.git.checkout_branch('master')
shutil.rmtree(self.workdir)
except Exception, e:
log.exception("build failed: %s" % repr(e))
finally: