From b4d95fb0a8d3dfe442abd94e7c419d6ef86e4d4b Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@gmail.com>
Date: Tue, 19 Dec 2023 15:45:26 +0100
Subject: [PATCH] fix: add an info message when pyproject.toml found with no
 'build-backend'

Fixes #57
---
 templates/gitlab-ci-python.yml | 40 ++++++++++++++++------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml
index 8f7c3a0..f5bab37 100644
--- a/templates/gitlab-ci-python.yml
+++ b/templates/gitlab-ci-python.yml
@@ -502,7 +502,6 @@ variables:
     done
   }
 
-
   function guess_build_system() {
     case "${PYTHON_BUILD_SYSTEM:-auto}" in
     auto)
@@ -532,26 +531,25 @@ variables:
       # that might be PEP 517 if a build-backend is specified
       # otherwise it might be only used as configuration file for development tools...
       build_backend=$(sed -rn 's/^build-backend *= *"([^"]*)".*/\1/p' pyproject.toml)
-
-      if [[ "$build_backend" ]]
-      then
-        case "$build_backend" in
-        poetry.core.masonry.api)          
-          log_info "--- Build system auto-detected: PEP 517 with Poetry backend"
-          export PYTHON_BUILD_SYSTEM="poetry"
-          return
-          ;;
-        setuptools.build_meta)          
-          log_info "--- Build system auto-detected: PEP 517 with Setuptools backend"
-          export PYTHON_BUILD_SYSTEM="setuptools"
-          return
-          ;;
-        *)
-          log_error "--- Build system auto-detected: PEP 517 with unsupported backend \\e[33;1m${build_backend}\\e[0m: please read template doc"
-          exit 1
-          ;;
-        esac
-      fi
+      case "$build_backend" in
+      "")
+        log_info "--- Build system auto-detection... pyproject.toml found but no 'build-backend' specified: continue..."
+        ;;
+      poetry.core.masonry.api)
+        log_info "--- Build system auto-detected: PEP 517 with Poetry backend"
+        export PYTHON_BUILD_SYSTEM="poetry"
+        return
+        ;;
+      setuptools.build_meta)
+        log_info "--- Build system auto-detected: PEP 517 with Setuptools backend"
+        export PYTHON_BUILD_SYSTEM="setuptools"
+        return
+        ;;
+      *)
+        log_error "--- Build system auto-detected: PEP 517 with unsupported backend \\e[33;1m${build_backend}\\e[0m: please read template doc"
+        exit 1
+        ;;
+      esac
     fi
 
     if [[ -f "setup.py" ]]
-- 
GitLab