yambs.translation package#

Module contents#

A module with interfaces for describing how sources are translated into outputs.

class yambs.translation.SourceTranslator(rule: str = 'cc', output_extension: str = '.o', dest: Path = PosixPath('$build_dir'))[source]#

Bases: NamedTuple

A structure for keeping track of how source files become different types of output files.

dest: Path#

Alias for field number 2

property generated_header: bool#

Determine if this translation produces a header file.

property gets_linked: bool#

Determine if this source’s output gets linked into a final image or executable.

output(path: Path) Path[source]#

Get the output file from a given path.

output_extension: str#

Alias for field number 1

rule: str#

Alias for field number 0

translate(path: Path) Path[source]#

Translate a path by changing its suffix.

write(stream: TextIO, out: Path, source: str, rule: str = 'build', wasm: bool = False) None[source]#

Write a ninja rule to the stream.

yambs.translation.get_translator(path: Path) SourceTranslator[source]#

Get the source translator for a given source.

yambs.translation.is_header(path: Path) bool[source]#

determine if a path points to a header file.

yambs.translation.is_source(path: Path) SourceTranslator | None[source]#

Determine if a file is a source file.