Var dict
var_dict ¶
A special overridable dictionary.
Stores most of the build configuration data and allows extensive config sharing for the build process, pre-build, and post-build.
EnvEntry ¶
A single Environment Variable entry for VarDict.
Attributes:
Name | Type | Description |
---|---|---|
Value |
obj
|
The value to store in the dictionary |
Comment |
str
|
A debug comment specifying where / how the value was set |
overridable |
bool
|
If the value can be overwritten in the future |
__init__ ¶
__init__(
value: str, comment: str, overridable: str = False
) -> None
Inits an entry with the specified values.
PrintEntry ¶
PrintEntry(f: Optional[TextIO] = None) -> None
Prints the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
str
|
a file to write to instead of the terminal. |
None
|
SetValue ¶
SetValue(
value: str,
comment: str,
overridable: Optional[bool] = False,
) -> bool
Sets the value of the entry if it os overridable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
str
|
value to set |
required |
comment |
str
|
A debug comment specifying where / how the value was set |
required |
overridable |
bool
|
If the value can be overwritten in the future |
False
|
Warning
Even if you set a value as overridable=False, another entity can
call AllowOverride()
and change the value anyway.
VarDict ¶
An overridable dictionary to store build configuration data.
GetValue ¶
GetValue(k: str, default: Optional[str] = None) -> str
Gets a value from the variable dictionary that was set during build.
Note
Values set in DSC, FDF, and CLI stored as strings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k |
str
|
The key the value was stored as |
required |
default |
str
|
default value if key is not present |
None
|
Returns:
Type | Description |
---|---|
str
|
The value of the key, if present, else default value |
SetValue ¶
SetValue(
k: str, v: str, comment: str, overridable: bool = False
) -> bool
Sets an environment variable to be used throughout the build.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k |
str
|
The key to store the value under |
required |
v |
str
|
The value to store as a string, or None to store a non valued build variable |
required |
comment |
str
|
A comment to show where / how the variable was stored. Useful for debugging |
required |
overridable |
bool
|
Specifies if the variable is allowed to be override elsewhere in the build |
False
|
Returns:
Type | Description |
---|---|
bool
|
If the variable was successfully stored or not |
AllowOverride ¶
AllowOverride(k: str) -> bool
Forces the key/value pair to be overridable.
Note: Even if overridable was specifically set to False, it still allows it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k |
str
|
The key the value was stored as |
required |
Returns:
Type | Description |
---|---|
bool
|
if the key existed or not |
GetBuildValue ¶
GetBuildValue(
key: str, BuildType: Optional[str] = None
) -> str
Get a build var value for given key and buildtype.
Tip
Build vars are defined by vars that start with BLD_
BLD_*_
BLD_DEBUG_
BLD_RELEASE_
etc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
The key the value was stored as |
required |
BuildType |
str
|
DEBUG/RELEASE |
None
|
Returns:
Type | Description |
---|---|
str
|
The value of the key, if present, else None |
GetAllBuildKeyValues ¶
GetAllBuildKeyValues(
BuildType: Optional[str] = None,
) -> dict
Gets a dictionary for all build vars.
Tip
Build vars are defined by vars that start with BLD_
BLD_*_
BLD_DEBUG_
BLD_RELEASE_
etc
Parameters:
Name | Type | Description | Default |
---|---|---|---|
BuildType |
|
None
|
Returns:
Type | Description |
---|---|
dict
|
all keys, values in the environment which are build keys |
GetAllNonBuildKeyValues ¶
GetAllNonBuildKeyValues() -> dict
Returns a dict of non Build Key values.
Return a copy of the dictionary of all keys, values in the environment which are not Build Keys.
PrintAll ¶
PrintAll(fp: Optional[TextIO] = None) -> None
Prints all variables.
If fp is not none, writes to a fp also
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
file pointer to print to |
None
|