Locate tools
locate_tools ¶
Module to assist in locating tools via VsWhere.
NOTE: Has the capability to download VSwhere.
GetVsWherePath ¶
GetVsWherePath(
fail_on_not_found: bool = True,
) -> Optional[str]
Get the VsWhere tool path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fail_on_not_found
|
`bool`
|
whether to log an error or not. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
"/PATH/TO/vswhere.exe" if found |
None
|
if fail_on_not_found and is not found |
FindWithVsWhere ¶
FindWithVsWhere(
products: str = "*", vs_version: Optional[str] = None
) -> Optional[str]
Finds a product with VS Where. Returns the newest match.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
products
|
`str`
|
product defined by vswhere tool |
'*'
|
vs_version
|
`str`
|
helper to find version of supported VS version (example vs2019) |
None
|
Returns:
| Type | Description |
|---|---|
str
|
VsWhere products |
None
|
If no products returned |
FindAllWithVsWhere ¶
FindAllWithVsWhere(
products: str = "*", vs_version: Optional[str] = None
) -> Optional[List[str]]
Finds a product with VS Where. Returns all matches, sorted by newest version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
products
|
`str`
|
product defined by vswhere tool |
'*'
|
vs_version
|
`str`
|
helper to find version of supported VS version (example vs2019) |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
VsWhere products |
None
|
If no products returned |
QueryVcVariables ¶
QueryVcVariables(
keys: list,
arch: str = None,
product: str = None,
vs_version: str = None,
vc_version: str = None,
) -> str
Launch vcvarsall.bat and read the settings from its environment.
This is a windows only function and Windows is case insensitive for the keys
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
keys
|
list
|
names of env variables to collect after bat run |
required |
arch
|
`str`
|
arch to run |
None
|
product
|
`str`
|
values defined by vswhere.exe |
None
|
vs_version
|
`str`
|
helper to find version of supported VS version (example vs2019) |
None
|
vc_version
|
`str`
|
Exact compiler version to consider for variables (example 14.42.34433) |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
the appropriate environment variables |
FindToolInWinSdk ¶
FindToolInWinSdk(
tool: str, product: str = None, arch: str = None
) -> str
Searches for a tool in the Windows SDK Directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool
|
str
|
Tool to search for |
required |
product
|
`str`
|
product for searching with vswhere |
None
|
arch
|
`str`
|
arch for searching with vswhere |
None
|