From 72c457b79d7d3c36bfcc17ea947171f494d1f7e0 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 19 Mar 2021 09:14:25 +0100
Subject: [PATCH] [cmake] Refacotred python requirement of TESPy.

Maybe removed later on:

https://github.com/oemof/tespy/issues/252
---
 CMakeLists.txt                          | 6 +++++-
 ProcessLib/HeatTransportBHE/Tests.cmake | 2 +-
 scripts/python/pyproject.in.toml        | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9f417fe378..2def4f3049a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -229,8 +229,12 @@ include(UnityBuildSettings)
 if(POETRY)
     file(STRINGS ${PROJECT_BINARY_DIR}/.python_packages OGS_PYTHON_PACKAGES)
     list(REMOVE_DUPLICATES OGS_PYTHON_PACKAGES)
+    # Hack for tespy requirement
+    if(${Python3_VERSION} VERSION_LESS 3.10)
+        set(_python_arg --python <3.9)
+    endif()
     execute_process(
-        COMMAND ${_CMD_COMMAND} poetry add ${OGS_PYTHON_PACKAGES}
+        COMMAND ${_CMD_COMMAND} poetry add ${_python_arg} ${OGS_PYTHON_PACKAGES}
         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
     )
 endif()
diff --git a/ProcessLib/HeatTransportBHE/Tests.cmake b/ProcessLib/HeatTransportBHE/Tests.cmake
index 1014e8a7cab..36985ca2c2f 100644
--- a/ProcessLib/HeatTransportBHE/Tests.cmake
+++ b/ProcessLib/HeatTransportBHE/Tests.cmake
@@ -92,7 +92,7 @@ if("${Python3_VERSION}" VERSION_LESS 3.9)
         WRAPPER time
         TESTER vtkdiff
         REQUIREMENTS OGS_USE_PYTHON AND NOT OGS_USE_MPI
-        PYTHON_PACKAGES "TESPy=0.3.2 --python \">=3.6,<3.9\""
+        PYTHON_PACKAGES "TESPy=0.3.2"
         DIFF_DATA
         3bhes_1U_ts_10_t_600.000000.vtu 3bhes_1U_ts_10_t_600.000000.vtu temperature_soil temperature_soil 1e-12 1e-13
         3bhes_1U_ts_10_t_600.000000.vtu 3bhes_1U_ts_10_t_600.000000.vtu temperature_BHE1 temperature_BHE1 1e-10 1e-13
diff --git a/scripts/python/pyproject.in.toml b/scripts/python/pyproject.in.toml
index bb061069ef1..0adfb1eeb9b 100644
--- a/scripts/python/pyproject.in.toml
+++ b/scripts/python/pyproject.in.toml
@@ -5,7 +5,7 @@ description = "CMake auto-generated"
 authors = [""]
 
 [tool.poetry.dependencies]
-python = "^@ogs.minimum_version.python@"
+python = ">=@ogs.minimum_version.python@"
 
 [tool.poetry.dev-dependencies]
 
-- 
GitLab