diff --git a/build_files/utils/make_test.py b/build_files/utils/make_test.py index 7d61cfd1aca..a8a66ede316 100755 --- a/build_files/utils/make_test.py +++ b/build_files/utils/make_test.py @@ -54,7 +54,7 @@ if not (lib_tests_dirpath / ".git").exists(): sys.exit(1) # Ensure the test data files sub-module is configured and present. - make_utils.git_enable_submodule(git_command, "tests/data") + make_utils.git_enable_submodule(git_command, Path("tests") / "data") make_utils.git_update_submodule(args.git_command, lib_tests_dirpath) # Run cmake again to detect tests files. diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py index 152f30ef270..4840cf1a1bd 100755 --- a/build_files/utils/make_update.py +++ b/build_files/utils/make_update.py @@ -106,10 +106,10 @@ def get_effective_architecture(args: argparse.Namespace) -> str: assert (architecture in ("x64", "arm64")) - return architecture + return str(architecture) -def get_submodule_directories(args: argparse.Namespace): +def get_submodule_directories(args: argparse.Namespace) -> list[Path]: """ Get list of all configured submodule directories. """ @@ -118,10 +118,10 @@ def get_submodule_directories(args: argparse.Namespace): dot_modules = blender_git_root / ".gitmodules" if not dot_modules.exists(): - return () + return [] submodule_directories_output = check_output( - [args.git_command, "config", "--file", dot_modules, "--get-regexp", "path"]) + [args.git_command, "config", "--file", str(dot_modules), "--get-regexp", "path"]) return [Path(line.split(' ', 1)[1]) for line in submodule_directories_output.strip().splitlines()] @@ -304,7 +304,7 @@ def external_script_copy_old_submodule_over( def floating_checkout_initialize_if_needed(args: argparse.Namespace, repo_name: str, directory: Path, - old_submodules_dir: Path = None) -> None: + old_submodules_dir: Optional[Path] = None) -> None: """Initialize checkout of an external repository""" blender_git_root = get_blender_git_root() @@ -397,8 +397,8 @@ def floating_checkout_update(args: argparse.Namespace, repo_name: str, directory: Path, branch: Optional[str], - old_submodules_dir: Path = None, - only_update=False) -> str: + old_submodules_dir: Optional[Path] = None, + only_update: bool = False) -> str: """Update a single external checkout with the given name in the scripts folder""" blender_git_root = get_blender_git_root() @@ -499,7 +499,7 @@ def floating_libraries_update(args: argparse.Namespace, branch: Optional[str]) - return msg -def add_submodule_push_url(args: argparse.Namespace): +def add_submodule_push_url(args: argparse.Namespace) -> None: """ Add pushURL configuration for all locally activated submodules, pointing to SSH protocol. """ diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py index 7b3b17619fc..0c284ca8574 100755 --- a/build_files/utils/make_utils.py +++ b/build_files/utils/make_utils.py @@ -20,7 +20,8 @@ from typing import ( ) -def call(cmd: Sequence[str], exit_on_error: bool = True, silent: bool = False, env=None) -> int: +def call(cmd: Sequence[str], exit_on_error: bool = True, + silent: bool = False, env: Optional[dict[str, str]] = None) -> int: if not silent: cmd_str = "" if env: @@ -135,7 +136,7 @@ def _git_submodule_config_key(submodule_dir: Path, key: str) -> str: return f"submodule.{submodule_dir_str}.{key}" -def is_git_submodule_enabled(git_command: str, submodule_dir: Path): +def is_git_submodule_enabled(git_command: str, submodule_dir: Path) -> bool: """Check whether submodule denoted by its directory within the repository is enabled""" git_root = Path(check_output([git_command, "rev-parse", "--show-toplevel"])) @@ -158,7 +159,7 @@ def is_git_submodule_enabled(git_command: str, submodule_dir: Path): return update.lower() != "none" -def git_enable_submodule(git_command: str, submodule_dir: Path): +def git_enable_submodule(git_command: str, submodule_dir: Path) -> None: """Enable submodule denoted by its directory within the repository""" command = (git_command, @@ -200,11 +201,11 @@ def git_update_submodule(git_command: str, submodule_dir: Path) -> bool: env = {"GIT_LFS_SKIP_SMUDGE": "1"} - if call((git_command, "submodule", "update", "--init", "--progress", submodule_dir), + if call((git_command, "submodule", "update", "--init", "--progress", str(submodule_dir)), exit_on_error=False, env=env) != 0: return False - return call((git_command, "-C", submodule_dir, "lfs", "pull"), + return call((git_command, "-C", str(submodule_dir), "lfs", "pull"), exit_on_error=False) == 0