Revert "Cleanup: Address mypy errors and warnings"

The similar cleanup with a lot of other changes were committed
to the main branch. Is easier to revert this change, copy the
scripts from main, and merge things back.

This reverts commit 4bc1ba3c2d.
This commit is contained in:
Sergey Sharybin
2024-02-28 11:34:24 +01:00
parent 4a4916db45
commit 066f7d9eea
3 changed files with 14 additions and 15 deletions
+1 -1
View File
@@ -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, Path("tests") / "data")
make_utils.git_enable_submodule(git_command, "tests/data")
make_utils.git_update_submodule(args.git_command, lib_tests_dirpath)
# Run cmake again to detect tests files.
+8 -8
View File
@@ -106,10 +106,10 @@ def get_effective_architecture(args: argparse.Namespace) -> str:
assert (architecture in ("x64", "arm64"))
return str(architecture)
return architecture
def get_submodule_directories(args: argparse.Namespace) -> list[Path]:
def get_submodule_directories(args: argparse.Namespace):
"""
Get list of all configured submodule directories.
"""
@@ -118,10 +118,10 @@ def get_submodule_directories(args: argparse.Namespace) -> list[Path]:
dot_modules = blender_git_root / ".gitmodules"
if not dot_modules.exists():
return []
return ()
submodule_directories_output = check_output(
[args.git_command, "config", "--file", str(dot_modules), "--get-regexp", "path"])
[args.git_command, "config", "--file", 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: Optional[Path] = None) -> None:
old_submodules_dir: 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: Optional[Path] = None,
only_update: bool = False) -> str:
old_submodules_dir: Path = None,
only_update=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) -> None:
def add_submodule_push_url(args: argparse.Namespace):
"""
Add pushURL configuration for all locally activated submodules, pointing to SSH protocol.
"""
+5 -6
View File
@@ -20,8 +20,7 @@ from typing import (
)
def call(cmd: Sequence[str], exit_on_error: bool = True,
silent: bool = False, env: Optional[dict[str, str]] = None) -> int:
def call(cmd: Sequence[str], exit_on_error: bool = True, silent: bool = False, env=None) -> int:
if not silent:
cmd_str = ""
if env:
@@ -136,7 +135,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) -> bool:
def is_git_submodule_enabled(git_command: str, submodule_dir: Path):
"""Check whether submodule denoted by its directory within the repository is enabled"""
git_root = Path(check_output([git_command, "rev-parse", "--show-toplevel"]))
@@ -159,7 +158,7 @@ def is_git_submodule_enabled(git_command: str, submodule_dir: Path) -> bool:
return update.lower() != "none"
def git_enable_submodule(git_command: str, submodule_dir: Path) -> None:
def git_enable_submodule(git_command: str, submodule_dir: Path):
"""Enable submodule denoted by its directory within the repository"""
command = (git_command,
@@ -201,11 +200,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", str(submodule_dir)),
if call((git_command, "submodule", "update", "--init", "--progress", submodule_dir),
exit_on_error=False, env=env) != 0:
return False
return call((git_command, "-C", str(submodule_dir), "lfs", "pull"),
return call((git_command, "-C", submodule_dir, "lfs", "pull"),
exit_on_error=False) == 0