5PyXMake is a cross-plattform build tool for source files using either Intel Fortran,
6Py2X, a SSH connection or Doxygen to build a library or to automatically create a
9@note: PyXMake.__init__()
13----------------------------------------------------------------------------------------------
25@author: garb_ma [DLR-FA,STM Braunschweig]
26----------------------------------------------------------------------------------------------
47 from importlib.util
import spec_from_file_location
as load_source
49 from imp
import load_source
53__version_info__ = tuple(map(
lambda n: int(n)
if n.isdigit()
else n,__version__.split(
".")))
56PyXMakePath = os.path.dirname(os.path.abspath(__file__))
59__project__ = os.path.basename(os.path.normpath(PyXMakePath))
62__all__ = [
".".join([__project__,x])
for x
in (
"Plugin",
"VTL")]
65if os.path.exists(os.path.join(sys.prefix,
"conda-meta"))
and not os.path.join(sys.prefix,
"Library",
"bin")
in os.getenv(
"PATH",
""):
66 os.environ[
"PATH"] = os.pathsep.join([os.path.join(sys.prefix,
"Library",
"bin"),os.getenv(
"PATH",
"")])
69if sys.stdin
and sys.stdin.isatty(): setattr(sys,
"frozen", getattr(sys,
"frozen", sys.stdin
and sys.stdin.isatty()))
72if (
not os.path.exists(os.path.join(PyXMakePath,
"VTL",
"examples"))
or
73 not os.listdir(os.path.join(PyXMakePath,
"VTL",
"examples"))
or
74 not os.path.exists(os.path.join(PyXMakePath,
"VTL",
"examples",
"abaqus.py")))
and not getattr(sys,
'frozen',
False):
75 subprocess.check_call([sys.executable,os.path.join(PyXMakePath,
"__setenv__.py"), os.path.join(PyXMakePath,
"VTL",
"__install__.py")])
81if sys.version_info[0] >= 3:
83 try:
from poetry.core._vendor
import typing_extensions
as _
84 except ImportError:
pass
87 try:
from typing_extensions
import TypeAliasType
as _
92 sys_path_backup = copy.deepcopy(sys.path)
95 del sys.modules[
"typing_extensions"]
97 sys.path = [x
for x
in sorted(set(sys_path_backup), key=
lambda x:
'site-packages' in x)
if not x.endswith(
"_vendor")]
99 from typing_extensions
import TypeAliasType
as _
100 from pydantic
import BaseModel
as _
103 finally: sys.path = sys_path_backup
107if not any(path
in sys.modules
for path
in __all__)
and not getattr(sys,
"frozen",
False):
108 for modname, sitedir
in list(itertools.product(__all__,sorted(set(site.getsitepackages()+sys.path)))):
111 expression =
'os.path.join(sitedir,*modname.split("."),"__init__.py")'
112 candidate = eval(
'lambda: ' + expression); candidate = candidate()
113 if not os.path.exists(candidate):
continue
115 expression =
'load_source(modname, os.path.join(sitedir,*modname.split("."),"__init__.py"))'
116 spec = eval(
'lambda: ' + expression); spec = spec()
118 module = importlib.util.module_from_spec(spec)
119 sys.modules[modname] = module
120 spec.loader.exec_module(module)
126try:
from .
import VTL
as Command
129if __name__ ==
'__main__':