Freeciv-3.2
|
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 () |
Data Fields | |
def_paths | |
common_header_path | |
common_impl_path | |
server_header_path | |
server_impl_path | |
client_header_path | |
client_impl_path | |
verbose | |
lazy_overwrite | |
gen_stats | |
log_macro | |
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) |
Protected Attributes | |
_script_path | |
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 146 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 204 of file generate_packets.py.
|
protected |
Root Freeciv path, if we can find it.
Definition at line 195 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 217 of file generate_packets.py.
|
protected |
Add code for `extern "C" {}` wrapping
Definition at line 259 of file generate_packets.py.
|
protected |
Add multiple inclusion protection to the given file
Definition at line 242 of file generate_packets.py.
|
protected |
Definition at line 223 of file generate_packets.py.
|
static |
Construct an argument parser for a packet generation script
Definition at line 59 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 302 of file generate_packets.py.
generate_packets.ScriptConfig.log_verbose | ( | self, | |
* | args | ||
) |
Print the given arguments iff verbose logging is enabled
Definition at line 189 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 276 of file generate_packets.py.
|
protected |
Definition at line 228 of file generate_packets.py.
generate_packets.ScriptConfig.client_header_path |
Definition at line 166 of file generate_packets.py.
generate_packets.ScriptConfig.client_impl_path |
Definition at line 169 of file generate_packets.py.
generate_packets.ScriptConfig.common_header_path |
Definition at line 154 of file generate_packets.py.
generate_packets.ScriptConfig.common_impl_path |
Definition at line 157 of file generate_packets.py.
generate_packets.ScriptConfig.def_paths |
Definition at line 151 of file generate_packets.py.
generate_packets.ScriptConfig.fold_bool |
Definition at line 184 of file generate_packets.py.
generate_packets.ScriptConfig.gen_stats |
Definition at line 178 of file generate_packets.py.
generate_packets.ScriptConfig.lazy_overwrite |
Definition at line 175 of file generate_packets.py.
generate_packets.ScriptConfig.log_macro |
Definition at line 180 of file generate_packets.py.
generate_packets.ScriptConfig.server_header_path |
Definition at line 160 of file generate_packets.py.
generate_packets.ScriptConfig.server_impl_path |
Definition at line 163 of file generate_packets.py.
generate_packets.ScriptConfig.verbose |
Definition at line 173 of file generate_packets.py.