Skip to content

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
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
'*'
vs_version
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
'*'
vs_version
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,
) -> 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
None
product
None
vs_version
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
None
arch
None