diff --git a/language-configuration.json b/language-configuration.json new file mode 100644 index 0000000..c5cda9f --- /dev/null +++ b/language-configuration.json @@ -0,0 +1,16 @@ +{ + "comments": { + "lineComment": "#" + }, + "brackets": [ + ["(", ")"], + ["[", "]"], + ["{", "}"] + ], + "autoClosingPairs": [ + { "open": "(", "close": ")" }, + { "open": "[", "close": "]" }, + { "open": "{", "close": "}" }, + { "open": "\"", "close": "\"" } + ] +} diff --git a/package-lock.json b/package-lock.json index 3417108..f67a39c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -901,9 +901,6 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -924,9 +921,6 @@ "cpu": [ "arm" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -947,9 +941,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -970,9 +961,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -993,9 +981,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1016,9 +1001,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1184,9 +1166,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1201,9 +1180,6 @@ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1218,9 +1194,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1235,9 +1208,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1252,9 +1222,6 @@ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1269,9 +1236,6 @@ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1286,9 +1250,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1303,9 +1264,6 @@ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1320,9 +1278,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1337,9 +1292,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1354,9 +1306,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1371,9 +1320,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1388,9 +1334,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1673,9 +1616,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1692,9 +1632,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1711,9 +1648,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1730,9 +1664,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -4282,9 +4213,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4305,9 +4233,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4328,9 +4253,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -4351,9 +4273,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ diff --git a/package.json b/package.json index d4f1f75..cbd26a5 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,13 @@ "path": "./syntaxes/comm.tmLanguage.json" } ], + "keybindings": [ + { + "command": "editor.action.commentLine", + "key": "ctrl+shift+;", + "when": "editorTextFocus && editorLangId == comm" + } + ], "menus": { "editor/title": [ { diff --git a/python/med2obj.py b/python/med2obj.py index 264d459..9996568 100644 --- a/python/med2obj.py +++ b/python/med2obj.py @@ -5,9 +5,48 @@ import argparse +import os import pathlib as pl - -import medcoupling as mc +import sys + +python_version = sys.version_info + +if sys.platform == "win32" and python_version >= (3, 8): + # On Windows, we need to ensure that the DLLs are found, from Python 3.8 we need to + # use os.add_dll_directory to add the directory containing the DLLs. + # Add the directory of the current script to the DLL search path + # This is necessary for Python 3.8+ on Windows to find the DLLs. + # To simplify we use the LD_LIBRARY_PATH environment variable like on Unix systems. + # ld_library_path = os.getenv("LD_LIBRARY_PATH", "") + + appdata = os.environ["LOCALAPPDATA"] + + if (pl.Path(appdata) / "code_aster").exists(): + ### Attach to code_aster windows install + python_path = ( + rf"{appdata}\code_aster\external\medcoupling-9.11.0\lib\python3.10\site-packages" + ) + sys.path.append(python_path) + + ld_library_path = [ + rf"{appdata}\code_aster\Python3.10", + rf"{appdata}\code_aster\external\hdf51.10.5\bin", + rf"{appdata}\code_aster\external\hdf51.10.5\lib", + rf"{appdata}\code_aster\external\MED-4.4.1\lib", + rf"{appdata}\code_aster\external\medcoupling-9.11.0\lib", + rf"{appdata}\code_aster\external\medcoupling-9.11.0\libpython3.10\site-packages", + rf"{appdata}\code_aster\external", + ] + + if ld_library_path: + # Split the LD_LIBRARY_PATH and add each directory + for path in ld_library_path: + print("Adding directory:", path) + if os.path.isdir(path): + print(os.add_dll_directory(os.path.abspath(path))) + sys.path.append(path) + +import medcoupling as mc # noqa E402 def parse_args():