PyXMake Developer Guide: PyXMake.Build.Make.Py2X Class Reference

| PyXMake Developer Guide 1.0 PyXMake

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PyXMake.Build.Make.Py2X Class Reference

Base class for all Py2X (for now only f2py) build events. More...

Inheritance diagram for PyXMake.Build.Make.Py2X:

## Public Member Functions
| __init__ (self, *args, **kwargs)
| parse (cls, *args, **kwargs)
Public Member Functions inherited from PyXMake.Build.Make.Make
| __posix__ (self, **kwargs)
| AddIncludePath (self, includes)
| AddDependencyPath (self, dependencies)
| UseLibraries (self, libs)
| SourcePath (self, path)
| OutputPath (self, path, files="")
| Environment (self, path, script="ifortvars.bat")
| Preprocessing (self, cmdstring='', inend='', outend='', copyfiles=[], replace={'!DEC$ IF':'#IF','!DEC$ ELSE':'#ELSE','!DEC$ ENDIF':'#ENDIF'})
| Build (self, cmdstring, **kwargs)
| Postprocessing (self, cmdstring='')
| run (cls, **kwargs)
| create (self, **kwargs)
Public Member Functions inherited from PyXMake.Tools.Utility.AbstractBase
| __new__ (cls, *args, **kwargs)
| recover (cls, *args)
| classify (cls, *args, **kwargs)
| jsonify (self)
| update (self, **kwargs)
| __repr__ (self)
| __str__ (self)
| __getstate__ (self)
| __setstate__ (self, _dict)
Public Member Functions inherited from PyXMake.Build.Make.NT
Public Member Functions inherited from PyXMake.Build.Make.OS
Public Member Functions inherited from PyXMake.Build.Make.POSIX
| __create__ (self, **kwargs)

## Static Public Member Functions
| inspect (package, **kwargs)
| show (package, feature, **kwargs)
| callback (*args)
Static Public Member Functions inherited from PyXMake.Build.Make.Make
| __parser__ ()
| Detach ()
| F2CPreprocessing (PreprocessingFile)
| sanitize (string, **kwargs)
| setup (*args, **kwargs)
Static Public Member Functions inherited from PyXMake.Tools.Utility.AbstractBase
| __getbase__ (base, cls)

