e3_build_tools.utils¶
Module with utils functions to e3_build_tools.
Attributes¶
Classes¶
Enum of wrapper types. |
Functions¶
|
Check wrapper type. |
|
Return the definitions of makefile variables. |
|
Overwrite the definitions of makefile variables. |
|
Modify the data in a config file. |
|
Return if module version is in the expected format. |
|
Return if require version is in the expected format. |
|
Return if base version is in the expected format. |
|
Return the same string but with |
|
Return a version with incremented build number. |
|
Return the version as taken from a path to EPICS base. |
|
Return a nested merge of two dictionaries, with |
|
Run GNU make in the target directory with the given arguments. |
Module Contents¶
- class e3_build_tools.utils.WrapperType(*args, **kwds)[source]¶
Bases:
enum.EnumEnum of wrapper types.
- e3_build_tools.utils.get_wrapper_type(wrapper: git.Repo | pathlib.Path) WrapperType[source]¶
Check wrapper type.
- Raises:
TypeError: If current directory is not a module.
- e3_build_tools.utils.read_makefile_definitions(content: str) Dict[str, str][source]¶
Return the definitions of makefile variables.
- e3_build_tools.utils.modify_makefile_definitions(content: str, substitutions: Dict[str, str]) str[source]¶
Overwrite the definitions of makefile variables.
Declarations that are commented out are ignored.
- e3_build_tools.utils.modify_config_file(filename: pathlib.Path, key: str, val: str) None[source]¶
Modify the data in a config file.
- e3_build_tools.utils.check_module_version(version: str) bool[source]¶
Return if module version is in the expected format.
- e3_build_tools.utils.check_require_version(version: str) bool[source]¶
Return if require version is in the expected format.
- e3_build_tools.utils.check_base_version(version: str) bool[source]¶
Return if base version is in the expected format.
Unfortunately epics base does not follow semantic version and sometimes can have one digit more, like on version 7.0.6.1.
- e3_build_tools.utils.ensure_build_number(version: str) str[source]¶
Return the same string but with
+0appended if string is a valid version.We have to deal with the implicit addition of +0 by require to modules that have no build number defined, but we only do this for versions of the form “x.y.z”.
- e3_build_tools.utils.increment_build_number(version: str) str[source]¶
Return a version with incremented build number.
- e3_build_tools.utils.extract_base_version(base_path: str) str[source]¶
Return the version as taken from a path to EPICS base.
- Raises:
ValueError: If
base_pathis not a valid EPICS base path.
- e3_build_tools.utils.deep_merge(first: Type[Dict], second: Type[Dict]) Type[Dict][source]¶
Return a nested merge of two dictionaries, with
firsttaking precedence.Based on https://stackoverflow.com/a/56177639
Each key that is found only in
firstor only insecondwill be included in the output collection with its value intact. For any key in common betweenfirstandsecond, the corresponding values will be merged, andfirstwill take precedence oversecond.
- e3_build_tools.utils.run_make(path: pathlib.Path, *makeargs) subprocess.CompletedProcess[source]¶
Run GNU make in the target directory with the given arguments.