diff options
author | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-10-08 15:07:41 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2019-10-08 19:25:20 +0000 |
commit | b7adc85642584be26a1870617a9aa83c16e40cfb (patch) | |
tree | 3b4b84704ff3a3745aec14204a78142ca6bd850e /util | |
parent | f7bb15a11b82ce54d551e131a99aa5e75889bd46 (diff) |
cmake scripts: do not redefine built-ins
Try not to override built-ins, the code becomes confusing to editors and people.
Change-Id: I9e9421e1506a206551ccfc550f882a075e208181
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
Diffstat (limited to 'util')
-rwxr-xr-x | util/cmake/configurejson2cmake.py | 18 | ||||
-rw-r--r-- | util/cmake/helper.py | 6 | ||||
-rwxr-xr-x | util/cmake/pro2cmake.py | 14 |
3 files changed, 19 insertions, 19 deletions
diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index ae7c0328a8..0545d034d5 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -147,8 +147,8 @@ def cm(ctx, *output): return ctx -def readJsonFromDir(dir): - path = posixpath.join(dir, "configure.json") +def readJsonFromDir(path: str) -> str: + path = posixpath.join(path, "configure.json") print(f"Reading {path}...") assert posixpath.exists(path) @@ -942,8 +942,8 @@ def processInputs(ctx, data, cm_fh): if "options" not in commandLine: return - for input in commandLine["options"]: - parseInput(ctx, input, commandLine["options"][input], cm_fh) + for input_option in commandLine["options"]: + parseInput(ctx, input_option, commandLine["options"][input_option], cm_fh) def processTests(ctx, data, cm_fh): @@ -974,23 +974,23 @@ def processLibraries(ctx, data, cm_fh): parseLib(ctx, lib, data, cm_fh, cmake_find_packages_set) -def processSubconfigs(dir, ctx, data): +def processSubconfigs(path, ctx, data): assert ctx is not None if "subconfigs" in data: for subconf in data["subconfigs"]: - subconfDir = posixpath.join(dir, subconf) + subconfDir = posixpath.join(path, subconf) subconfData = readJsonFromDir(subconfDir) subconfCtx = ctx processJson(subconfDir, subconfCtx, subconfData) -def processJson(dir, ctx, data): +def processJson(path, ctx, data): ctx["module"] = data.get("module", "global") ctx["test_dir"] = data.get("testDir", "") ctx = processFiles(ctx, data) - with open(posixpath.join(dir, "configure.cmake"), "w") as cm_fh: + with open(posixpath.join(path, "configure.cmake"), "w") as cm_fh: cm_fh.write("\n\n#### Inputs\n\n") processInputs(ctx, data, cm_fh) @@ -1016,7 +1016,7 @@ def processJson(dir, ctx, data): cm_fh.write('qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)\n') # do this late: - processSubconfigs(dir, ctx, data) + processSubconfigs(path, ctx, data) def main(): diff --git a/util/cmake/helper.py b/util/cmake/helper.py index 4c6b811133..aa73168718 100644 --- a/util/cmake/helper.py +++ b/util/cmake/helper.py @@ -554,11 +554,11 @@ def find_library_info_for_target(targetName: str) -> typing.Optional[LibraryMapp return None -def featureName(input: str) -> str: +def featureName(name: str) -> str: replacement_char = "_" - if input.startswith("c++"): + if name.startswith("c++"): replacement_char = "x" - return re.sub(r"[^a-zA-Z0-9_]", replacement_char, input) + return re.sub(r"[^a-zA-Z0-9_]", replacement_char, name) def map_qt_library(lib: str) -> str: diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index d287856b49..89c9273f28 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -665,7 +665,7 @@ class Operation: self._value = [str(value)] def process( - self, key: str, input: List[str], transformer: Callable[[List[str]], List[str]] + self, key: str, sinput: List[str], transformer: Callable[[List[str]], List[str]] ) -> List[str]: assert False @@ -1032,12 +1032,12 @@ class Scope(object): for c in self._included_children: c.dump(indent=indent + 1) - def dump_structure(self, *, type: str = "ROOT", indent: int = 0) -> None: - print(f"{spaces(indent)}{type}: {self}") + def dump_structure(self, *, structure_type: str = "ROOT", indent: int = 0) -> None: + print(f"{spaces(indent)}{structure_type}: {self}") for i in self._included_children: - i.dump_structure(type="INCL", indent=indent + 1) + i.dump_structure(structure_type="INCL", indent=indent + 1) for i in self._children: - i.dump_structure(type="CHLD", indent=indent + 1) + i.dump_structure(structure_type="CHLD", indent=indent + 1) @property def keys(self): @@ -1812,11 +1812,11 @@ def sort_sources(sources: List[str]) -> List[str]: if s is None: continue - dir = os.path.dirname(s) + path = os.path.dirname(s) base = os.path.splitext(os.path.basename(s))[0] if base.endswith("_p"): base = base[:-2] - sort_name = posixpath.join(dir, base) + sort_name = posixpath.join(path, base) array = to_sort.get(sort_name, []) array.append(s) |