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 fallthrough on failed lookup of pythonLibPath (Linux) #3404

Open
wants to merge 2 commits into
base: dev
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
9 changes: 9 additions & 0 deletions build_scripts/build_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,34 @@ def _GetPythonLibraryFilename(context):
_GetPythonLibraryFilename(context))
elif Linux():
pythonMultiarchSubdir = sysconfig.get_config_var("multiarchsubdir")
searched = set()
# Try multiple ways to get the python lib dir
for pythonLibDir in (sysconfig.get_config_var("LIBDIR"),
os.path.join(pythonBaseDir, "lib")):
if pythonMultiarchSubdir:
pythonLibPath = \
os.path.join(pythonLibDir + pythonMultiarchSubdir,
_GetPythonLibraryFilename(context))
searched.add(pythonLibPath)
if os.path.isfile(pythonLibPath):
break
pythonLibPath = os.path.join(pythonLibDir,
_GetPythonLibraryFilename(context))
searched.add(pythonLibPath)
if os.path.isfile(pythonLibPath):
break
else:
raise RuntimeError(f"Could not find the Python library path at: {searched}")
elif MacOS():
pythonLibPath = os.path.join(pythonBaseDir, "lib",
_GetPythonLibraryFilename(context))
else:
raise RuntimeError("Platform not supported")

assert os.path.exists(pythonExecPath), f"Could not find {pythonExecPath}"
assert os.path.exists(pythonLibPath), f"Could not find {pythonLibPath}"
assert os.path.exists(pythonIncludeDir), f"Could not find {pythonIncludeDir}"

return (pythonExecPath, pythonLibPath, pythonIncludeDir, pythonVersion)

def GetCPUCount():
Expand Down