Build system: implement REUSE with SPDX identifiers
[lttng-ust.git] / src / python-lttngust / Makefile.am
index 64800e6fafd53587eadc5e94f6dbd8dba7858674..30db9fbc0f3fed90ad8c489771a0192a344d2b06 100644 (file)
@@ -1,3 +1,5 @@
+# SPDX-FileCopyrightText: 2023 EfficiOS, Inc
+#
 # SPDX-License-Identifier: LGPL-2.1-only
 
 INSTALLED_FILES=$(builddir)/installed_files.txt
@@ -14,10 +16,19 @@ 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))
-       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+       $(AM_V_at)if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for file in $(STATIC_BINDINGS_DEPS); do \
                        cp -f $(srcdir)/$$file $(builddir)/$$file; \
                done; \
@@ -28,19 +39,19 @@ copy-static-deps.stamp: $(addprefix $(srcdir)/, $(STATIC_BINDINGS_DEPS))
 # This ease the installation process and assure a *pythonic*
 # installation.
 build-python-bindings.stamp: copy-static-deps.stamp $(GENERATED_BINDINGS_DEPS)
-       $(PYTHON) $(builddir)/setup.py build --force
+       $(AM_V_at)$(PYTHON) $(builddir)/setup.py build --force
        touch $@
 
 install-exec-local: build-python-bindings.stamp
-       @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
+       $(AM_V_at)opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
        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
-       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+       $(AM_V_at)if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for file in $(STATIC_BINDINGS_DEPS); do \
                        rm -f $(builddir)/$$file; \
                done; \
This page took 0.024736 seconds and 4 git commands to generate.