Page MenuHomePhabricator

[lldb] Unify python site-packages path
AbandonedPublic

Authored by hhb on Sep 20 2019, 2:53 PM.

Details

Reviewers
labath
mgorny
Summary

Before this change, the procedure of installing and loading python
modules are as follow:

  1. finishSwigPythonLLDB.py writes necessary files to

${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/distutils.sysconfig.get_python_lib()

  1. lldb/scripts/CMakeLists.txt installs them to lib${LLVM_LIBDIR_SUFFIX}
  1. ScriptInterpreterPython.cpp adds the right path into PYTHONPATH.

(XCode is using a different path but that's not changed here.)

The issue is that get_python_lib() is platform dependent. It is
difficult to guess the right path in cmake. And it is impossible to be
right when cross compiling.

This change updates finishSwigPythonLLDB.py to output to ${liblldb_build_dir}.
Since cmake will always install them into lib${LLVM_LIBDIR_SUFFIX} , this change
Also updates ScriptInterpreterPython.cpp to load from
${liblldb_path}/../lib${LLVM_LIBDIR_SUFFIX}/site-packages.

Event Timeline

hhb created this revision.Sep 20 2019, 2:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 20 2019, 2:53 PM
hhb updated this revision to Diff 221123.Sep 20 2019, 2:56 PM

Rebase

hhb updated this revision to Diff 221251.Sep 22 2019, 8:40 PM

Fix symbol linker

mgorny requested changes to this revision.Sep 22 2019, 11:02 PM

I do not believe this to be the right approach. Unconditionally installing Python modules to the wrong directory is a bug, not a feature. It should be fixed (as I proposed in D67890), not made more prominent by making everything hinge on it.

This revision now requires changes to proceed.Sep 22 2019, 11:02 PM
labath requested changes to this revision.Sep 23 2019, 6:02 AM

Like I said in the other patch, I think we're stuck with having to match how the python layouts differ between operating systems (though there is definitely a lot of room for improvement in the way that it is done now).

hhb abandoned this revision.Sep 23 2019, 9:59 AM