From 987291e052a8eda845ec5d408163954bb98a2688 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 1 Feb 2013 23:40:18 +0000 Subject: [PATCH] [Cython] Added 'add_module_directory' utility function --- interfaces/cython/cantera/utils.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/interfaces/cython/cantera/utils.py b/interfaces/cython/cantera/utils.py index fd82e75eb..d793b0fec 100644 --- a/interfaces/cython/cantera/utils.py +++ b/interfaces/cython/cantera/utils.py @@ -1,4 +1,7 @@ -from . import Solution +import os +import inspect + +from . import Solution, add_directory def import_phases(filename, phase_names): @@ -7,3 +10,11 @@ def import_phases(filename, phase_names): entered as a list of strings. """ return [Solution(filename, p) for p in phase_names] + + +def add_module_directory(): + """ + Add the directory containing the module from which this function is called + to the Cantera input file search path. + """ + add_directory(os.path.dirname(os.path.abspath(inspect.stack()[1][1])))