ext_utils#

newer_group(sources, target, missing='error')[source]#

Return true if ‘target’ is out-of-date with respect to any file listed in ‘sources’. In other words, if ‘target’ exists and is newer than every file in ‘sources’, return false; otherwise return true. ‘missing’ controls what we do when a source file is missing; the default (“error”) is to blow up with an OSError from inside ‘stat()’; if it is “ignore”, we silently drop any missing source files; if it is “newer”, any missing source files make us assume that ‘target’ is out-of-date (this is handy in “dry-run” mode: it’ll make you pretend to carry out commands that wouldn’t work because inputs are missing, but that doesn’t matter because you’re not actually going to run the commands).

class CMakeExtension(name, source_dir=None)[source]#

Bases: Extension

build_with_command(ext_builder)[source]#

Custom build_ext.build_extension in Extension instead of Command. ext_builder is the instance of build_ext command.

get_target_filename()[source]#

The file names of libraries. Currently only support one library for one extension.

get_output_filename()[source]#

The file names of outputs, which mostly is the same with get_target_filename.

class FasterTransformerExtension(name, source_dir=None, need_parallel=False)[source]#

Bases: CMakeExtension

build_with_command(ext_builder)[source]#

Custom build_ext.build_extension in Extension instead of Command. ext_builder is the instance of build_ext command.

get_target_filename()[source]#

The file names of libraries. Currently only support one library for one extension.

get_output_filename()[source]#

The file names of outputs, which mostly is the same with get_target_filename.

class BuildExtension(*args, **kwargs)[source]#

Bases: BuildExtension

Support both CppExtention of Paddle and custom extensions of PaddleNLP.