pyccel.codegen.utilities module

pyccel.codegen.utilities module#

This file contains some useful functions to compile the generated fortran code

pyccel.codegen.utilities.copy_internal_library(dst_folder, lib_path, pyccel_dirpath, *, extra_files=None)[source]#

Copy an internal library to the specified Pyccel directory.

Copy an internal library from its specified stdlib folder to the Pyccel directory. The copy is only done if the files are not already present or if the files have changed since they were last copied. Extra files can be added to the folder if and when the copy occurs (e.g. for specifying the NumPy version compatibility).

Parameters:
  • dst_folder (str) – The name of the folder to be copied to, relative to the __pyccel__ folder.

  • lib_path (str) – The absolute path to the folder to be copied.

  • pyccel_dirpath (str) – The location that the folder should be copied to.

  • extra_files (dict) – A dictionary whose keys are the names of any files to be created in the folder and whose values are the contents of the file.

Returns:

The location that the files were copied to.

Return type:

str

pyccel.codegen.utilities.recompile_object(compile_obj, compiler, language, verbose=False)[source]#

Compile the provided file if necessary.

Check if the file has already been compiled, if it hasn’t or if the source has been modified then compile the file.

Parameters:
  • compile_obj (CompileObj) – The object to compile.

  • compiler (str) – The compiler used.

  • language (str) – The language in which code is being printed.

  • verbose (int) – Indicates the level of verbosity.