@@ -34,8 +34,6 @@ Currently-supported options are:
34
34
LazyLoading: Only load an itk library when needed. Before the library is
35
35
loaded, the namespace will be inhabited with dummy objects."""
36
36
37
- import warnings
38
- import os
39
37
40
38
# User options
41
39
SILENT: int = 0
@@ -59,36 +57,45 @@ def _itk_format_warning(msg, *_, **__):
59
57
return str(msg) + "\n"
60
58
61
59
60
+ import warnings
61
+
62
62
# Redefine the format of the warnings
63
63
warnings.formatwarning = _itk_format_warning
64
64
65
65
66
- def _normalized_path(relative_posix_path):
67
- if relative_posix_path != "None":
68
- file_dir = os.path.split(__file__)[0]
69
- relative_path = relative_posix_path.replace("/", os.sep)
70
- return os.path.normpath(os.path.join(file_dir, relative_path))
66
+ def _initialize():
67
+ import os
68
+
69
+ def _normalized_path(relative_posix_path):
70
+ if relative_posix_path != "None":
71
+ file_dir = os.path.split(__file__)[0]
72
+ relative_path = relative_posix_path.replace("/", os.sep)
73
+ return os.path.normpath(os.path.join(file_dir, relative_path))
74
+
75
+ # swig_lib: location of the swig-generated shared libraries
76
+ _swig_lib = _normalized_path("@CONFIG_PYTHON_SWIGLIB_DIR@")
71
77
78
+ # swig_py: location of the xxxPython.py swig-generated python interfaces
79
+ _swig_py = _normalized_path("@CONFIG_PYTHON_SWIGPY_DIR@")
72
80
73
- # swig_lib : location of the swig -generated shared libraries
74
- swig_lib = _normalized_path("@CONFIG_PYTHON_SWIGLIB_DIR @")
81
+ # config_py : location of xxxConfig.py CMake -generated library descriptions
82
+ _config_py = _normalized_path("@CONFIG_PYTHON_CONFIGPY_DIR @")
75
83
76
- # swig_py: location of the xxxPython.py swig-generated python interfaces
77
- swig_py = _normalized_path("@CONFIG_PYTHON_SWIGPY_DIR@")
84
+ # put the itkConfig.py path in the path list
85
+ _path = [os.path.join(_config_py, "..")]
86
+ # also populate path with the WRAPITK_PYTHON_PATH var
87
+ if "WRAPITK_PYTHON_PATH" in os.environ:
88
+ _path.extend(os.environ["WRAPITK_PYTHON_PATH"].split(":"))
78
89
79
- # config_py: location of xxxConfig.py CMake-generated library descriptions
80
- config_py = _normalized_path("@CONFIG_PYTHON_CONFIGPY_DIR@")
90
+ _doxygen_root = _normalized_path("../Doc")
81
91
82
- # put the itkConfig.py path in the path list
83
- path = [os.path.join(config_py, "..")]
84
- # also populate path with the WRAPITK_PYTHON_PATH var
85
- if "WRAPITK_PYTHON_PATH" in os.environ:
86
- path.extend(os.environ["WRAPITK_PYTHON_PATH"].split(":"))
92
+ return _swig_lib, _swig_py, _config_py, _doxygen_root, _path
87
93
88
- doxygen_root = _normalized_path("../Doc")
89
94
90
95
ITK_GLOBAL_VERSION_STRING: str = "@ITK_VERSION_MAJOR@.@ITK_VERSION_MINOR@.@ITK_VERSION_PATCH@"
91
96
97
+ (swig_lib, swig_py, config_py, doxygen_root, path) = _initialize()
98
+ del _initialize
92
99
del _normalized_path
93
100
del os
94
101
del warnings
0 commit comments