pro2cmake: Fix default mutable arguments usage

Change-Id: I91f2632f46539a1e5009b598625d78f61a051588
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-09-21 20:30:08 +02:00
parent 6920acd894
commit 1144c08be8

View File

@ -1738,8 +1738,10 @@ def _map_libraries_to_cmake(libraries: List[str], known_libraries: Set[str]) ->
def extract_cmake_libraries( def extract_cmake_libraries(
scope: Scope, *, known_libraries: Set[str] = set() scope: Scope, *, known_libraries: Optional[Set[str]] = None
) -> Tuple[List[str], List[str]]: ) -> Tuple[List[str], List[str]]:
if known_libraries is None:
known_libraries = set()
public_dependencies = [] # type: List[str] public_dependencies = [] # type: List[str]
private_dependencies = [] # type: List[str] private_dependencies = [] # type: List[str]
@ -1883,8 +1885,10 @@ def write_compile_options(
def write_library_section( def write_library_section(
cm_fh: IO[str], scope: Scope, *, indent: int = 0, known_libraries: Set[str] = set() cm_fh: IO[str], scope: Scope, *, indent: int = 0, known_libraries: Optional[Set[str]] = None
): ):
if known_libraries is None:
known_libraries = set()
public_dependencies, private_dependencies = extract_cmake_libraries( public_dependencies, private_dependencies = extract_cmake_libraries(
scope, known_libraries=known_libraries scope, known_libraries=known_libraries
) )
@ -1899,7 +1903,11 @@ def write_autogen_section(cm_fh: IO[str], scope: Scope, *, indent: int = 0):
write_list(cm_fh, ["uic"], "ENABLE_AUTOGEN_TOOLS", indent) write_list(cm_fh, ["uic"], "ENABLE_AUTOGEN_TOOLS", indent)
def write_sources_section(cm_fh: IO[str], scope: Scope, *, indent: int = 0, known_libraries=set()): def write_sources_section(
cm_fh: IO[str], scope: Scope, *, indent: int = 0, known_libraries: Optional[Set[str]] = None
):
if known_libraries is None:
known_libraries = set()
ind = spaces(indent) ind = spaces(indent)
# mark RESOURCES as visited: # mark RESOURCES as visited:
@ -2493,12 +2501,14 @@ def write_main_part(
cmake_function: str, cmake_function: str,
scope: Scope, scope: Scope,
*, *,
extra_lines: List[str] = [], extra_lines: Optional[List[str]] = None,
indent: int = 0, indent: int = 0,
extra_keys: List[str], extra_keys: List[str],
**kwargs: Any, **kwargs: Any,
): ):
# Evaluate total condition of all scopes: # Evaluate total condition of all scopes:
if extra_lines is None:
extra_lines = []
recursive_evaluate_scope(scope) recursive_evaluate_scope(scope)
if "exceptions" in scope.get("CONFIG"): if "exceptions" in scope.get("CONFIG"):
@ -2908,11 +2918,13 @@ def write_qml_plugin(
target: str, target: str,
scope: Scope, scope: Scope,
*, *,
extra_lines: List[str] = [], extra_lines: Optional[List[str]] = None,
indent: int = 0, indent: int = 0,
**kwargs: Any, **kwargs: Any,
) -> Optional[QmlDir]: ) -> Optional[QmlDir]:
# Collect other args if available # Collect other args if available
if extra_lines is None:
extra_lines = []
indent += 2 indent += 2
target_path = scope.get_string("TARGETPATH") target_path = scope.get_string("TARGETPATH")