From 09970cf89cd8e7132c33a5aa21ae5a0b0682fcdf Mon Sep 17 00:00:00 2001
From: Stefan Possanner <spossann@ipp.mpg.de>
Date: Mon, 10 Jul 2023 15:07:14 +0200
Subject: [PATCH] Add compile flag `--conda-warnings off` only if pyccel
 version is 1.8.0 or greater.

---
 CHANGELOG.md                          |  4 ++--
 pyproject.toml                        |  2 +-
 src/gvec_to_python/Makefile           |  2 +-
 src/gvec_to_python/console/compile.py | 10 ++++++++++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 584230b..2336904 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,3 @@
-## Version 1.1.2
+## Version 1.1.3
 
-* Move to gvec group
\ No newline at end of file
+* Add compile flag `--conda-warnings off` only if pyccel version is 1.8.0 or greater.
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index e97f598..68564bd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "gvec-to-python"
-version = "1.1.2"
+version = "1.1.3"
 readme = "README.md"
 requires-python = ">=3.7"
 license = {file = "LICENSE"}
diff --git a/src/gvec_to_python/Makefile b/src/gvec_to_python/Makefile
index da6bfb3..29b50e1 100644
--- a/src/gvec_to_python/Makefile
+++ b/src/gvec_to_python/Makefile
@@ -5,7 +5,7 @@
 PYTHON  := python3
 SO_EXT  := $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
 LIBDIR  := $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
-FLAGS            := --libdir $(LIBDIR) --conda-warnings off
+FLAGS            := --libdir $(LIBDIR) $(flags) 
 
 #--------------------------------------
 # SOURCE FILES 
diff --git a/src/gvec_to_python/console/compile.py b/src/gvec_to_python/console/compile.py
index 6e56e53..40a0f00 100644
--- a/src/gvec_to_python/console/compile.py
+++ b/src/gvec_to_python/console/compile.py
@@ -3,13 +3,23 @@ def compile_gvec_to_python():
     import subprocess
     import os
     import gvec_to_python
+    import pyccel
 
     libpath = gvec_to_python.__path__[0]
     
+    # pyccel flags
+    flags = ''
+    
+    _li = pyccel.__version__.split('.')
+    _num = int(_li[0])*100 + int(_li[1])*10 + int(_li[2])
+    if _num >= 180:
+        flags += '--conda-warnings off'
+    
     print('\nCompiling gvec-to-python kernels ...')
     subprocess.run(['make', 
                     '-f', 
                     os.path.join(libpath, 'Makefile'),
+                    'flags=' + flags,
                     'install_path=' + libpath,
                     ], check=True, cwd=libpath)
     print('Done.')
-- 
GitLab