fix: python agent: use stdlib distutils when setuptools is installed
[lttng-ust.git] / src / python-lttngust / Makefile.am
index 64800e6fafd53587eadc5e94f6dbd8dba7858674..d53e21da6f9957cb5deece0d2034ac32218fd075 100644 (file)
@@ -14,6 +14,15 @@ GENERATED_BINDINGS_DEPS = \
        lttngust/version.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
+
 all-local: build-python-bindings.stamp
 
 copy-static-deps.stamp: $(addprefix $(srcdir)/, $(STATIC_BINDINGS_DEPS))
@@ -36,7 +45,7 @@ install-exec-local: build-python-bindings.stamp
        if [ "$(DESTDIR)" != "" ]; then \
                opts="$$opts --root=$(DESTDIR)"; \
        fi; \
-       $(PYTHON) $(builddir)/setup.py install $$opts;
+       $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts;
 
 clean-local:
        rm -rf $(builddir)/build
This page took 0.025477 seconds and 4 git commands to generate.