pyccel.codegen.compiling.basic module#
Module handling classes for compiler information relevant to a given object
- class pyccel.codegen.compiling.basic.CompileObj(file_name, folder, flags=(), include=(), libs=(), libdir=(), dependencies=(), extra_compilation_tools=(), has_target_file=True, prog_target=None)[source]View on GitHub#
Bases:
objectClass containing all information necessary for compiling.
A class which stores all information which may be needed in order to compile an object. This includes its name, location, and all dependencies and flags which may need to be passed to the compiler.
- Parameters:
file_name (str) – Name of file to be compiled.
folder (str) – Name of the folder where the file is found.
flags (str) – Any non-default flags passed to the compiler.
include (iterable of strs) – Include directories paths.
libs (iterable of strs) – Required libraries.
libdir (iterable of strs) – Paths to directories containing the required libraries.
dependencies (iterable of CompileObjs) – Objects which must also be compiled in order to compile this module/program.
extra_compilation_tools (iterable of str) – Tools used which require additional compilation flags/include dirs/libs/etc.
has_target_file (bool, default : True) – If set to false then this flag indicates that the file has no target. Eg an interface for a library.
prog_target (str, default: None) – The name of the executable that should be generated if this file is a program. If no name is provided then the module name deduced from the file name is used.
- acquire_lock()[source]View on GitHub#
Lock the file and its dependencies to prevent race conditions.
Acquire the file locks for the file being compiled, all dependencies needed to compile it and the target file which will be generated.
- acquire_simple_lock()[source]View on GitHub#
Lock the file created by this CompileObj.
Acquire the file lock for the file created by this CompileObj to prevent race conditions. This function should be called when the created file is a dependency, it is therefore not necessary for it to recurse into its own dependencies.
- add_dependencies(*args)[source]View on GitHub#
Indicate that the file to be compiled depends on a given other file
- Parameters:
*args (CompileObj)
- compilation_in_progress = <filelock._unix.UnixFileLock object>#
- property dependenciesView on GitHub#
Returns the objects which the file to be compiled uses
- property extra_compilation_toolsView on GitHub#
The name of tools used which require additional compilation information.
Return a set containing the name of all tools required additional information to compile the file. This additional informationcan take the form of flags, include directories, libraries, orr library directories. Examples of ‘extra_compilation_tools’ are: openmp, openacc, python.
- property extra_modulesView on GitHub#
Returns the additional objects required to compile the file
- property flagsView on GitHub#
Returns the additional flags required to compile the file
- get_dependency(target)[source]View on GitHub#
Returns the objects which the file to be compiled uses
- property has_target_fileView on GitHub#
Indicates whether the file has a target. Eg an interface for a library may not have a target
- property includeView on GitHub#
Get the additional include directories required to compile the file.
Return a set containing all the directories which must be passed to the compiler via the include flag -I.
- property libdirView on GitHub#
Get the additional library directories required to compile the file.
Return a set containing all the directories which must be passed to the compiler via the library directory flag -L so that the necessary libraries can be correctly located.
- property libsView on GitHub#
Get the additional libraries required to compile the file.
Return a list containing all the libraries which must be passed to the compiler via the library flag -l.
- property module_targetView on GitHub#
Returns the .o file to be generated by the compilation step
- property program_targetView on GitHub#
Returns the program to be generated by the compilation step
- property python_moduleView on GitHub#
Returns the python name of the file to be compiled
- release_lock()[source]View on GitHub#
Unlock the file and its dependencies.
Release the file locks for the file being compiled, all dependencies needed to compile it and the target file which will be generated.
- release_simple_lock()[source]View on GitHub#
Unlock the file created by this CompileObj.
Release the file lock for the file created by this CompileObj to prevent race conditions. This function should be called when the created file is a dependency, it is therefore not necessary for it to recurse into its own dependencies.
- reset_folder(folder)[source]View on GitHub#
Change the folder in which the source file is saved.
Change the folder in which the source file is saved. Normally the location of the source file should not change during the execution, however when working with the stdlib, the CompileObj is created with the folder set to the file’s location in the Pyccel install directory. When the file is used it is copied to the user’s folder, at which point the folder of the CompileObj must be updated.
- Parameters:
folder (str) – The new folder where the source file can be found.
- property sourceView on GitHub#
Returns the file to be compiled
- property source_folderView on GitHub#
Returns the location of the file to be compiled