[Lldb-commits] [PATCH] D67890: [lldb] [cmake] Fix installing Python modules on systems using /usr/lib

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 23 10:32:16 PDT 2019


mgorny marked an inline comment as done.
mgorny added inline comments.


================
Comment at: lldb/scripts/get_relative_lib_dir.py:26
     split_libdir = arch_specific_libdir.split(os.sep)
-    lib_re = re.compile(r"^lib.+$")
+    lib_re = re.compile(r"^lib.*$")
 
----------------
hhb wrote:
> mgorny wrote:
> > hhb wrote:
> > > If we go this way, should we always use LLDB_PYTHON_RELATIVE_LIBDIR in ScriptInterpreterPython.cpp, and add some code to make sure it is defined? Because all assumption of the path can be wrong.
> > > 
> > > After the change here, I think POSIX will always use LLDB_PYTHON_RELATIVE_LIBDIR. But for windows, the path is still hard coded to lib/site-packages.
> > > 
> > > (maybe finishSwigPythonLLDB.py / make_symlink() can also be updated to use os.path.relpath? )
> > Actually, I think we can kill all this logic by simply passing `''` as prefix, as I did in the CMake part.
> I'm not sure. On my machine:
> 
> $ python3
> Python 3.6.8 (default, Jan  3 2019, 03:42:36)
> [GCC 8.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> \>>> import distutils.sysconfig
> \>>> distutils.sysconfig.get_python_lib(True, False)
> '/usr/lib/python3/dist-packages'
> \>>> distutils.sysconfig.get_python_lib(True, False, '')
> 'lib/python3/dist-packages'
> \>>> distutils.sysconfig.get_python_lib(True, False, '/src/lib')
> '/src/lib/lib/python3.6/site-packages'
> 
Hm, that's interesting. The documentation says:

> If 'prefix' is supplied, use it instead of sys.base_prefix or sys.base_exec_prefix -- i.e., ignore 'plat_specific'.

So apparently first arg being true is meaningless then. Maybe we should go for `get_python_lib(False, False, '')`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67890/new/

https://reviews.llvm.org/D67890





More information about the lldb-commits mailing list