From b2ecd871479ac31aabf8d519037a8e051faa57b1 Mon Sep 17 00:00:00 2001
From: "Takumi.Matsunobu" <Takumi.Matsunobu@physik.uni-muenchen.de>
Date: Tue, 25 Jul 2023 16:02:15 +0200
Subject: [PATCH] Use more primitive way to detect version dependency

---
 spack_repo/packages/dwd-icon-tools/package.py | 3 +--
 spack_repo/packages/icon-nwp/package.py       | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/spack_repo/packages/dwd-icon-tools/package.py b/spack_repo/packages/dwd-icon-tools/package.py
index f2f8d06..e686121 100644
--- a/spack_repo/packages/dwd-icon-tools/package.py
+++ b/spack_repo/packages/dwd-icon-tools/package.py
@@ -23,7 +23,6 @@
 from spack.package import *
 import os
 from urllib.parse import urlparse
-from packaging import version
 
 class DwdIconTools(Package):
     """DWD Icon Tools"""
@@ -45,7 +44,7 @@ class DwdIconTools(Package):
 
     depends_on("netcdf-c")
     depends_on("netcdf-fortran")
-    if version.parse(spack.spack_version) < version.parse("23.0.1"):
+    if int(spack.spack_version.split(".")[0]) < 23:
         depends_on("eccodes+fortran")
     else:
         depends_on("eccodes+fortran+tools")
diff --git a/spack_repo/packages/icon-nwp/package.py b/spack_repo/packages/icon-nwp/package.py
index cf6e8c7..89e9b1c 100644
--- a/spack_repo/packages/icon-nwp/package.py
+++ b/spack_repo/packages/icon-nwp/package.py
@@ -8,7 +8,6 @@ import os
 from urllib.parse import urlparse
 
 from spack.package import *
-from packaging import version
 
 class IconNwp(Package):
     """
@@ -57,10 +56,11 @@ class IconNwp(Package):
     depends_on("mpi")
     depends_on("netcdf-c")
     depends_on("netcdf-fortran")
-    if version.parse(spack.spack_version) < version.parse("23.0.1"):
+    if int(spack.spack_version.split(".")[0]) < 23:
         depends_on("eccodes+fortran")
     else:
         depends_on("eccodes+fortran+tools")
+
     depends_on("libxml2")
 
     # If you using inwp_psp=2 (with non-divergent 3D flow), petsc is necessary
-- 
GitLab