[all-commits] [llvm/llvm-project] 632707: [lldb] remove usage of distutils, fix python path ...

lawrence-danna-apple via All-commits all-commits at lists.llvm.org
Wed Nov 17 13:14:49 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 63270710f13af10808aac980795128db127153f5
      https://github.com/llvm/llvm-project/commit/63270710f13af10808aac980795128db127153f5
  Author: Lawrence D'Anna <lawrence_danna at apple.com>
  Date:   2021-11-17 (Wed, 17 Nov 2021)

  Changed paths:
    M lldb/CMakeLists.txt
    M lldb/bindings/python/get-python-config.py

  Log Message:
  -----------
  [lldb] remove usage of distutils, fix python path on debian/ubuntu

distutils is deprecated and will be removed, so we shouldn't be
using it.

We were using it to compute LLDB_PYTHON_RELATIVE_PATH.

Discussing a similar issue
[at python.org](https://bugs.python.org/issue41282), Filipe LaĆ­ns said:

    If you are relying on the value of distutils.sysconfig.get_python_lib()
    as you shown in your system, you probably don't want to. That
    directory (dist-packages) should be for Debian provided packages
    only, so moving to sysconfig.get_path() would be a good thing,
    as it has the correct value for user installed packages on your
    system.

So I propose using a relative path from `sys.prefix` to
`sysconfig.get_path("platlib")` instead.

On Mac and windows, this results in the same paths as we had before,
which are `lib/python3.9/site-packages` and `Lib\site-packages`,
respectively.

On ubuntu however, this will change the path from
`lib/python3/dist-packages` to `lib/python3.9/site-packages`.

This change seems to be correct, as Filipe said above, `dist-packages`
belongs to the distribution, not us.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D114106




More information about the All-commits mailing list