Freeciv-3.3
|
Public Member Functions | |
__init__ (self, "typing.Sequence[str] | None" args=None) | |
log_verbose (self, *args) | |
typing.Iterator[typing.TextIO] | open_write (self, "str | Path" path, "str | None" wrap_header=None, bool cplusplus=True) |
typing.Iterator[typing.TextIO] | lazy_overwrite_open (self, "str | Path" path, str suffix=".tmp") |
Static Public Member Functions | |
argparse.ArgumentParser | get_argparser () |
Static Public Attributes | |
str | def_paths : "list[Path]" |
str | common_header_path : "Path | None" |
str | common_impl_path : "Path | None" |
str | server_header_path : "Path | None" |
str | server_impl_path : "Path | None" |
str | client_header_path : "Path | None" |
str | client_impl_path : "Path | None" |
bool | verbose |
bool | lazy_overwrite |
bool | gen_stats |
str | log_macro : "str | None" |
bool | fold_bool |
Protected Member Functions | |
"Path | None" | _root_path (self) |
Path | _relative_path (self, Path path) |
Path | _script_path (self) |
_write_disclaimer (self, typing.TextIO f) | |
typing.Iterator[None] | _wrap_header (self, typing.TextIO file, str header_name) |
typing.Iterator[None] | _wrap_cplusplus (self, typing.TextIO file) |
Contains configuration info for the script's execution, along with functions closely tied to that configuration
Definition at line 54 of file generate_packets.py.
Definition at line 181 of file generate_packets.py.
|
protected |
Find the relative path from the Freeciv root to the given path. Return the path unmodified if it's outside the Freeciv root, or if the Freeciv root could not be found.
Definition at line 199 of file generate_packets.py.
|
protected |
Root Freeciv path, if we can find it.
Definition at line 190 of file generate_packets.py.
|
protected |
Relative path of the executed script. Under normal circumstances, this will be common/generate_packets.py, but it may differ when this module is imported from another script.
Definition at line 212 of file generate_packets.py.
|
protected |
Add code for `extern "C" {}` wrapping
Definition at line 254 of file generate_packets.py.
|
protected |
Add multiple inclusion protection to the given file
Definition at line 237 of file generate_packets.py.
|
protected |
Definition at line 218 of file generate_packets.py.
|
static |
Construct an argument parser for a packet generation script
Definition at line 94 of file generate_packets.py.
typing.Iterator[typing.TextIO] generate_packets.ScriptConfig.lazy_overwrite_open | ( | self, | |
"str | Path" | path, | ||
str | suffix = ".tmp" |
||
) |
Open a file for writing, but only actually overwrite it if the new content differs from the old content. This creates a temporary file by appending the given suffix to the given file path. In the event of an error, this temporary file might remain in the target file's directory.
Definition at line 297 of file generate_packets.py.
generate_packets.ScriptConfig.log_verbose | ( | self, | |
* | args | ||
) |
Print the given arguments iff verbose logging is enabled
Definition at line 184 of file generate_packets.py.
typing.Iterator[typing.TextIO] generate_packets.ScriptConfig.open_write | ( | self, | |
"str | Path" | path, | ||
"str | None" | wrap_header = None , |
||
bool | cplusplus = True |
||
) |
Open a file for writing and write disclaimer. If enabled, lazily overwrites the given file. If wrap_header is given, add multiple inclusion protection; if cplusplus is also given (default), also add code for `extern "C"` wrapping.
Definition at line 271 of file generate_packets.py.
Definition at line 72 of file generate_packets.py.
Definition at line 75 of file generate_packets.py.
Definition at line 60 of file generate_packets.py.
Definition at line 63 of file generate_packets.py.
|
static |
Definition at line 58 of file generate_packets.py.
|
static |
Definition at line 90 of file generate_packets.py.
|
static |
Definition at line 84 of file generate_packets.py.
|
static |
Definition at line 81 of file generate_packets.py.
Definition at line 86 of file generate_packets.py.
Definition at line 66 of file generate_packets.py.
Definition at line 69 of file generate_packets.py.
|
static |
Definition at line 79 of file generate_packets.py.