当前位置: 首页>>代码示例>>Python>>正文


Python projects.Projects类代码示例

本文整理汇总了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)}))
开发者ID:netojoaobatista,项目名称:bricklayer,代码行数:11,代码来源:rest.py

示例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'}))
开发者ID:netojoaobatista,项目名称:bricklayer,代码行数:12,代码来源:rest.py

示例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)}))
开发者ID:rsampaio,项目名称:bricklayer,代码行数:12,代码来源:rest.py

示例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)
开发者ID:CodeSmithyIDE,项目名称:Bootstrap,代码行数:13,代码来源:bootstrap.py

示例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
开发者ID:mateusprado,项目名称:bricklayer,代码行数:34,代码来源:builder.py

示例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
开发者ID:rhruiz,项目名称:bricklayer,代码行数:34,代码来源:builder.py

示例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)
开发者ID:CodeSmithyIDE,项目名称:Bootstrap,代码行数:60,代码来源:bootstrap.py

示例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"}))
开发者ID:rsampaio,项目名称:bricklayer,代码行数:18,代码来源:rest.py

示例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)
开发者ID:CodecoolBP20161,项目名称:python-data-visualisation-empty_and_the,代码行数:12,代码来源:images.py

示例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'}))
开发者ID:mateusprado,项目名称:bricklayer,代码行数:10,代码来源:rest.py

示例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"}))
开发者ID:rsampaio,项目名称:bricklayer,代码行数:13,代码来源:rest.py

示例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:
开发者ID:rsampaio,项目名称:bricklayer,代码行数:82,代码来源:builder.py

示例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))
开发者ID:mateusprado,项目名称:bricklayer,代码行数:32,代码来源:rest.py

示例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:
开发者ID:rhruiz,项目名称:bricklayer,代码行数:80,代码来源:builder.py

示例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'}))
开发者ID:mateusprado,项目名称:bricklayer,代码行数:5,代码来源:rest.py


注:本文中的projects.Projects类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。