srctools.cmdseq

Reads and writes Hammer’s compilation configs.

These set the arguments to the compile tools.

class srctools.cmdseq.SpecialCommand(value)

Bases: Enum

Special commands to run instead of the exe.

CHANGE_DIR = 256
COPY_FILE = 257
DELETE_FILE = 258
RENAME_FILE = 259
class srctools.cmdseq.Command(
executable: Union[str, SpecialCommand],
args: str,
*,
enabled: bool = True,
ensure_file: Optional[str] = None,
use_proc_win: bool = True,
no_wait: bool = False,
)

A command to run.

classmethod parse(
is_enabled: int,
is_special: int,
executable: bytes,
args: bytes,
is_long_filename: int,
ensure_check: bytes,
ensure_file: bytes,
use_proc_win: int,
no_wait: int = 0,
) Command

Parse the command from the structure in the file.

srctools.cmdseq.parse(file: IO[bytes]) Dict[str, List[Command]]

Read a list of sequences from a file.

This returns a dict mapping names to a list of sequences.

srctools.cmdseq.write(
sequences: Dict[str, Sequence[Command]],
file: IO[bytes],
) None

Write commands back to a file.