本文整理汇总了Python中projects.Projects类的典型用法代码示例。如果您正苦于以下问题:Python Projects类的具体用法?Python Projects怎么用?Python Projects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Projects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
def delete(self, name):
try:
project = Projects(name)
git = Git(project)
git.clear_repo()
project.clear_branches()
project.delete()
self.write(cyclone.escape.json_encode({'status': 'project deleted'}))
except Exception, e:
log.err(e)
self.write(cyclone.escape.json_encode({'status': 'failed to delete %s' % str(e)}))
示例2: put
def put(self, name):
project = Projects(name)
try:
for aname, arg in self.request.arguments.iteritems():
if aname in ('branch'):
branch = arg
else:
setattr(project, aname, arg[0])
project.save()
except Exception, e:
log.err(e)
self.finish(cyclone.escape.json_encode({'status': 'fail'}))
示例3: delete
def delete(self, name):
log.msg("deleting project %s" % name)
try:
project = Projects(name)
git = Git(project)
git.clear_repo()
project.clear_branches()
project.delete()
self.write(cyclone.escape.json_encode({"status": "project deleted"}))
except Exception, e:
log.err(e)
self.write(cyclone.escape.json_encode({"status": "failed to delete %s" % str(e)}))
示例4: main_launch_project
def main_launch_project(args, input, state, output):
projects = Projects()
try_restore_previous_state(input, "y", state)
# It is not possible to instruct Visual Studio to start with a specific
# configuration so we do not ask the user and randomly specify "x64"
selected_architecture = "x64"
compilers = Compilers(selected_architecture)
compiler = compilers.select_compiler(input, state, output)
projects.get(args.launch).launch(compiler)
示例5: __init__
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.workdir = self.git.workdir
self.build_system = BrickConfig().get('build', 'system')
self.ftp_host = BrickConfig().get('ftp', 'host')
self.ftp_user = BrickConfig().get('ftp', 'user')
self.ftp_pass = BrickConfig().get('ftp', 'pass')
self.ftp_dir = BrickConfig().get('ftp', 'dir')
if self.build_system == 'rpm':
self.package_builder = RpmBuilder(self)
elif self.build_system == 'deb':
self.package_builder = DebBuilder(self)
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
示例6: __init__
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
示例7: main_bootstrap_build
def main_bootstrap_build(args, input, state, output):
try:
print("")
output.print_main_title()
try_restore_previous_state(input, "n", state)
target = select_target(input, state, output)
Path("Build").mkdir(exist_ok=True)
dependencies = Dependencies()
dependencies.check(output)
projects = Projects(target)
projects.set_environment_variables(output)
download_source_packages(projects, args.skip_downloads, input, state,
output)
compilers = Compilers(target)
compiler = compilers.select_compiler(input, state, output)
build_configuration = BuildConfiguration()
build_configuration.select_configuration(target.architecture,
compiler, input, state)
cmake = CMake(compiler.cmake_generator)
cmake.install(target, state, output)
codesmithymake = CodeSmithyMake(target.architecture)
build_tools = BuildTools(cmake, compiler, codesmithymake)
projects.build(build_tools, build_configuration,
input, state, output)
print("")
output.print_step_title("Running tests")
if args.skip_tests:
print(" Skipping tests")
else:
projects.test(compiler, build_configuration.architecture_dir_name,
input)
output.next_step()
print("")
output.print_step_title("Setting up second-phase of bootstrap")
second_phase_path = str(Path(os.getcwd()).parent) + \
"/SecondPhaseBootstrap"
Path(second_phase_path).mkdir(exist_ok=True)
print(second_phase_path)
# TODO
shutil.copyfile("Build/CodeSmithyIDE/CodeSmithy/Bin/x64/CodeSmithy.exe", second_phase_path + "/CodeSmithy.exe")
output.next_step()
except RuntimeError as error:
print("")
print("ERROR:", error)
sys.exit(-1)
示例8: put
def put(self, name):
project = Projects(name)
try:
for aname, arg in self.request.arguments.iteritems():
if aname in ("branch"):
branch = arg
else:
setattr(project, aname, arg[0])
json_data = json.loads(self.request.body)
if len(json_data.keys()) > 0:
for k, v in json_data.iteritems():
setattr(project, k, v)
project.save()
except Exception, e:
log.err(e)
self.finish(cyclone.escape.json_encode({"status": "fail"}))
示例9: draw_on_image_version_2
def draw_on_image_version_2(self, database, x_image, y_image):
list_of_arguments = ["name", "main_color", "budget_value", "budget_currency"]
list_from_sql = database.run_sql_command("""SELECT name, main_color, budget_value, budget_currency FROM project
WHERE name IS NOT NULL and main_color IS NOT NULL;""")
projects_object_list = Projects.get_projects_object_list(list_of_arguments, list_from_sql)
list_text_objects = []
for element in projects_object_list:
list_text_objects.append(
Texts(element.name, self.current_file_path + "/fonts/28_days_later.ttf", int(element.budget_eur / 250),
element.main_color[0],
element.main_color[1], element.main_color[2]))
self.draw_list_text_objects(list_text_objects, x_image, y_image)
示例10: post
def post(self, project_name):
branch = self.get_argument('branch')
project = Projects(project_name)
if branch in project.branches():
self.write(cyclone.escape.json_encode({'status': 'failed: branch already exist'}))
else:
project.add_branch(branch)
project.version(branch, '0.1')
reactor.callInThread(queue.enqueue, 'build', 'builder.build_project', {'project': project.name, 'branch': self.get_argument('branch'), 'force': True})
self.write(cyclone.escape.json_encode({'status': 'ok'}))
示例11: post
def post(self, project_name):
branch = self.get_argument("branch")
project = Projects(project_name)
if branch in project.branches():
self.write(cyclone.escape.json_encode({"status": "failed: branch already exist"}))
else:
project.add_branch(branch)
project.version(branch, "0.1")
reactor.callInThread(
build_project,
{"project": project.name, "branch": self.get_argument("branch"), "release": "experimental"},
)
self.write(cyclone.escape.json_encode({"status": "ok"}))
示例12: Builder
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:
示例13: get
def get(self, name='', branch='master'):
try:
if name:
project = Projects(name)
reply = {'name': project.name,
'branch': project.branches(),
'group_name': project.group_name,
'git_url': project.git_url,
'version': project.version(),
'last_tag_testing': project.last_tag(tag_type='testing'),
'last_tag_stable': project.last_tag(tag_type='stable'),
'last_commit': project.last_commit(branch)}
else:
projects = Projects.get_all()
reply = []
for project in projects:
reply.append(
{'name': project.name,
'branch': project.branches(),
'group_name': project.group_name,
'git_url': project.git_url,
'version': project.version(),
'last_tag_testing': project.last_tag(tag_type='testing'),
'last_tag_stable': project.last_tag(tag_type='stable'),
'last_commit': project.last_commit(branch)
})
self.write(cyclone.escape.json_encode(reply))
except Exception, e:
self.write(cyclone.escape.json_encode("%s No project found" % e))
示例14: Builder
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:
示例15: delete
def delete(self, project_name):
project = Projects(project_name)
branch = self.get_argument('branch')
project.remove_branch(branch)
self.write(cyclone.escape.json_encode({'status': 'ok'}))