Skip to content

Commit

Permalink
update __init__.py for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
thelfer committed Dec 22, 2024
1 parent 96b8ac4 commit fe2e017
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
10 changes: 10 additions & 0 deletions bindings/python/mfm_test_generator/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
if os.name == 'nt':
if "TFELHOME" in os.environ:
tfelhome = os.environ["TFELHOME"]
else:
import pathlib
# remove \python...\site_packages\tfel\__init__.py
tfelhome = pathlib.Path(*pathlib.Path(__file__).parts[0:-4])
os.environ["TFELHOME"] = str(tfelhome)
os.add_dll_directory(tfelhome)

from ._mfm_test_generator import *
13 changes: 12 additions & 1 deletion bindings/python/mfm_test_generator/__init__.py.version.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
import std_@TFEL_SUFFIX_FOR_PYTHON_MODULES@
if os.name == 'nt':
if "TFELHOME" in os.environ:
tfelhome = os.environ["TFELHOME"]
else:
import pathlib
# remove \python...\site_packages\tfel\__init__.py
tfelhome = pathlib.Path(*pathlib.Path(__file__).parts[0:-4])
os.environ["TFELHOME"] = str(tfelhome)

print(f"{tfelhome}")
os.add_dll_directory(tfelhome)

from ._mfm_test_generator import *
1 change: 0 additions & 1 deletion bindings/python/mfront/__init__.py.version.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import std_@TFEL_SUFFIX_FOR_PYTHON_MODULES@
import tfel_@TFEL_SUFFIX_FOR_PYTHON_MODULES@.material
from ._mfront import *

Expand Down
12 changes: 12 additions & 0 deletions bindings/python/mtest/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
from __future__ import division
import os

if os.name == 'nt':
if "TFELHOME" in os.environ:
tfelhome = os.environ["TFELHOME"]
else:
import pathlib
# remove \python...\site_packages\tfel\__init__.py
tfelhome = pathlib.Path(*pathlib.Path(__file__).parts[0:-4])
os.environ["TFELHOME"] = str(tfelhome)
os.add_dll_directory(tfelhome)

from ._mtest import *

def generateMaterialPropertyReferenceFile(library,
Expand Down
14 changes: 13 additions & 1 deletion bindings/python/tfel/__init__.py.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# from ._tfel import *
import os

if os.name == 'nt':
if "TFELHOME" in os.environ:
tfelhome = os.environ["TFELHOME"]
else:
import pathlib
# remove \python...\site_packages\tfel\__init__.py
tfelhome = pathlib.Path(*pathlib.Path(__file__).parts[0:-4])
os.environ["TFELHOME"] = str(tfelhome)
os.add_dll_directory(tfelhome)

from ._tfel import *

16 changes: 14 additions & 2 deletions bindings/python/tfel/__init__.py.version.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
import std_@TFEL_SUFFIX_FOR_PYTHON_MODULES@
from ._tfel import *
import os

if os.name == 'nt':
if "TFELHOME" in os.environ:
tfelhome = os.environ["TFELHOME"]
else:
import pathlib
# remove \python...\site_packages\tfel\__init__.py
tfelhome = pathlib.Path(*pathlib.Path(__file__).parts[0:-4])
os.environ["TFELHOME"] = str(tfelhome)
os.add_dll_directory(tfelhome)

from ._tfel_@TFEL_SUFFIX_FOR_PYTHON_MODULES@ import *

0 comments on commit fe2e017

Please sign in to comment.