lawrence_danna created this revision. lawrence_danna added reviewers: labath, jingham, JDevlieghere. lawrence_danna requested review of this revision. Herald added a project: LLDB.
Some pythons are configured to set platlib somewhere outside of their sys.prefix. It's important that we at least use some reasonable default for LLDB_PYTHON_RELATIVE_PATH even in that case, because even if the user overrides it on the cmake invocation, cmake will still be called without the override in order to build tablegen. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D114973 Files: lldb/bindings/python/get-python-config.py Index: lldb/bindings/python/get-python-config.py =================================================================== --- lldb/bindings/python/get-python-config.py +++ lldb/bindings/python/get-python-config.py @@ -30,7 +30,17 @@ # lldb's python lib will be put in the correct place for python to find it. # If not, you'll have to use lldb -P or lldb -print-script-interpreter-info # to figure out where it is. - print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix)) + try: + print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix)) + except ValueError: + # Try to fall back to something reasonable if sysconfig's platlib + # is outside of sys.prefix + if os.name == 'posix': + print('lib/python%d.%d/site-packages' % sys.version_info[:2]) + elif os.name == 'nt': + print('Lib\\site-packages') + else: + raise elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH": tried = list() exe = sys.executable
Index: lldb/bindings/python/get-python-config.py =================================================================== --- lldb/bindings/python/get-python-config.py +++ lldb/bindings/python/get-python-config.py @@ -30,7 +30,17 @@ # lldb's python lib will be put in the correct place for python to find it. # If not, you'll have to use lldb -P or lldb -print-script-interpreter-info # to figure out where it is. - print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix)) + try: + print(relpath_nodots(sysconfig.get_path("platlib"), sys.prefix)) + except ValueError: + # Try to fall back to something reasonable if sysconfig's platlib + # is outside of sys.prefix + if os.name == 'posix': + print('lib/python%d.%d/site-packages' % sys.version_info[:2]) + elif os.name == 'nt': + print('Lib\\site-packages') + else: + raise elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH": tried = list() exe = sys.executable
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits