Variables¶
- class getmac.variables.Variables[source]¶
Bases:
VarsClassThings that can change.
Essentially most of the global variables in getmac.
Attributes Summary
Cache of commands that have been checked for existence by
check_command().Name of the local host's default network interface.
Use a copy of the environment so any modifications that need to be made for operation of getmac doesn't modify the process's current environment.
Get and cache the configured system PATH environment variable on import.
The
PATHas a string.Global logger for getmac.
Attributes Documentation
- CHECK_COMMAND_CACHE: dict[str, bool] = {}¶
Cache of commands that have been checked for existence by
check_command(). This speeds up subsequent lookups of the same command. The key is the command name, and the value is a boolean indicating if it exists.
- ENV: dict[str, str]¶
Use a copy of the environment so any modifications that need to be made for operation of getmac doesn’t modify the process’s current environment.
LC_ALLis set toCin the copy, and it’s passed to every command getmac runs. This stops commands from translating their output on POSIX systems, so it can be parsed. It has no effect on Windows.
- PATH: list[str]¶
Get and cache the configured system PATH environment variable on import. The process environment does not change after a process is started.
getmac uses this copy to find commands, and it doesn’t change the real
PATH. On POSIX systems,/sbinand/usr/sbinare added to it. On Windows, PythonScriptsdirectories are removed from it, so Windows’ owngetmac.exeis run instead of this package’s script. Changingos.environafter getmac is imported has no effect.
- PATH_STR: str¶
The
PATHas a string. Used for lookups bygetmac.utils.check_command(), which usesshutil.which()under the hood.