(self, target: build.BuildTarget)
return static_sources, generated_sources, cython_sources
Generate rules for transpiling Cython files to C or C++

        XXX: Currently only C is handled.
Generate rules for transpiling Cython files to C or C++
Generate rules for transpiling Cython files to C or C ++
def generate_cython_transpile(self, target: build.BuildTarget) -> \
            T.Tuple[T.MutableMapping[str, File], T.MutableMapping[str, File], T.List[str]]:
        """Generate rules for transpiling Cython files to C or C++

        XXX: Currently only C is handled.
        """
        static_sources: T.MutableMapping[str, File] = OrderedDict()
        generated_sources: T.MutableMapping[str, File] = OrderedDict()
        cython_sources: T.List[str] = []

        cython = target.compilers['cython']

        opt_proxy = self.get_compiler_options_for_target(target)

        args: T.List[str] = []
        args += cython.get_always_args()
        args += cython.get_buildtype_args(self.get_option_for_target(OptionKey('buildtype'), target))
        args += cython.get_debug_args(self.get_option_for_target(OptionKey('debug'), target))
        args += cython.get_optimization_args(self.get_option_for_target(OptionKey('optimization'), target))
        args += cython.get_option_compile_args(opt_proxy)
        args += self.build.get_global_args(cython, target.for_machine)
        args += self.build.get_project_args(cython, target.subproject, target.for_machine)

        ext = opt_proxy[OptionKey('language', machine=target.for_machine, lang='cython')].value

        for src in target.get_sources():
            if src.endswith('.pyx'):
                output = os.path.join(self.get_target_private_dir(target), f'{src}.{ext}')
                args = args.copy()
                args += cython.get_output_args(output)
                element = NinjaBuildElement(
                    self.all_outputs, [output],
                    self.compiler_to_rule_name(cython),
                    [src.absolute_path(self.environment.get_source_dir(), self.environment.get_build_dir())])
                element.add_item('ARGS', args)
                self.add_build(element)
                # TODO: introspection?
                cython_sources.append(output)
            else:
                static_sources[src.rel_to_builddir(self.build_to_src)] = src

        for gen in target.get_generated_sources():
            for ssrc in gen.get_outputs():
                if isinstance(gen, GeneratedList):
                    ssrc = os.path.join(self.get_target_private_dir(target), ssrc)
                else:
                    ssrc = os.path.join(gen.get_subdir(), ssrc)
                if ssrc.endswith('.pyx'):
                    args = args.copy()
                    output = os.path.join(self.get_target_private_dir(target), f'{ssrc}.{ext}')
                    args += cython.get_output_args(output)
                    element = NinjaBuildElement(
                        self.all_outputs, [output],
                        self.compiler_to_rule_name(cython),
                        [ssrc])
                    element.add_item('ARGS', args)
                    self.add_build(element)
                    # TODO: introspection?
                    cython_sources.append(output)
                else:
                    generated_sources[ssrc] = mesonlib.File.from_built_file(gen.get_subdir(), ssrc)

        return static_sources, generated_sources, cython_sources
def generate_cython_transpile ( self , target : build . BuildTarget ) -> T . Tuple [ T . MutableMapping [ str , File ] , T . MutableMapping [ str , File ] , T . List [ str ] ] : static_sources : T . MutableMapping [ str , File ] = OrderedDict ( ) generated_sources : T . MutableMapping [ str , File ] = OrderedDict ( ) cython_sources : T . List [ str ] = [ ] cython = target . compilers [ 'cython' ] opt_proxy = self . get_compiler_options_for_target ( target ) args : T . List [ str ] = [ ] args += cython . get_always_args ( ) args += cython . get_buildtype_args ( self . get_option_for_target ( OptionKey ( 'buildtype' ) , target ) ) args += cython . get_debug_args ( self . get_option_for_target ( OptionKey ( 'debug' ) , target ) ) args += cython . get_optimization_args ( self . get_option_for_target ( OptionKey ( 'optimization' ) , target ) ) args += cython . get_option_compile_args ( opt_proxy ) args += self . build . get_global_args ( cython , target . for_machine ) args += self . build . get_project_args ( cython , target . subproject , target . for_machine ) ext = opt_proxy [ OptionKey ( 'language' , machine = target . for_machine , lang = 'cython' ) ] . value for src in target . get_sources ( ) : if src . endswith ( '.pyx' ) : output = os . path . join ( self . get_target_private_dir ( target ) , f'{src}.{ext}' ) args = args . copy ( ) args += cython . get_output_args ( output ) element = NinjaBuildElement ( self . all_outputs , [ output ] , self . compiler_to_rule_name ( cython ) , [ src . absolute_path ( self . environment . get_source_dir ( ) , self . environment . get_build_dir ( ) ) ] ) element . add_item ( 'ARGS' , args ) self . add_build ( element ) # TODO: introspection? cython_sources . append ( output ) else : static_sources [ src . rel_to_builddir ( self . build_to_src ) ] = src for gen in target . get_generated_sources ( ) : for ssrc in gen . get_outputs ( ) : if isinstance ( gen , GeneratedList ) : ssrc = os . path . join ( self . get_target_private_dir ( target ) , ssrc ) else : ssrc = os . path . join ( gen . get_subdir ( ) , ssrc ) if ssrc . endswith ( '.pyx' ) : args = args . copy ( ) output = os . path . join ( self . get_target_private_dir ( target ) , f'{ssrc}.{ext}' ) args += cython . get_output_args ( output ) element = NinjaBuildElement ( self . all_outputs , [ output ] , self . compiler_to_rule_name ( cython ) , [ ssrc ] ) element . add_item ( 'ARGS' , args ) self . add_build ( element ) # TODO: introspection? cython_sources . append ( output ) else : generated_sources [ ssrc ] = mesonlib . File . from_built_file ( gen . get_subdir ( ) , ssrc ) return static_sources , generated_sources , cython_sources