Пример #1
0
    def run(self, ctx):
        args = ctx.cmd_opts
        o, a = self.parser.parse_args(args)
        if o.help:
            self.parser.print_help()
            ctx.help = True
            return
        if o.use_distutils:
            self.user_data["use_distutils"] = True
        else:
            self.user_data["use_distutils"] = False

        self.option_callback(self, o, a)

        set_scheme_options(self.scheme, o)
        flag_vals = set_flag_options(self.flag_opts, o)

        pkg = ctx.pkg

        extensions = get_extensions(ctx.pkg, ctx.top_node)
        libraries = get_compiled_libraries(ctx.pkg, ctx.top_node)
        if not self.user_data["use_distutils"]:
            yaku_ctx = ctx.yaku_configure_ctx
            if extensions or libraries:
                yaku_ctx.use_tools(["ctasks", "pyext"])

        s = ConfigureState(BENTO_SCRIPT, pkg, self.scheme, flag_vals,
                           self.user_data)
        s.dump()
Пример #2
0
    def setup(self):
        extensions = get_extensions(self.pkg, self.run_node)
        libraries = get_compiled_libraries(self.pkg, self.run_node)

        yaku_ctx = self.yaku_context
        if extensions or libraries:
            for t in ["ctasks", "pyext"]:
                try:
                    yaku_ctx.use_tools([t])
                except yaku.errors.ConfigurationFailure, e:
                    raise ConfigurationError(str(e))
Пример #3
0
    def configure(self):
        extensions = get_extensions(self.pkg, self.run_node)
        libraries = get_compiled_libraries(self.pkg, self.run_node)

        yaku_ctx = self.yaku_context
        if extensions or libraries:
            for t in ["ctasks", "pyext"]:
                try:
                    yaku_ctx.use_tools([t])
                except yaku.errors.ConfigurationFailure:
                    e = extract_exception()
                    raise ConfigurationError(str(e))
Пример #4
0
    def run(self, ctx):
        opts = ctx.cmd_opts
        o, a = self.parser.parse_args(opts)
        if o.help:
            self.parser.print_help()
            return
        if o.inplace is None:
            inplace = False
        else:
            inplace = True
        if o.verbose is None:
            verbose = False
        else:
            verbose = True
        if o.jobs:
            jobs = int(o.jobs)
        else:
            jobs = None

        extensions = get_extensions(ctx.pkg, ctx.top_node)
        libraries = get_compiled_libraries(ctx.pkg, ctx.top_node)

        if ctx.get_user_data()["use_distutils"]:
            self.build_type = "distutils"
            build_extensions = build_distutils.build_extensions
        else:
            self.build_type = "yaku"
            def builder(pkg):
                return build_yaku.build_extensions(extensions,
                        ctx.yaku_build_ctx, ctx._extensions_callback,
                        ctx._extension_envs, inplace, verbose, jobs)
            build_extensions = builder

            def builder(pkg):
                return build_yaku.build_compiled_libraries(libraries,
                        ctx.yaku_build_ctx, ctx._clibraries_callback,
                        ctx._clibrary_envs, inplace, verbose, jobs)
            build_compiled_libraries = builder

        self.section_writer.sections_callbacks["compiled_libraries"] = \
                build_compiled_libraries
        self.section_writer.sections_callbacks["extensions"] = \
                build_extensions

        def build_packages(pkg):
            return _build_python_files(pkg, ctx.top_node)
        self.section_writer.sections_callbacks["pythonfiles"] = \
                build_packages
        self.section_writer.update_sections(ctx.pkg)
Пример #5
0
    files = []
    for entry in pkg.extra_source_files:
        try:
            files.extend(expand_glob(entry, root_src))
        except IOError, e:
            raise InvalidPackage("Error in ExtraSourceFiles entry: %s" % e)

    for p in get_packages(pkg, top_node):
        files.extend(find_package(p, top_node))

    for m in pkg.py_modules:
        m_node = top_node.find_node("%s.py" % m)
        files.append(m_node.path_from(top_node))

    extensions = get_extensions(pkg, top_node)
    libraries = get_compiled_libraries(pkg, top_node)
    for e in extensions.values() + libraries.values():
        for source in e.sources:
            node = top_node.find_node(source)
            files.append(node.path_from(top_node))
    for section in pkg.data_files.values():
        for entry in section.files:
            for f in expand_glob(entry, os.path.join(root_src, section.source_dir)):
                node = top_node.find_node(os.path.join(section.source_dir, f))
                files.append(node.path_from(top_node))

    return files

def static_representation(pkg, options={}):
    """Return the static representation of the given PackageDescription
    instance as a string."""