diff options
Diffstat (limited to 'build_files/utils')
-rwxr-xr-x | build_files/utils/make_bpy_wheel.py | 11 | ||||
-rwxr-xr-x | build_files/utils/make_update.py | 86 | ||||
-rwxr-xr-x | build_files/utils/make_utils.py | 2 |
3 files changed, 56 insertions, 43 deletions
diff --git a/build_files/utils/make_bpy_wheel.py b/build_files/utils/make_bpy_wheel.py index ba1d0f21937..81d267c6e10 100755 --- a/build_files/utils/make_bpy_wheel.py +++ b/build_files/utils/make_bpy_wheel.py @@ -208,12 +208,15 @@ def main() -> None: dist_dir = os.path.join(install_dir, "dist") for f in os.listdir(dist_dir): if f.endswith(".whl"): - # No apparent way to override this ABI version with setuptools, so rename. - sys_py = "cp%d%d" % (sys.version_info.major, sys.version_info.minor) - sys_py_abi = sys_py + sys.abiflags blender_py = "cp%d%d" % (python_version_number[0], python_version_number[1]) - renamed_f = f.replace(sys_py_abi, blender_py).replace(sys_py, blender_py) + # No apparent way to override this ABI version with setuptools, so rename. + sys_py = "cp%d%d" % (sys.version_info.major, sys.version_info.minor) + if hasattr(sys, "abiflags"): + sys_py_abi = sys_py + sys.abiflags + renamed_f = f.replace(sys_py_abi, blender_py).replace(sys_py, blender_py) + else: + renamed_f = f.replace(sys_py, blender_py) os.rename(os.path.join(dist_dir, f), os.path.join(output_dir, renamed_f)) diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py index 254cccda301..a0b61b18e60 100755 --- a/build_files/utils/make_update.py +++ b/build_files/utils/make_update.py @@ -18,8 +18,13 @@ import sys import make_utils from make_utils import call, check_output +from typing import ( + List, + Optional, +) -def print_stage(text): + +def print_stage(text: str) -> None: print("") print(text) print("") @@ -27,7 +32,7 @@ def print_stage(text): # Parse arguments -def parse_arguments(): +def parse_arguments() -> argparse.Namespace: parser = argparse.ArgumentParser() parser.add_argument("--no-libraries", action="store_true") parser.add_argument("--no-blender", action="store_true") @@ -40,13 +45,13 @@ def parse_arguments(): return parser.parse_args() -def get_blender_git_root(): +def get_blender_git_root() -> str: return check_output([args.git_command, "rev-parse", "--show-toplevel"]) # Setup for precompiled libraries and tests from svn. -def svn_update(args, release_version): +def svn_update(args: argparse.Namespace, release_version: Optional[str]) -> None: svn_non_interactive = [args.svn_command, '--non-interactive'] lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib') @@ -99,42 +104,42 @@ def svn_update(args, release_version): call(svn_non_interactive + ["checkout", svn_url_tests, lib_tests_dirpath]) # Update precompiled libraries and tests - print_stage("Updating Precompiled Libraries and Tests") - - if os.path.isdir(lib_dirpath): - for dirname in os.listdir(lib_dirpath): - dirpath = os.path.join(lib_dirpath, dirname) - - if dirname == ".svn": - # Cleanup must be run from svn root directory if it exists. - if not make_utils.command_missing(args.svn_command): - call(svn_non_interactive + ["cleanup", lib_dirpath]) - continue - elif dirname.startswith("."): - # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories. - continue - - svn_dirpath = os.path.join(dirpath, ".svn") - svn_root_dirpath = os.path.join(lib_dirpath, ".svn") - - if ( - os.path.isdir(dirpath) and - (os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)) - ): - if make_utils.command_missing(args.svn_command): - sys.stderr.write("svn not found, can't update libraries\n") - sys.exit(1) - - # Cleanup to continue with interrupted downloads. - if os.path.exists(svn_dirpath): - call(svn_non_interactive + ["cleanup", dirpath]) + + if not os.path.isdir(lib_dirpath): + print("Library path: %r, not found, skipping" % lib_dirpath) + else: + paths_local_and_remote = [] + if os.path.exists(os.path.join(lib_dirpath, ".svn")): + print_stage("Updating Precompiled Libraries and Tests (one repository)") + paths_local_and_remote.append((lib_dirpath, svn_url)) + else: + print_stage("Updating Precompiled Libraries and Tests (multiple repositories)") + # Separate paths checked out. + for dirname in os.listdir(lib_dirpath): + if dirname.startswith("."): + # Temporary paths such as ".mypy_cache" will report a warning, skip hidden directories. + continue + + dirpath = os.path.join(lib_dirpath, dirname) + if not (os.path.isdir(dirpath) and os.path.exists(os.path.join(dirpath, ".svn"))): + continue + + paths_local_and_remote.append((dirpath, svn_url + dirname)) + + if paths_local_and_remote: + if make_utils.command_missing(args.svn_command): + sys.stderr.write("svn not found, can't update libraries\n") + sys.exit(1) + + for dirpath, svn_url_full in paths_local_and_remote: + call(svn_non_interactive + ["cleanup", dirpath]) # Switch to appropriate branch and update. - call(svn_non_interactive + ["switch", svn_url + dirname, dirpath], exit_on_error=False) + call(svn_non_interactive + ["switch", svn_url_full, dirpath], exit_on_error=False) call(svn_non_interactive + ["update", dirpath]) # Test if git repo can be updated. -def git_update_skip(args, check_remote_exists=True): +def git_update_skip(args: argparse.Namespace, check_remote_exists: bool = True) -> str: if make_utils.command_missing(args.git_command): sys.stderr.write("git not found, can't update code\n") sys.exit(1) @@ -166,13 +171,17 @@ def git_update_skip(args, check_remote_exists=True): # Update blender repository. -def blender_update(args): +def blender_update(args: argparse.Namespace) -> None: print_stage("Updating Blender Git Repository") call([args.git_command, "pull", "--rebase"]) # Update submodules. -def submodules_update(args, release_version, branch): +def submodules_update( + args: argparse.Namespace, + release_version: Optional[str], + branch: Optional[str], +) -> str: print_stage("Updating Submodules") if make_utils.command_missing(args.git_command): sys.stderr.write("git not found, can't update code\n") @@ -214,7 +223,8 @@ def submodules_update(args, release_version, branch): elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback): submodule_branch = submodule_branch_fallback else: - submodule_branch = None + # Skip. + submodule_branch = "" # Switch to branch and pull. if submodule_branch: diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py index 564930617ff..9b15eb363bc 100755 --- a/build_files/utils/make_utils.py +++ b/build_files/utils/make_utils.py @@ -80,7 +80,7 @@ def git_tag(git_command: str) -> Optional[str]: return tag.strip().decode('utf8') -def git_branch_release_version(branch: str, tag: str) -> Optional[str]: +def git_branch_release_version(branch: str, tag: Optional[str]) -> Optional[str]: re_match = re.search("^blender-v(.*)-release$", branch) release_version = None if re_match: |