🚨 Get rid of an "imp" deprecation warning

Our distutils import used to determine the current
interpreter's site-packages directory caused
an import warning.

Switching to a different method of determining
the path solved the error and is also way
cleaner.

Found here: https://stackoverflow.com/a/52638888
This commit is contained in:
Gina Häußge committed 2021-12-06 18:26:37 +01:00
1 parent 8d7ace50a3
commit 32943e191d
1 file changed
+2 -6
+2 -6
View File
@@ -907,13 +907,9 @@ class PluginManager(object):
def _detect_python_environment(self):
import sys
from distutils.command.install import install as cmd_install
from distutils.dist import Distribution
import sysconfig
cmd = cmd_install(Distribution())
cmd.finalize_options()
self._python_install_dir = cmd.install_lib
self._python_install_dir = sysconfig.get_path("purelib")
self._python_prefix = os.path.realpath(sys.prefix)
self._python_virtual_env = hasattr(sys, "real_prefix") or (
hasattr(sys, "base_prefix")