fix: python agent: use stdlib distutils when setuptools is installed
[lttng-ust.git] / python-lttngust / Makefile.am
index b5154c0a68c0c0e3137963e72d80bc26b7f6be4a..c3280b705e8b73339cffd47e816b5adad70f35ef 100644 (file)
@@ -2,6 +2,15 @@ GENERATED_BINDINGS_DEPS = \
        lttngust/__init__.py \
        setup.py
 
+# For python < 3.12, force the use of distutils even if setuptools is
+# installed. For python >= 3.12, set the externally managed option to allow
+# installation in a directory which isn't in the current PYTHONPATH.
+if HAVE_PYTHON_312_OR_GREATER
+PY_INSTALL_OPTS = --single-version-externally-managed
+else
+export SETUPTOOLS_USE_DISTUTILS=stdlib
+endif
+
 # Use setup.py for the installation instead of Autoconf.
 # This ease the installation process and assure a *pythonic*
 # installation.
@@ -13,7 +22,7 @@ install-exec-local:
        if [ "$(DESTDIR)" != "" ]; then \
                opts="$$opts --root=$(DESTDIR)"; \
        fi; \
-       $(PYTHON) setup.py install $$opts;
+       $(PYTHON) setup.py install $(PY_INSTALL_OPTS) $$opts;
 
 clean-local:
        rm -rf $(builddir)/build
This page took 0.022799 seconds and 4 git commands to generate.