## Public Attributes
str | MakeObjectKind = 'Py2X'
| String identifier of current instance.
| no_static_mkl = kwargs.get('no_static_mkl', True)
| Define whether Intel's MKL should be statically or dynamically linked.
| no_mkl = kwargs.get("no_mkl", self.hasFoss and (Utility.GetExecutable("choco") or Utility.GetPlatform() in ["linux","cygwin","msys","darwin"]))
| Define whether Intel's MKL should be discarded Defaults to False on NT systems.
| no_append_arch = kwargs.get('no_append_arch', False)
| Define whether the architecture shall be appended to the build name.
| incremental = kwargs.get('incremental', False)
| Define if the input should be compiled exactly as provided.
str | path2exe = sys.executable.replace("\python.exe","")
| Absolute system path to Python executable.
str | exe = 'python.exe'
| The executable command used in the main build event.
str | buildname = self.buildid+"_pyd"+self.architecture+".f90"
| Temporary build name of current job.
str | architecture = "x86":
| incdirs
| libs = list(Utility.ArbitraryFlattening(self.libs))
str | libs = "Library" if Utility.GetPlatform() in ["windows"] else ""
list | incremental = [x for x in self.srcs if os.path.splitext(x)[1].lower() in (".for", ".f95", ".f", ".f90")]
copyfile(os.path.join(Path2Config,), os.path.join(self.scrtdir,)) | bare = proc.pid:
| Iterate through all active processes matching the current BuildID and kill them.
| temps = self.temps + (".f2py_f2cmap", self.buildname)
| Tuple of temporary files deleted after job completion.
| buildid = proc.pid;
| hasFoss
Public Attributes inherited from PyXMake.Build.Make.Make
| buildid = BuildID
| Base string of build object.
list | srcs = []
| Source file or folders.
list | bare = not BuildID and not self.srcs
| stype = kwargs.get("stype",'Fortran')
| Source file type.
| verbose = verbose
| Level of verbosity of the current build object.
| hasFoss = kwargs.get("foss", Utility.GetExecutable("choco") or Utility.GetPlatform() in ["linux"] or kwargs.get("bash",False))
| Toggle between free open source software and commercial 3rd party libraries.
| scrtdir = os.getcwd()
| Current scratch directory
| srcdir = os.getcwd()
| Default search directory for source files.
| outdir = os.getcwd()
| Default search directory for output.
_, self.intelpath, self.iniCompiler | intelpath = content
| Path to Intel Fortran Compiler (read from Paths.log or empty).
tuple | temps = ()
| Tuple of data to be removed after job completion.
list | incdirs = []
| List of include directories.
list | libdirs = []
| List of library directories.
list | libs = []
| List of actual libraries (by name) used during linking.
list | copyfiles = []
| List of files to be copied to the output directory after finish.
str | iniCompiler = ""
| Default initialization of compiler script.
bool | setarch = True if kwargs.get('arch', None) in ['x86', 'x64'] else False
| Define the architecture for the build directly by using the keyword argument "arch".
| msvsc = kwargs.get("msvsc",'vs2015')
| Default version of Microsoft visual studio used by the Intel Fortran Compiler.
str | architecture = 'x86'
| Processor architecture.
str | postcmd = ""
| Post build command.
| buildname = self.temps + (inputfile, )
str | precmd = self.iniCompiler+" "+cmdstring
| Command executed during pre-build event.
| compargs = cmdstring
| Command line arguments passed in by the user.
str | makecmd = self.iniCompiler+" "+os.path.join(self.path2exe,self.exe)+" "+ cmd + cmdstring
| Command executed during build event.
| mkl_dependency
Public Attributes inherited from PyXMake.Build.Make.NT
str | SystemObjectKind = "NT"
| String identifier of current instance.
Public Attributes inherited from PyXMake.Build.Make.OS
str | SystemObjectKind = "Base"
| String identifier of current instance.
Public Attributes inherited from PyXMake.Build.Make.POSIX
str | SystemObjectKind = "POSIX"
| String identifier of current instance.
| scrtdir
| Overwrite create method in all subclasses to use a predefined MakeFile for all builds.
| temps = self.temps + ("Makefile",)
| Overwrite create method in all subclasses to use a predefined MakeFile for all builds.
| environ = copy.deepcopy(getattr(os.environ,"_data",{}))
| precmd = GetPreprocessingCommand(1).split() + self.precmd.split()[4:]; self.precmd.insert(-1,"-o")
str | precmd = ""
| verbose
| intermediate_wrapper
| wrapper_module = self.scrtdir)
| libdirs
| outdir
| Accept both OutLibs and OutDir variable.
| outlibs = self.outmodule:
| outmodule = True)

## Additional Inherited Members
Protected Attributes inherited from PyXMake.Build.Make.Make
list | _mkl_includes = [x for x in self.incdirs if "mkl" in x]

## Detailed Description

Base class for all Py2X (for now only f2py) build events.

    Inherited class to build projects using Py2X.

Inherited from Make and flavors in dependence of the underlying or requested operating system (optionally).

## Constructor & Destructor Documentation

## ◆ __init__()

PyXMake.Build.Make.Py2X.__init__ | ( |  | self,
|  | * | args,
|  | ** | kwargs )

    Initialization of Py2X class object.

    @note Currently uses f2py - but should be build with Py2X (DLR) in the future

Reimplemented from PyXMake.Build.Make.Make.

Definition at line 1958 of file Make.py.

## Member Function Documentation

## ◆ callback()

PyXMake.Build.Make.Py2X.callback | ( | * | args | ) |
| static

    Get callback of any Python object.

Definition at line 2152 of file Make.py.

## ◆ inspect()

PyXMake.Build.Make.Py2X.inspect | ( |  | package,
|  | ** | kwargs )
| static

    Inspect the content of a given f2py package. Returns all qualified modules with their respective functions

Definition at line 2108 of file Make.py.

## ◆ parse()

PyXMake.Build.Make.Py2X.parse | ( |  | cls,
|  | * | args,
|  | ** | kwargs )

    Execute the current class as a CLI command.

Definition at line 2160 of file Make.py.

## ◆ show()

