From dbe3fb4597b3e1d598ac00501f345662c77eb510 Mon Sep 17 00:00:00 2001
From: markus holzer <markus.holzer@fau.de>
Date: Tue, 8 Dec 2020 23:36:32 +0100
Subject: [PATCH] Use a lokal function for the import of os

---
 pystencils/__init__.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pystencils/__init__.py b/pystencils/__init__.py
index 05c0b6a30..cac4d0ca4 100644
--- a/pystencils/__init__.py
+++ b/pystencils/__init__.py
@@ -1,5 +1,4 @@
 """Module to generate stencil kernels in C or CUDA using sympy expressions and call them as Python functions"""
-import os.path
 from . import sympy_gmpy_bug_workaround  # NOQA
 from . import fd
 from . import stencil as stencil
@@ -22,10 +21,13 @@ try:
 except ImportError:
     pass
 
+def get_file_path():
+    import os.path
+    file_path = os.path.abspath(os.path.dirname(__file__))
+    return os.path.join(file_path, '../RELEASE-VERSION')
+
 try:
-    my_path = os.path.abspath(os.path.dirname(__file__))
-    path = os.path.join(my_path, '../RELEASE-VERSION')
-    __version__ = open(path, 'r').read()
+    __version__ = open(get_file_path(), 'r').read()
 except IOError:
     __version__ = 'Please install pystencils with setup.py'
 
-- 
GitLab