pyccel.codegen.compiling.library_config module#
This module contains tools useful for handling the compilation of stdlib imports.
- class pyccel.codegen.compiling.library_config.CWrapperInstaller(file_name, folder, dependencies=(), **kwargs)[source]#
Bases:
StdlibInstaller
A class describing how the cwrapper library is installed.
A class describing how the cwrapper library is installed. This class inherits from StdlibInstaller. The specialisation is required to ensure that the file describing the NumPy version is also created.
- Parameters:
file_name (str) – Name of file that will be compiled.
folder (str) – Name of the folder in the stdlib folder where the file is found.
dependencies (iterable[str], optional) – An iterable containing the names of all the (external or internal) libraries on which this internal library depends.
**kwargs (dict) – A dictionary of additional keyword arguments that will be used when creating the CompileObj. See CompileObj for more details.
- install_to(pyccel_dirpath, installed_libs, verbose, compiler)[source]#
Install the files to the Pyccel dirpath.
Install the files to the Pyccel dirpath so they can be easily located and analysed by users. This function copies the contents of the source folder unless the folder already exists with the same contents. It returns the CompileObj that describes these new files.
- Parameters:
pyccel_dirpath (str | Path) – The path to the Pyccel working directory where the copy should be created.
installed_libs (dict[str, CompileObj]) – A dictionary describing all the libraries that have already been installed. This ensures that new CompileObjs are not created if multiple objects share the same library dependencies.
verbose (int) – The level of verbosity.
compiler (Compiler) – A Compiler object in case the installed dependency needs compiling. This is unused in this method.
- Returns:
The object that should be added as a dependency to objects that depend on this library.
- Return type:
- class pyccel.codegen.compiling.library_config.ExternalLibInstaller(dest_dir, src_dir=None)[source]#
Bases:
object
A class describing how external libraries used by Pyccel are installed.
A class describing how external libraries used by Pyccel are installed. An Installer has a install_to method which creates a CompileObj that can be used as a dependency in translations.
- Parameters:
dest_dir (str) – The name of the sub-folder into which the library should be installed. This decides the name of the folder that will be created in the __pyccel__ folder.
src_dir (str, optional) – The name of the sub-folder where the library can be found in the extensions/ folder. The default is to use the same as the dest_dir parameter.
- class pyccel.codegen.compiling.library_config.GFTLInstaller[source]#
Bases:
ExternalLibInstaller
A class describing how the external library gFTL is installed.
A class describing how the external library gFTL is installed. This specialisation allows the installation procedure to be specialised for this library.
- install_to(pyccel_dirpath, installed_libs, verbose, compiler)[source]#
Install the files to the Pyccel dirpath.
Install the files to the Pyccel dirpath so they can be easily located and analysed by users. This function creates a symlink to the Pyccel folder containing the code as these files are not expected to be modified. The symlink makes it easier for users to examine the code used. The CompileObj that describes the files is returned.
- Parameters:
pyccel_dirpath (str | Path) – The path to the Pyccel working directory where the copy should be created.
installed_libs (dict[str, CompileObj]) – A dictionary describing all the libraries that have already been installed. This ensures that new CompileObjs are not created if multiple objects share the same library dependencies.
verbose (int) – The level of verbosity.
compiler (Compiler) – A Compiler object in case the installed dependency needs compiling. This is unused in this method.
- Returns:
The object that should be added as a dependency to objects that depend on this library.
- Return type:
- class pyccel.codegen.compiling.library_config.STCInstaller[source]#
Bases:
ExternalLibInstaller
A class describing how the external library STC is installed.
A class describing how the external library STC is installed. This specialisation allows the installation procedure to be specialised for this library.
- install_to(pyccel_dirpath, installed_libs, verbose, compiler)[source]#
Install the files to the Pyccel dirpath.
Install the files to the Pyccel dirpath so they can be easily located and analysed by users. This function builds and installs the library if it is not already installed. It returns the CompileObj that describes the new installation files.
- Parameters:
pyccel_dirpath (str | Path) – The path to the Pyccel working directory where the copy should be created.
installed_libs (dict[str, CompileObj]) – A dictionary describing all the libraries that have already been installed. This ensures that new CompileObjs are not created if multiple objects share the same library dependencies.
verbose (int) – The level of verbosity.
compiler (Compiler) – A Compiler object to compile STC if it is not already installed.
- Returns:
The object that should be added as a dependency to objects that depend on this library.
- Return type:
- class pyccel.codegen.compiling.library_config.StdlibInstaller(file_name, folder, dependencies=(), **kwargs)[source]#
Bases:
object
A class describing how stdlib objects are installed.
A class describing how stdlib objects are installed. An Installer has a install_to method which creates a CompileObj that can be used as a dependency in translations.
- Parameters:
file_name (str) – Name of file that will be compiled.
folder (str) – Name of the folder in the stdlib folder where the file is found.
dependencies (iterable[str], optional) – An iterable containing the names of all the (external or internal) libraries on which this internal library depends.
**kwargs (dict) – A dictionary of additional keyword arguments that will be used when creating the CompileObj. See CompileObj for more details.
- install_to(pyccel_dirpath, installed_libs, verbose, compiler)[source]#
Install the files to the Pyccel dirpath.
Install the files to the Pyccel dirpath so they can be easily located and analysed by users. This function copies the contents of the source folder unless the folder already exists with the same contents. It returns the CompileObj that describes these new files.
- Parameters:
pyccel_dirpath (str | Path) – The path to the Pyccel working directory where the copy should be created.
installed_libs (dict[str, CompileObj]) – A dictionary describing all the libraries that have already been installed. This ensures that new CompileObjs are not created if multiple objects share the same library dependencies.
verbose (int) – The level of verbosity.
compiler (Compiler) – A Compiler object in case the installed dependency needs compiling. This is unused in this method.
- Returns:
The object that should be added as a dependency to objects that depend on this library.
- Return type: