From 8baa705bcef20f7350c21bf4d431c5796ce23e5e Mon Sep 17 00:00:00 2001 From: Bernard Laberge Date: Sat, 27 Jul 2024 22:43:28 -0400 Subject: [PATCH] Fix make_python.py on Apple Silicon + Sonoma 14.5 Signed-off-by: Bernard Laberge --- src/build/make_python.py | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/build/make_python.py b/src/build/make_python.py index 0921fc798..ec6a11044 100755 --- a/src/build/make_python.py +++ b/src/build/make_python.py @@ -124,7 +124,9 @@ def get_python_interpreter_args(python_home: str) -> List[str]: python_interpreters = glob.glob( os.path.join(python_home, python_name_pattern), recursive=True ) - python_interpreters += glob.glob(os.path.join(python_home, "bin", python_name_pattern)) + python_interpreters += glob.glob( + os.path.join(python_home, "bin", python_name_pattern) + ) # sort put python# before python#-config python_interpreters = sorted( @@ -164,7 +166,9 @@ def patch_python_distribution(python_home: str) -> None: shutil.move(failed_lib, failed_lib.replace("_failed.so", ".so")) if OPENSSL_OUTPUT_DIR: if platform.system() == "Darwin": - openssl_libs = glob.glob(os.path.join(OPENSSL_OUTPUT_DIR, "lib", "lib*.dylib*")) + openssl_libs = glob.glob( + os.path.join(OPENSSL_OUTPUT_DIR, "lib", "lib*.dylib*") + ) openssl_libs = [l for l in openssl_libs if os.path.islink(l) is False] python_openssl_libs = [] @@ -196,7 +200,9 @@ def patch_python_distribution(python_home: str) -> None: subprocess.run(install_name_tool_change_args).check_returncode() elif platform.system() == "Linux": - openssl_libs = glob.glob(os.path.join(OPENSSL_OUTPUT_DIR, "lib", "lib*.so*")) + openssl_libs = glob.glob( + os.path.join(OPENSSL_OUTPUT_DIR, "lib", "lib*.so*") + ) for lib_path in openssl_libs: print(f"Copying {lib_path} to the python home") @@ -297,8 +303,12 @@ def test_python_distribution(python_home: str) -> None: # Specify the location of the debug python import lib (eg. python39_d.lib) python_include_dirs = os.path.join(tmp_python_home, "include") - python_lib = os.path.join(tmp_python_home, "libs", f"python{PYTHON_VERSION}_d.lib") - my_env["CMAKE_ARGS"] = f"-DPython_LIBRARY={python_lib} -DCMAKE_INCLUDE_PATH={python_include_dirs}" + python_lib = os.path.join( + tmp_python_home, "libs", f"python{PYTHON_VERSION}_d.lib" + ) + my_env[ + "CMAKE_ARGS" + ] = f"-DPython_LIBRARY={python_lib} -DCMAKE_INCLUDE_PATH={python_include_dirs}" opentimelineio_install_arg = python_interpreter_args + [ "-m", @@ -440,7 +450,7 @@ def configure() -> None: if OPENSSL_OUTPUT_DIR: configure_args.append(f"--with-openssl={OPENSSL_OUTPUT_DIR}") - + configure_args.append(f"--with-openssl-rpath={OPENSSL_OUTPUT_DIR}/lib") if VARIANT == "Release": configure_args.append("--enable-optimizations") @@ -565,7 +575,6 @@ def build() -> None: if OPENSSL_OUTPUT_DIR: subprocess_env["LC_RPATH"] = os.path.join(OPENSSL_OUTPUT_DIR, "lib") - subprocess.run( build_args, cwd=SOURCE_DIR, @@ -683,7 +692,13 @@ def install() -> None: if platform.system() == "Windows": # Major and minor version of Python without dots. E.g. 3.10.3 -> 310 - parser.add_argument("--python-version", dest="python_version", type=str, required=True, default="") + parser.add_argument( + "--python-version", + dest="python_version", + type=str, + required=True, + default="", + ) parser.set_defaults(clean=False, configure=False, build=False, install=False)