Module refinery.lib.inno.emulation

What an emulation of an Inno Setup script reports and how it ends: the events that the emulators of refinery.lib.inno.emulator yield, and the exceptions that end an emulation, which the script cannot handle.

Expand source code Browse git
"""
What an emulation of an Inno Setup script reports and how it ends: the events that the emulators of
`refinery.lib.inno.emulator` yield, and the exceptions that end an emulation, which the script
cannot handle.
"""
from __future__ import annotations

from enum import StrEnum
from fractions import Fraction
from typing import TYPE_CHECKING, Any, NamedTuple

from refinery.lib.inno.delphi import numbers, variants, x87
from refinery.lib.inno.delphi.errors import DelphiException
from refinery.lib.inno.delphi.variants import Variant, VarType

if TYPE_CHECKING:
    from refinery.lib.inno.archive import TextDirective, YesNoDirective
    from refinery.lib.inno.ifps import Function, Instruction
    from refinery.lib.inno.wizard import ControlEvent, PageEvent


class NeedSymbol(NotImplementedError):
    """
    An exception raised by `refinery.lib.inno.emulator.IFPSEmulator` if the runtime calls out to
    an external symbol that is not implemented.
    """


class OpCodeNotImplemented(NotImplementedError):
    """
    An exception raised by `refinery.lib.inno.emulator.IFPSEmulator` if an unsupported opcode is
    encountered during emulation.
    """


class InternalError(DelphiException):
    """
    Setup's internal error: Setup frames its reason with its message `ErrorInternal2` in the
    active language. The text of the exception has the English frame, `Internal error: %1`; the
    host gives it in the active language's frame.
    """
    def __init__(self, reason: str):
        super().__init__(F'Internal error: {reason}')
        self.reason = reason


class EmulatorException(RuntimeError):
    """
    A generic exception representing any error that occurs during emulation. It ends the emulation;
    the emulated script cannot handle it.
    """


class AbortEmulation(EmulatorException):
    """
    This exception can be raised by an external function handler to signal the emulator that script
    execution should be aborted.
    """


class EmulatorTimeout(EmulatorException, TimeoutError):
    """
    The emulation timed out based on the given time limit in the configuration.
    """


class EmulatorEndless(EmulatorTimeout):
    """
    Setup runs a loop that never ends; the emulation ends as it would at any time limit.
    """


class EmulatorExecutionLimit(EmulatorException, TimeoutError):
    """
    The emulation timed out based on the given execution limit in the configuration.
    """


class EmulatorMaxStack(EmulatorException, MemoryError):
    """
    The emulation was aborted because the stack limit given in the configuration was exceeded.
    """


class EmulatorMaxCalls(EmulatorException, MemoryError):
    """
    The emulation was aborted because the call stack limit given in the configuration was exceeded.
    """


class EmulatorMaxArray(EmulatorException, MemoryError):
    """
    The script requested a variable that holds more variables than the array length limit given in
    the configuration: an array longer than the limit, or a record or static array whose elements
    hold more variables than that.
    """


class EmulatorMaxString(EmulatorException, MemoryError):
    """
    The script requested a string longer than the string length limit given in the configuration.
    """


class EmulatorUndefined(EmulatorException):
    """
    The script asked for a result that depends on state that the emulator does not model, such as
    memory that Delphi reads or writes beyond the end of a buffer.
    """


class EmulatorMemoryError(EmulatorException, MemoryError):
    """
    Python ran out of memory while an emulated function ran.
    """


