pyccel.codegen.wrappergen module#
A module containing the Wrappergen class which is responsible for the generation of wrapper files.
- class pyccel.codegen.wrappergen.Wrappergen(codegen, name, language, verbose)[source]View on GitHub#
Bases:
objectA class which handles the generation of wrapper files.
A class which handles the generation of wrapper files. These files are necessary so the generated code can be called from Python.
- Parameters:
codegen (Codegen) – The printer which was used to print the translated code.
name (str) – Name of the generated module or program.
language (str) – The language which the printer should print to.
verbose (int) – The level of verbosity.
- get_additional_imports()[source]View on GitHub#
Get the objects that were imported by the codeprinters.
Get the objects that were imported by the codeprinters. These imports may affect the necessary compiler commands.
- Returns:
A dictionary for each printed wrapper file, mapping the include strings to the import module.
- Return type:
list[dict[str, Import]]
- print(dirpath)[source]View on GitHub#
Print the wrapper code.
Print the AST objects generated by a call to the wrap() function.
- Parameters:
dirpath (str | Path) – The path to the directory where files should be printed.
- Returns:
A list of the source files printed by this function (this is not equivalent to all files printed by this function as headers are excluded).
- Return type:
list[Path]
- property printed_languagesView on GitHub#
Get a list of the languages used in the wrappers.
Get a list of the languages in which each of the wrapper files was printed.
- wrap(sharedlib_dirpath)[source]View on GitHub#
Wrap the code so it is accessible from Python.
Generate the necessary AST objects describing the wrapper(s) which are required to call the low-level code from Python.
- Parameters:
sharedlib_dirpath (str) – The folder where the generated .so file will be located.