PyXMake.Build.Make.Py2X.show | ( |  | package,
|  |  | feature,
|  | ** | kwargs )
| static

    Inspect the documentation content of a given f2py package feature by default.
    Optional, define callback to return any other existing attribute.

Definition at line 2120 of file Make.py.

## Member Data Documentation

## ◆ architecture

str PyXMake.Build.Make.Py2X.architecture = "x86":

Definition at line 2025 of file Make.py.

## ◆ bare

PyXMake.Build.Make.Py2X.bare = proc.pid:

Iterate through all active processes matching the current BuildID and kill them.

Do not attempt on public machines (kills everything silently).

Definition at line 2068 of file Make.py.

## ◆ buildid

PyXMake.Build.Make.Py2X.buildid = proc.pid;

Definition at line 2086 of file Make.py.

## ◆ buildname

str PyXMake.Build.Make.Py2X.buildname = self.buildid+"_pyd"+self.architecture+".f90"

Temporary build name of current job.

Definition at line 2023 of file Make.py.

## ◆ exe

str PyXMake.Build.Make.Py2X.exe = 'python.exe'

The executable command used in the main build event.

Verify that a f2py version is accessible.

We are either on Linux or within a virtual environment (Poetry). Attempt to find f2py through the $PATH variable. Raise an error to indicate that the operation will not succeed.

Definition at line 1989 of file Make.py.

## ◆ hasFoss

PyXMake.Build.Make.Py2X.hasFoss

Definition at line 2100 of file Make.py.

## ◆ incdirs

PyXMake.Build.Make.Py2X.incdirs

Definition at line 2033 of file Make.py.

## ◆ incremental [1/2]

PyXMake.Build.Make.Py2X.incremental = kwargs.get('incremental', False)

Define if the input should be compiled exactly as provided.

Defaults to False, meaning that merging & pre-processing utilities will be carried out.

Definition at line 1983 of file Make.py.

## ◆ incremental [2/2]

list PyXMake.Build.Make.Py2X.incremental = [x for x in self.srcs if os.path.splitext(x)[1].lower() in (".for", ".f95", ".f", ".f90")]

Definition at line 2061 of file Make.py.

## ◆ libs [1/2]

PyXMake.Build.Make.Py2X.libs = list(Utility.ArbitraryFlattening(self.libs))

Definition at line 2040 of file Make.py.

## ◆ libs [2/2]

str PyXMake.Build.Make.Py2X.libs = "Library" if Utility.GetPlatform() in ["windows"] else ""

Definition at line 2046 of file Make.py.

## ◆ MakeObjectKind

str PyXMake.Build.Make.Py2X.MakeObjectKind = 'Py2X'

String identifier of current instance.

Definition at line 1967 of file Make.py.

## ◆ no_append_arch

PyXMake.Build.Make.Py2X.no_append_arch = kwargs.get('no_append_arch', False)

Define whether the architecture shall be appended to the build name.

Defaults to False, meaning that the architecture is appended.

Definition at line 1979 of file Make.py.

## ◆ no_mkl

PyXMake.Build.Make.Py2X.no_mkl = kwargs.get("no_mkl", self.hasFoss and (Utility.GetExecutable("choco") or Utility.GetPlatform() in ["linux","cygwin","msys","darwin"]))

Define whether Intel's MKL should be discarded Defaults to False on NT systems.

Defaults to True on Linux systems in a Docker instance. Overwrites previous setting.

Definition at line 1975 of file Make.py.

## ◆ no_static_mkl

PyXMake.Build.Make.Py2X.no_static_mkl = kwargs.get('no_static_mkl', True)

Define whether Intel's MKL should be statically or dynamically linked.

Defaults to True, meaning that Intel's MKL has to be provided by the operating system.

Definition at line 1971 of file Make.py.

## ◆ path2exe

str PyXMake.Build.Make.Py2X.path2exe = sys.executable.replace("\python.exe","")

Absolute system path to Python executable.

Definition at line 1987 of file Make.py.

## ◆ temps

PyXMake.Build.Make.Py2X.temps = self.temps + (".f2py_f2cmap", self.buildname)

Tuple of temporary files deleted after job completion.

Has already stored custom variable declaration mapping file used by f2py.

Definition at line 2076 of file Make.py.

The documentation for this class was generated from the following file:

- src/PyXMake/Build/Make.py