Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix make_python.py on Apple Silicon + Sonoma 14.5 #523

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/build/make_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -440,7 +450,8 @@ def configure() -> None:

if OPENSSL_OUTPUT_DIR:
configure_args.append(f"--with-openssl={OPENSSL_OUTPUT_DIR}")

if platform.system() == "Darwin":
configure_args.append(f"--with-openssl-rpath={OPENSSL_OUTPUT_DIR}/lib")

if VARIANT == "Release":
configure_args.append("--enable-optimizations")
Expand Down Expand Up @@ -565,7 +576,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,
Expand Down Expand Up @@ -683,7 +693,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)

Expand Down