API Reference¶
clang_tools.main
¶
The module containing main entrypoint function.
- clang_tools.main.get_parser() ArgumentParser ¶
Get and parser to interpret CLI args.
- clang_tools.main.main()¶
The main entrypoint to the CLI program.
clang_tools.install
¶
The module that performs the installation of clang-tools.
-
clang_tools.install.RE_PARSE_VERSION =
re.compile(b'version\\s([\\d\\.]+)', re.MULTILINE)
¶ This pattern is designed to match only the major version number.
-
clang_tools.install.clang_tools_binary_url(tool: str, version: str, tag: str =
'master-2e4f8c1f'
) str ¶ Assemble the URL to the binary.
-
clang_tools.install.create_sym_link(tool_name: str, version: str, install_dir: str, overwrite: bool =
False
, target: Path | None =None
) bool ¶ Create a symlink to the installed binary that doesn’t have the version number appended.
- Parameters:¶
- tool_name: str¶
The name of the clang-tool to symlink.
- version: str¶
The version of the clang-tool to symlink.
- install_dir: str¶
The installation directory to create the symlink in.
- overwrite: bool =
False
¶ A flag to indicate if an existing symlink should be overwritten.
- target: Path | None =
None
¶ The target executable’s path and name for which to create a symlink to. If this argument is not specified (or is None), then the target’s path and name is constructed from the
tool_name
,version
, andinstall_dir
parameters.
- Returns:¶
A bool describing if the symlink was created.
- clang_tools.install.install_clang_tools(version: Version, tools: str, directory: str, overwrite: bool, no_progress_bar: bool) None ¶
Wraps functions used to individually install tools.
- Parameters:¶
- version: Version¶
The version of the tools to install.
- tools: str¶
The specify tool(s) to install.
- directory: str¶
The installation directory.
- overwrite: bool¶
A flag to indicate if the creation of a symlink has permission to overwrite an existing symlink.
- no_progress_bar: bool¶
A flag used to disable the downloads’ progress bar.
- clang_tools.install.install_dir_name(directory: str) str ¶
Automate directory choosing if not explicitly specified by user.
- clang_tools.install.install_tool(tool_name: str, version: str, directory: str, no_progress_bar: bool) bool ¶
An abstract function that can install either clang-tidy or clang-format.
- clang_tools.install.is_installed(tool_name: str, version: Version) Path | None ¶
Detect if the specified tool is installed.
- clang_tools.install.move_and_chmod_bin(old_bin_name: str, new_bin_name: str, install_dir: str) None ¶
Move download clang-tools binary and move to bin dir with right permission.
- clang_tools.install.uninstall_clang_tools(tools: str, version: str, directory: str)¶
Uninstall a clang tool of a given version.
- clang_tools.install.uninstall_tool(tool_name: str, version: str, directory: str)¶
Remove a specified tool of a given version.
clang_tools.util
¶
A module containing utility functions.
- class clang_tools.util.Version(user_input: str)¶
Parse the given version string into a semantic specification.
- info : Tuple[int, int, int]¶
A tuple of integers that describes the major, minor, and patch versions. If the version string is a path, then this tuple is just 3 zeros.
- string¶
The version input in string form
- clang_tools.util.check_install_os() str ¶
Identify this Operating System.
Note
This will raise an exception if the detected OS is not supported. Please open an issue at https://github.com/cpp-linter/clang-tools-pip/issues if you encounter an unsupported OS.
- Returns:¶
A lower-case str describing the detected OS.
- clang_tools.util.download_file(url: str, file_name: str, no_progress_bar: bool) str | None ¶
Download the given file_name from the given url.
- clang_tools.util.get_sha_checksum(binary_url: str) str ¶
Fetch the SHA512 checksum corresponding to the released binary.