summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-08-01 16:01:22 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-08-01 14:50:07 +0000
commitcb370593df2d30c33afb804042f25944f5bca08d (patch)
treec2c4ebc2d10996dc8cea52688fe2bc5106d1714a /util/cmake/pro2cmake.py
parent97b76704ea3b3a062a912656809b17d434f31ffe (diff)
Small fix to correctly handle default arguments
Dictionaries are mutable, and should not be assigned as a default parameter. Change-Id: Id08c17f89c17b404560241849603e1e1a0ec6562 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index a62b094ee9..843b2e7bac 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -374,10 +374,14 @@ class Scope(object):
parent_scope: typing.Optional[Scope],
file: typing.Optional[str] = None, condition: str = '',
base_dir: str = '',
- operations: typing.Mapping[str, typing.List[Operation]] = {
- 'QT_SOURCE_TREE': [SetOperation(['${QT_SOURCE_TREE}'])],
- 'QT_BUILD_TREE': [SetOperation(['${PROJECT_BUILD_DIR}'])],
- }) -> None:
+ operations: typing.Union[
+ typing.Mapping[str, typing.List[Operation]], None] = None) -> None:
+ if operations is None:
+ operations = {
+ 'QT_SOURCE_TREE': [SetOperation(['${QT_SOURCE_TREE}'])],
+ 'QT_BUILD_TREE': [SetOperation(['${PROJECT_BUILD_DIR}'])],
+ }
+
self._operations = copy.deepcopy(operations)
if parent_scope:
parent_scope._add_child(self)