class SetupEvent(StrEnum):
    """
    The setup events that `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` sends
    to the script. The value of each event is the name of the function of the script that handles
    it.
    """
    InitializeSetup = 'InitializeSetup'
    InitializeWizard = 'InitializeWizard'
    CurStepChanged = 'CurStepChanged'
    ShouldSkipPage = 'ShouldSkipPage'
    CurPageChanged = 'CurPageChanged'
    PrepareToInstall = 'PrepareToInstall'
    CheckPassword = 'CheckPassword'
    CheckSerial = 'CheckSerial'
    NextButtonClick = 'NextButtonClick'
    UpdateReadyMemo = 'UpdateReadyMemo'
    RegisterExtraCloseApplicationsResources = 'RegisterExtraCloseApplicationsResources'
    NeedRestart = 'NeedRestart'
    RegisterPreviousData = 'RegisterPreviousData'
    GetCustomSetupExitCode = 'GetCustomSetupExitCode'
    DeinitializeSetup = 'DeinitializeSetup'


class NewFunctionCall(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` which
    represents a call to the function with the given name and arguments. Its text shows a float as
    a Python float and a Variant as the value it holds.
    """
    name: str
    args: tuple

    def __str__(self):
        return F'{self.name}({", ".join(_display(a) for a in self.args)})'


def _display(value: Any) -> str:
    if isinstance(value, Variant):
        if value.type == VarType.Empty:
            return 'Unassigned'
        if value.type == VarType.Null:
            return 'Null'
        value = value.value
    if isinstance(value, x87.Extended):
        return numbers.shortest(value)
    if isinstance(value, Fraction):
        return variants.currency_text(value, numbers.FormatSettings())
    if isinstance(value, list):
        return F'[{", ".join(_display(v) for v in value)}]'
    if value is None:
        return 'nil'
    return repr(value)


class NewPassword(str):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    password that is entered by the emulated setup script to a password edit control.
    """


class NewMutex(str):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    mutex registered by the script.
    """


class EntryParameter(StrEnum):
    """
    The parameters of an entry through which Setup runs code of the script or evaluates an
    expression: the functions it names, a code constant in any field, and the names of the
    components, tasks and languages that the entry is for.
    """
    Check = 'Check'
    BeforeInstall = 'BeforeInstall'
    AfterInstall = 'AfterInstall'
    Field = 'Field'
    Components = 'Components'
    Tasks = 'Tasks'
    Languages = 'Languages'


class EntrySection(StrEnum):
    """
    The sections of an installer whose entries Setup processes.
    """
    Types = 'Types'
    Components = 'Components'
    Tasks = 'Tasks'
    Dirs = 'Dirs'
    Files = 'Files'
    Icons = 'Icons'
    INI = 'INI'
    Registry = 'Registry'
    InstallDelete = 'InstallDelete'
    UninstallDelete = 'UninstallDelete'
    Run = 'Run'
    UninstallRun = 'UninstallRun'


class EntryField(StrEnum):
    """
    The fields of entries whose constants Setup expands, by their names in a script of Inno Setup.
    """
    Description = 'Description'
    GroupDescription = 'GroupDescription'
    Name = 'Name'
    Filename = 'Filename'
    Parameters = 'Parameters'
    WorkingDir = 'WorkingDir'
    StatusMsg = 'StatusMsg'
    Verb = 'Verb'
    RunOnceId = 'RunOnceId'
    Source = 'Source'
    DestName = 'DestName'
    ExtractArchivePassword = 'ExtractArchivePassword'
    DownloadUserName = 'DownloadUserName'
    DownloadPassword = 'DownloadPassword'
    DownloadISSigSource = 'DownloadISSigSource'
    IconFilename = 'IconFilename'
    Comment = 'Comment'
    AppUserModelID = 'AppUserModelID'
    Section = 'Section'
    Key = 'Key'
    String = 'String'
    Subkey = 'Subkey'
    ValueName = 'ValueName'
    ValueData = 'ValueData'


class EntryLocation(NamedTuple):
    """
    An entry of an installer: its section, its number in that section, counted from zero, and the
    field that the location points at, if any.
    """
    section: EntrySection
    number: int
    field: EntryField | None = None

    def __str__(self):
        text = F'[{self.section}] entry {self.number}'
        if self.field is not None:
            text = F'{text}, {self.field}'
        return text


class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'


class NewEmulationError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each call
    of an emulated function that fails with an error of the emulator rather than one of the
    script. The script sees the failure as an error that it can handle. It holds the name of the
    function and the message of the failure.
    """
    name: str
    message: str

    def __str__(self):
        return F'emulation of {self.name} failed: {self.message}'


class NewInstruction(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    executed instruction.
    """
    function: Function
    instruction: Instruction
    offset: int

Classes

class NeedSymbol (*args, **kwargs)

An exception raised by IFPSEmulator if the runtime calls out to an external symbol that is not implemented.

Expand source code Browse git
class NeedSymbol(NotImplementedError):
    """
    An exception raised by `refinery.lib.inno.emulator.IFPSEmulator` if the runtime calls out to
    an external symbol that is not implemented.
    """

Ancestors

  • builtins.NotImplementedError
  • builtins.RuntimeError
  • builtins.Exception
  • builtins.BaseException
class OpCodeNotImplemented (*args, **kwargs)

An exception raised by IFPSEmulator if an unsupported opcode is encountered during emulation.

Expand source code Browse git
class OpCodeNotImplemented(NotImplementedError):
    """
    An exception raised by `refinery.lib.inno.emulator.IFPSEmulator` if an unsupported opcode is
    encountered during emulation.
    """

Ancestors

  • builtins.NotImplementedError
  • builtins.RuntimeError
  • builtins.Exception
  • builtins.BaseException
class InternalError (reason)

Setup's internal error: Setup frames its reason with its message ErrorInternal2 in the active language. The text of the exception has the English frame, Internal error: %1; the host gives it in the active language's frame.

Expand source code Browse git
class InternalError(DelphiException):
    """
    Setup's internal error: Setup frames its reason with its message `ErrorInternal2` in the
    active language. The text of the exception has the English frame, `Internal error: %1`; the
    host gives it in the active language's frame.
    """
    def __init__(self, reason: str):
        super().__init__(F'Internal error: {reason}')
        self.reason = reason

Ancestors

Subclasses

class EmulatorException (*args, **kwargs)

A generic exception representing any error that occurs during emulation. It ends the emulation; the emulated script cannot handle it.

Expand source code Browse git
class EmulatorException(RuntimeError):
    """
    A generic exception representing any error that occurs during emulation. It ends the emulation;
    the emulated script cannot handle it.
    """

Ancestors

  • builtins.RuntimeError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class AbortEmulation (*args, **kwargs)

This exception can be raised by an external function handler to signal the emulator that script execution should be aborted.

Expand source code Browse git
class AbortEmulation(EmulatorException):
    """
    This exception can be raised by an external function handler to signal the emulator that script
    execution should be aborted.
    """

Ancestors

class EmulatorTimeout (*args, **kwargs)

The emulation timed out based on the given time limit in the configuration.

Expand source code Browse git
class EmulatorTimeout(EmulatorException, TimeoutError):
    """
    The emulation timed out based on the given time limit in the configuration.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.TimeoutError
  • builtins.OSError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class EmulatorEndless (*args, **kwargs)

Setup runs a loop that never ends; the emulation ends as it would at any time limit.

Expand source code Browse git
class EmulatorEndless(EmulatorTimeout):
    """
    Setup runs a loop that never ends; the emulation ends as it would at any time limit.
    """

Ancestors

class EmulatorExecutionLimit (*args, **kwargs)

The emulation timed out based on the given execution limit in the configuration.

Expand source code Browse git
class EmulatorExecutionLimit(EmulatorException, TimeoutError):
    """
    The emulation timed out based on the given execution limit in the configuration.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.TimeoutError
  • builtins.OSError
  • builtins.Exception
  • builtins.BaseException
class EmulatorMaxStack (*args, **kwargs)

The emulation was aborted because the stack limit given in the configuration was exceeded.

Expand source code Browse git
class EmulatorMaxStack(EmulatorException, MemoryError):
    """
    The emulation was aborted because the stack limit given in the configuration was exceeded.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.MemoryError
  • builtins.Exception
  • builtins.BaseException
class EmulatorMaxCalls (*args, **kwargs)

The emulation was aborted because the call stack limit given in the configuration was exceeded.

Expand source code Browse git
class EmulatorMaxCalls(EmulatorException, MemoryError):
    """
    The emulation was aborted because the call stack limit given in the configuration was exceeded.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.MemoryError
  • builtins.Exception
  • builtins.BaseException
class EmulatorMaxArray (*args, **kwargs)

The script requested a variable that holds more variables than the array length limit given in the configuration: an array longer than the limit, or a record or static array whose elements hold more variables than that.

Expand source code Browse git
class EmulatorMaxArray(EmulatorException, MemoryError):
    """
    The script requested a variable that holds more variables than the array length limit given in
    the configuration: an array longer than the limit, or a record or static array whose elements
    hold more variables than that.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.MemoryError
  • builtins.Exception
  • builtins.BaseException
class EmulatorMaxString (*args, **kwargs)

The script requested a string longer than the string length limit given in the configuration.

Expand source code Browse git
class EmulatorMaxString(EmulatorException, MemoryError):
    """
    The script requested a string longer than the string length limit given in the configuration.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.MemoryError
  • builtins.Exception
  • builtins.BaseException
class EmulatorUndefined (*args, **kwargs)

The script asked for a result that depends on state that the emulator does not model, such as memory that Delphi reads or writes beyond the end of a buffer.

Expand source code Browse git
class EmulatorUndefined(EmulatorException):
    """
    The script asked for a result that depends on state that the emulator does not model, such as
    memory that Delphi reads or writes beyond the end of a buffer.
    """

Ancestors

class EmulatorMemoryError (*args, **kwargs)

Python ran out of memory while an emulated function ran.

Expand source code Browse git
class EmulatorMemoryError(EmulatorException, MemoryError):
    """
    Python ran out of memory while an emulated function ran.
    """

Ancestors

  • EmulatorException
  • builtins.RuntimeError
  • builtins.MemoryError
  • builtins.Exception
  • builtins.BaseException
class SetupEvent (*args, **kwds)

The setup events that InnoSetupEmulator.emulate_installation() sends to the script. The value of each event is the name of the function of the script that handles it.

Expand source code Browse git
class SetupEvent(StrEnum):
    """
    The setup events that `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` sends
    to the script. The value of each event is the name of the function of the script that handles
    it.
    """
    InitializeSetup = 'InitializeSetup'
    InitializeWizard = 'InitializeWizard'
    CurStepChanged = 'CurStepChanged'
    ShouldSkipPage = 'ShouldSkipPage'
    CurPageChanged = 'CurPageChanged'
    PrepareToInstall = 'PrepareToInstall'
    CheckPassword = 'CheckPassword'
    CheckSerial = 'CheckSerial'
    NextButtonClick = 'NextButtonClick'
    UpdateReadyMemo = 'UpdateReadyMemo'
    RegisterExtraCloseApplicationsResources = 'RegisterExtraCloseApplicationsResources'
    NeedRestart = 'NeedRestart'
    RegisterPreviousData = 'RegisterPreviousData'
    GetCustomSetupExitCode = 'GetCustomSetupExitCode'
    DeinitializeSetup = 'DeinitializeSetup'

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var InitializeSetup

The type of the None singleton.

var InitializeWizard

The type of the None singleton.

var CurStepChanged

The type of the None singleton.

var ShouldSkipPage

The type of the None singleton.

var CurPageChanged

The type of the None singleton.

var PrepareToInstall

The type of the None singleton.

var CheckPassword

The type of the None singleton.

var CheckSerial

The type of the None singleton.

var NextButtonClick

The type of the None singleton.

var UpdateReadyMemo

The type of the None singleton.

var RegisterExtraCloseApplicationsResources

The type of the None singleton.

var NeedRestart

The type of the None singleton.

var RegisterPreviousData

The type of the None singleton.

var GetCustomSetupExitCode

The type of the None singleton.

var DeinitializeSetup

The type of the None singleton.

class NewFunctionCall (name, args)

An event generated by IFPSEmulator.emulate_function() which represents a call to the function with the given name and arguments. Its text shows a float as a Python float and a Variant as the value it holds.

Expand source code Browse git
class NewFunctionCall(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` which
    represents a call to the function with the given name and arguments. Its text shows a float as
    a Python float and a Variant as the value it holds.
    """
    name: str
    args: tuple

    def __str__(self):
        return F'{self.name}({", ".join(_display(a) for a in self.args)})'

Ancestors

  • builtins.tuple

Instance variables

var name

Alias for field number 0

Expand source code Browse git
class NewFunctionCall(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` which
    represents a call to the function with the given name and arguments. Its text shows a float as
    a Python float and a Variant as the value it holds.
    """
    name: str
    args: tuple

    def __str__(self):
        return F'{self.name}({", ".join(_display(a) for a in self.args)})'
var args

Alias for field number 1

Expand source code Browse git
class NewFunctionCall(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` which
    represents a call to the function with the given name and arguments. Its text shows a float as
    a Python float and a Variant as the value it holds.
    """
    name: str
    args: tuple

    def __str__(self):
        return F'{self.name}({", ".join(_display(a) for a in self.args)})'
class NewPassword (...)

An event generated by IFPSEmulator.emulate_function() for each password that is entered by the emulated setup script to a password edit control.

Expand source code Browse git
class NewPassword(str):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    password that is entered by the emulated setup script to a password edit control.
    """

Ancestors

  • builtins.str
class NewMutex (...)

An event generated by IFPSEmulator.emulate_function() for each mutex registered by the script.

Expand source code Browse git
class NewMutex(str):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    mutex registered by the script.
    """

Ancestors

  • builtins.str
class EntryParameter (*args, **kwds)

The parameters of an entry through which Setup runs code of the script or evaluates an expression: the functions it names, a code constant in any field, and the names of the components, tasks and languages that the entry is for.

Expand source code Browse git
class EntryParameter(StrEnum):
    """
    The parameters of an entry through which Setup runs code of the script or evaluates an
    expression: the functions it names, a code constant in any field, and the names of the
    components, tasks and languages that the entry is for.
    """
    Check = 'Check'
    BeforeInstall = 'BeforeInstall'
    AfterInstall = 'AfterInstall'
    Field = 'Field'
    Components = 'Components'
    Tasks = 'Tasks'
    Languages = 'Languages'

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var Check

The type of the None singleton.

var BeforeInstall

The type of the None singleton.

var AfterInstall

The type of the None singleton.

var Field

The type of the None singleton.

var Components

The type of the None singleton.

var Tasks

The type of the None singleton.

var Languages

The type of the None singleton.

class EntrySection (*args, **kwds)

The sections of an installer whose entries Setup processes.

Expand source code Browse git
class EntrySection(StrEnum):
    """
    The sections of an installer whose entries Setup processes.
    """
    Types = 'Types'
    Components = 'Components'
    Tasks = 'Tasks'
    Dirs = 'Dirs'
    Files = 'Files'
    Icons = 'Icons'
    INI = 'INI'
    Registry = 'Registry'
    InstallDelete = 'InstallDelete'
    UninstallDelete = 'UninstallDelete'
    Run = 'Run'
    UninstallRun = 'UninstallRun'

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var Types

The type of the None singleton.

var Components

The type of the None singleton.

var Tasks

The type of the None singleton.

var Dirs

The type of the None singleton.

var Files

The type of the None singleton.

var Icons

The type of the None singleton.

var INI

The type of the None singleton.

var Registry

The type of the None singleton.

var InstallDelete

The type of the None singleton.

var UninstallDelete

The type of the None singleton.

var Run

The type of the None singleton.

var UninstallRun

The type of the None singleton.

class EntryField (*args, **kwds)

The fields of entries whose constants Setup expands, by their names in a script of Inno Setup.

Expand source code Browse git
class EntryField(StrEnum):
    """
    The fields of entries whose constants Setup expands, by their names in a script of Inno Setup.
    """
    Description = 'Description'
    GroupDescription = 'GroupDescription'
    Name = 'Name'
    Filename = 'Filename'
    Parameters = 'Parameters'
    WorkingDir = 'WorkingDir'
    StatusMsg = 'StatusMsg'
    Verb = 'Verb'
    RunOnceId = 'RunOnceId'
    Source = 'Source'
    DestName = 'DestName'
    ExtractArchivePassword = 'ExtractArchivePassword'
    DownloadUserName = 'DownloadUserName'
    DownloadPassword = 'DownloadPassword'
    DownloadISSigSource = 'DownloadISSigSource'
    IconFilename = 'IconFilename'
    Comment = 'Comment'
    AppUserModelID = 'AppUserModelID'
    Section = 'Section'
    Key = 'Key'
    String = 'String'
    Subkey = 'Subkey'
    ValueName = 'ValueName'
    ValueData = 'ValueData'

Ancestors

  • enum.StrEnum
  • builtins.str
  • enum.ReprEnum
  • enum.Enum

Class variables

var Description

The type of the None singleton.

var GroupDescription

The type of the None singleton.

var Name

The type of the None singleton.

var Filename

The type of the None singleton.

var Parameters

The type of the None singleton.

var WorkingDir

The type of the None singleton.

var StatusMsg

The type of the None singleton.

var Verb

The type of the None singleton.

var RunOnceId

The type of the None singleton.

var Source

The type of the None singleton.

var DestName

The type of the None singleton.

var ExtractArchivePassword

The type of the None singleton.

var DownloadUserName

The type of the None singleton.

var DownloadPassword

The type of the None singleton.

var DownloadISSigSource

The type of the None singleton.

var IconFilename

The type of the None singleton.

var Comment

The type of the None singleton.

var AppUserModelID

The type of the None singleton.

var Section

The type of the None singleton.

var Key

The type of the None singleton.

var String

The type of the None singleton.

var Subkey

The type of the None singleton.

var ValueName

The type of the None singleton.

var ValueData

The type of the None singleton.

class EntryLocation (section, number, field=None)

An entry of an installer: its section, its number in that section, counted from zero, and the field that the location points at, if any.

Expand source code Browse git
class EntryLocation(NamedTuple):
    """
    An entry of an installer: its section, its number in that section, counted from zero, and the
    field that the location points at, if any.
    """
    section: EntrySection
    number: int
    field: EntryField | None = None

    def __str__(self):
        text = F'[{self.section}] entry {self.number}'
        if self.field is not None:
            text = F'{text}, {self.field}'
        return text

Ancestors

  • builtins.tuple

Instance variables

var section

Alias for field number 0

Expand source code Browse git
class EntryLocation(NamedTuple):
    """
    An entry of an installer: its section, its number in that section, counted from zero, and the
    field that the location points at, if any.
    """
    section: EntrySection
    number: int
    field: EntryField | None = None

    def __str__(self):
        text = F'[{self.section}] entry {self.number}'
        if self.field is not None:
            text = F'{text}, {self.field}'
        return text
var number

Alias for field number 1

Expand source code Browse git
class EntryLocation(NamedTuple):
    """
    An entry of an installer: its section, its number in that section, counted from zero, and the
    field that the location points at, if any.
    """
    section: EntrySection
    number: int
    field: EntryField | None = None

    def __str__(self):
        text = F'[{self.section}] entry {self.number}'
        if self.field is not None:
            text = F'{text}, {self.field}'
        return text
var field

Alias for field number 2

Expand source code Browse git
class EntryLocation(NamedTuple):
    """
    An entry of an installer: its section, its number in that section, counted from zero, and the
    field that the location points at, if any.
    """
    section: EntrySection
    number: int
    field: EntryField | None = None

    def __str__(self):
        text = F'[{self.section}] entry {self.number}'
        if self.field is not None:
            text = F'{text}, {self.field}'
        return text
class NewScriptError (name, args, message, entry=None)

An event generated by InnoSetupEmulator.emulate_installation() for each call of the script by Setup that ends with a script error which the script does not handle. It holds the event, the parameter of the entry or the directive that Setup evaluated, the arguments of an event, the message of the error, and for an entry where it is.

Expand source code Browse git
class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'

Ancestors

  • builtins.tuple

Instance variables

var name

Alias for field number 0

Expand source code Browse git
class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'
var args

Alias for field number 1

Expand source code Browse git
class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'
var message

Alias for field number 2

Expand source code Browse git
class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'
var entry

Alias for field number 3

Expand source code Browse git
class NewScriptError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.InnoSetupEmulator.emulate_installation` for
    each call of the script by Setup that ends with a script error which the script does not
    handle. It holds the event, the parameter of the entry or the directive that Setup evaluated,
    the arguments of an event, the message of the error, and for an entry where it is.
    """
    name: SetupEvent | PageEvent | ControlEvent | EntryParameter | YesNoDirective | TextDirective
    args: tuple
    message: str
    entry: EntryLocation | None = None

    def __str__(self):
        if (entry := self.entry) is not None:
            return F'script error in {self.name} of {entry}: {self.message}'
        return F'script error in {self.name}{self.args!r}: {self.message}'
class NewEmulationError (name, message)

An event generated by IFPSEmulator.emulate_function() for each call of an emulated function that fails with an error of the emulator rather than one of the script. The script sees the failure as an error that it can handle. It holds the name of the function and the message of the failure.

Expand source code Browse git
class NewEmulationError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each call
    of an emulated function that fails with an error of the emulator rather than one of the
    script. The script sees the failure as an error that it can handle. It holds the name of the
    function and the message of the failure.
    """
    name: str
    message: str

    def __str__(self):
        return F'emulation of {self.name} failed: {self.message}'

Ancestors

  • builtins.tuple

Instance variables

var name

Alias for field number 0

Expand source code Browse git
class NewEmulationError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each call
    of an emulated function that fails with an error of the emulator rather than one of the
    script. The script sees the failure as an error that it can handle. It holds the name of the
    function and the message of the failure.
    """
    name: str
    message: str

    def __str__(self):
        return F'emulation of {self.name} failed: {self.message}'
var message

Alias for field number 1

Expand source code Browse git
class NewEmulationError(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each call
    of an emulated function that fails with an error of the emulator rather than one of the
    script. The script sees the failure as an error that it can handle. It holds the name of the
    function and the message of the failure.
    """
    name: str
    message: str

    def __str__(self):
        return F'emulation of {self.name} failed: {self.message}'
class NewInstruction (function, instruction, offset)

An event generated by IFPSEmulator.emulate_function() for each executed instruction.

Expand source code Browse git
class NewInstruction(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    executed instruction.
    """
    function: Function
    instruction: Instruction
    offset: int

Ancestors

  • builtins.tuple

Instance variables

var function

Alias for field number 0

Expand source code Browse git
class NewInstruction(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    executed instruction.
    """
    function: Function
    instruction: Instruction
    offset: int
var instruction

Alias for field number 1

Expand source code Browse git
class NewInstruction(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    executed instruction.
    """
    function: Function
    instruction: Instruction
    offset: int
var offset

Alias for field number 2

Expand source code Browse git
class NewInstruction(NamedTuple):
    """
    An event generated by `refinery.lib.inno.emulator.IFPSEmulator.emulate_function` for each
    executed instruction.
    """
    function: Function
    instruction: Instruction
    offset: int