Makeprojects
Loading...
Searching...
No Matches
makeprojects.python.BuildPythonFile Class Reference

Class to build with python scripts. More...

Inheritance diagram for makeprojects.python.BuildPythonFile:
Collaboration diagram for makeprojects.python.BuildPythonFile:

Public Member Functions

 __init__ (self, file_name, priority=None, verbose=False, function_ref=None, parms=None)
 Class to execute python code in a script.
 has_python_function (self)
 Return True if there's a callable python function.
 create_parm_string (self)
 Merge the command parameters into a single string.
 build (self)
 Execute a python script.
 clean (self)
 Delete temporary files.
 __repr__ (self)
 Convert the object into a string.
 __str__ (self)
 Convert the object into a string.
Public Member Functions inherited from makeprojects.build_objects.BuildObject
 __init__ (self, file_name, priority=None, configuration=None)
 Initializers for an BuildObject.
 run_command (self, cmd, verbose)
 Issue a command and return the generated BuildError.
 __repr__ (self)
 Convert the object into a string.
 __str__ (self)
 Convert the object into a string.

Public Attributes

 verbose = verbose
 the verbose flag
 function_ref = function_ref
 Function pointer or name of function.
 parms = parms
 Parameters for function.
Public Attributes inherited from makeprojects.build_objects.BuildObject
 file_name = os.path.abspath(file_name)
 Name of file to build.
 priority = int(priority)
 Numeric priorty in ascending order.
 configuration = configuration
 Configuration if applicable.

Detailed Description

Class to build with python scripts.

When this object is created, it can either open a python script and invoke a specific function by name with a single parameter of the working directory, or it can be given a callable python object and a {} object that is passed to the function using the double asterisk parameter list.

If function_ref is a string, it's the entry point to the file, if it is a callable python object, it's invoked directly.

Constructor & Destructor Documentation

◆ __init__()

makeprojects.python.BuildPythonFile.__init__ ( self,
file_name,
priority = None,
verbose = False,
function_ref = None,
parms = None )

Class to execute python code in a script.

The file_name parameter must have the pathname to the python script so it can be tracked for debugging. If function_ref is a string, it will be used as the entry point to the python script, otherwise it has to be a callable object that accepts the parms value for the parameter list.

Parameters
file_namePathname to the *.py to build
priorityPriority to build this object
verboseTrue if verbose output
function_refPython function pointer or name
parmsParameter list to issue to the function
Exceptions
ValueError

Member Function Documentation

◆ __repr__()

makeprojects.python.BuildPythonFile.__repr__ ( self)

Convert the object into a string.

Returns
A full string.

◆ __str__()

makeprojects.python.BuildPythonFile.__str__ ( self)

Convert the object into a string.

Returns
A full string.

◆ build()

makeprojects.python.BuildPythonFile.build ( self)

Execute a python script.

  Execute either a python function, or load a python script and invoke
  a specific entry point.

  The function must return an integer error code, with zero being no
  error.
Returns
BuildError object

Reimplemented from makeprojects.build_objects.BuildObject.

◆ clean()

makeprojects.python.BuildPythonFile.clean ( self)

Delete temporary files.

  This function is called by ``cleanme`` to remove temporary files.

  On exit, return 0 for no error, or a non zero error code if there was an
  error to report. None if not implemented or not applicable.
Returns
None if not implemented, otherwise an integer error code.

Reimplemented from makeprojects.build_objects.BuildObject.

◆ create_parm_string()

makeprojects.python.BuildPythonFile.create_parm_string ( self)

Merge the command parameters into a single string.

Returns
String of all the parameters. Can be an empty string.

◆ has_python_function()

makeprojects.python.BuildPythonFile.has_python_function ( self)

Return True if there's a callable python function.

Returns
True if there is a callable python function.