diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml
index 1a91abcf1a4ee93798d18b015dff8ccce619c4c9..75c9a905f10716ab19b4eaef7a6ea0cb1bd22427 100644
--- a/templates/gitlab-ci-python.yml
+++ b/templates/gitlab-ci-python.yml
@@ -239,6 +239,13 @@ variables:
       ;;
     esac
 
+    if [[ -f "${PYTHON_REQS_FILE}" ]]
+    then
+      log_info "--- Build system auto-detected: requirements file"
+      export PYTHON_BUILD_SYSTEM="reqfile"
+      return
+    fi
+
     if [[ -f "pyproject.toml" ]]
     then
       # that might be PEP 517 if a build-backend is specified
@@ -273,10 +280,6 @@ variables:
     then
       log_info "--- Build system auto-detected: Pipenv"
       export PYTHON_BUILD_SYSTEM="pipenv"
-    elif [[ -f "${PYTHON_REQS_FILE}" ]]
-    then
-      log_info "--- Build system auto-detected: requirements file"
-      export PYTHON_BUILD_SYSTEM="reqfile"
     else
       log_error "--- Build system auto-detect failed: please read template doc"
       exit 1