10.2. instlInstanceBase — instl base class

Source code: :source:`pyinstl/instlInstanceBase.py`

10.2.1. Methods

instlInstanceBase.prepare_args_parser()

Prepares the command line argument parser for InstlInstanceBase.

10.2.2. Class InstlInstanceBase

class instlInstanceBase.InstlInstanceBase

InstlInstanceBase encapsulated the functionality of instl.

InstlInstanceBase is inherited for the purpose of overriding platform specific functions. All inheritors from InstlInstanceBase are called InstlInstance, the main module imports the appropriate one at run time, according to the current os.

install_definitions_index

A dictionary holding the index of install items.

cvl

Object of type configVarList.ConfigVarList holding the variable definitions.

variables_assignment_lines

A list holding the lines to be written to the batch file, each line containing a variable definition. Function create_variables_assignment is responsible for creating these lines.

install_instruction_lines

A list holding the lines to be written to the batch file, each line containing a install operation such as mkdir, or svn checkout. Function create_install_instructions is responsible for creating these lines.

var_replacement_pattern

A compiled regular expression stating how to convert $(ABC) style variable references to platform specific references such as %ABC% on Windows or ${ABC} on Mac. Initially var_replacement_pattern isn None, it must be assigned a real value by classes overriding InstlInstanceBase such as instlInstance_mac.InstlInstance_mac and instlInstance_win.InstlInstance_win.

repr_for_yaml(self, what=None)

Returns a list of objects representing the current state of instl, in a format suitable for printing by augmentedYaml. If parameter what is None, the list will contain two documents, one representing the define part, one representing the index part. If parameter what is a list of identifiers, only variables and index entries from the list are returned.

read_command_line_options(self, arglist=None)

Parse the command line argument list. If arglist is non or contains no arguments, mode is changed to “interactive”. Otherwise, if arglist has arguments, mode is “batch” and the arguments are parsed. Parser is created using prepare_args_parser(), and the parsing returns a cmd_line_options object. Finally init_from_cmd_line_options() is called.

init_from_cmd_line_options(self, cmd_line_options_obj)

Sets several variables according to the values given in the command line arguments. Called after the command line arguments were processed.

digest(self)

Called after reading all the input files. Initializes __MAIN_INSTALL_TARGETS__ either from __CMD_INSTALL_TARGETS__ (command line argument) or MAIN_INSTALL_TARGETS (from definitions file).

read_defines(self, a_node)

Reads Yaml node containing variable definitions.

read_index(self, a_node)

Reads Yaml node containing index items.

read_input_files(self)

Reads the input files specified in variable __MAIN_INPUT_FILES__.

read_file(self, file_path)

Reads a single yaml file. Calls read_defines() or read_index() according to the yaml tags in the file.

resolve(self)

Resolve $() style references in variables. Calls ConfigVarList:resolve().

sort_install_instructions_by_folder(self)

Returns a dictionary whose keys are folders and values are sets of IDDs of install targets that specified the folder as their install_folder. The targets are taken from the variable __FULL_LIST_OF_INSTALL_TARGETS__.

create_install_list(self)

Creates the variable __FULL_LIST_OF_INSTALL_TARGETS__ and populates it’s values with the full list of all targets that are marked for install. Initial list of targets is taken from the variable __MAIN_INSTALL_TARGETS__. The initial list is recursively seached for dependencies. Target IDDs that are referred to but are not in the index are added to the variable __ORPHAN_INSTALL_TARGETS__.

get_install_instructions_prefix(self)

Creates the first lines of the install batch file. get_install_instructions_prefix() is overridden by platform-specific class that inherits from instlInstanceBase.

get_install_instructions_postfix(self)

Creates the last lines of the install batch file. get_install_instructions_postfix() is overridden by platform-specific class that inherits from instlInstanceBase.

mkdir(self, directory)

Creates platform specific mkdir command install script Overridden by instlInstance_mac.InstlInstance_mac and instlInstance_win.InstlInstance_win.

cd(self, directory)

Creates platform specific change dir command install script Overridden by instlInstance_mac.InstlInstance_mac and instlInstance_win.InstlInstance_win.

create_variables_assignment(self)

Creates the lines in the install batch file that assign values to variables. All variables in cvl are added to variables_assignment_lines except internal identifiers. internal identifiers are those beginning and ending in __, such as __FULL_LIST_OF_INSTALL_TARGETS__.

create_install_instructions(self)

Creates the lines of the install batch file, by updating install_instruction_lines. Calls create_variables_assignment(), create_install_list(), sort_install_instructions_by_folder().

write_install_batch_file(self)

Writes the install batch file to the path in variable __MAIN_OUT_FILE__ or if it does not exist to stdout. Calls get_install_instructions_prefix(), get_install_instructions_postfix(), get_install_instructions_postfix().

write_program_state(self)

Writes the current state of instlObj to the path in variable __MAIN_STATE_FILE__ or if it does not exist to stdout.

evaluate_graph(self)

Evaluates the install index. Attempts to find cycles in dependencies and find leafs - those items that do not depend on other items. Uses installItemGraph to do it’s work. Will only work if installItemGraph can be loaded.

do_da_interactive(self)

Activates **instl*’s interactive mode by calling instlInstanceBase_interactive.go_interactive()