Skip to content

Commit e8597d8

Browse files
committed
ajout du system d' autoplugin
1 parent a558deb commit e8597d8

4 files changed

Lines changed: 121 additions & 4 deletions

File tree

ENGINES/nuitka/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from PySide6.QtCore import QDir
3131
from PySide6.QtWidgets import QFileDialog, QInputDialog, QCheckBox, QLineEdit
3232

33-
from engine_sdk import CompilerEngine, engine_register
33+
from engine_sdk import CompilerEngine, compute_auto_for_engine, engine_register
3434

3535

3636
@engine_register
@@ -138,6 +138,14 @@ def build_command(self, gui, file: str) -> list[str]:
138138
if selected_icon:
139139
cmd.extend(["--windows-icon", selected_icon])
140140

141+
# Auto-mapping args (mapping.json / auto builder)
142+
try:
143+
auto_args = compute_auto_for_engine(gui, self.id)
144+
if auto_args:
145+
cmd.extend(auto_args)
146+
except Exception:
147+
pass
148+
141149
# Add the target file
142150
cmd.append(file)
143151

ENGINES/nuitka/mapping.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"__meta__": {
3+
"title": "Nuitka auto-mapping",
4+
"version": "1.0.0",
5+
"description": "Auto args for Nuitka based on detected packages."
6+
},
7+
"__aliases__": {
8+
"import_to_package": {
9+
"cv2": "opencv-python",
10+
"pil": "Pillow",
11+
"sklearn": "scikit-learn",
12+
"skimage": "scikit-image",
13+
"yaml": "PyYAML",
14+
"bs4": "beautifulsoup4"
15+
},
16+
"package_to_import_name": {
17+
"opencv-python": "cv2",
18+
"Pillow": "PIL",
19+
"scikit-learn": "sklearn",
20+
"scikit-image": "skimage",
21+
"PyYAML": "yaml",
22+
"beautifulsoup4": "bs4"
23+
}
24+
},
25+
"numpy": {
26+
"nuitka": {
27+
"args": ["--enable-plugin=numpy"]
28+
}
29+
},
30+
"matplotlib": {
31+
"nuitka": {
32+
"args": ["--include-package-data={import_name}"]
33+
}
34+
},
35+
"Pillow": {
36+
"nuitka": {
37+
"args": ["--include-package-data={import_name}"]
38+
}
39+
},
40+
"opencv-python": {
41+
"nuitka": {
42+
"args": ["--include-module={import_name}"]
43+
}
44+
},
45+
"pandas": {
46+
"nuitka": {
47+
"args": ["--include-package={import_name}"]
48+
}
49+
},
50+
"scipy": {
51+
"nuitka": {
52+
"args": ["--include-package={import_name}"]
53+
}
54+
},
55+
"scikit-learn": {
56+
"nuitka": {
57+
"args": ["--include-package={import_name}"]
58+
}
59+
},
60+
"scikit-image": {
61+
"nuitka": {
62+
"args": ["--include-package={import_name}"]
63+
}
64+
},
65+
"lxml": {
66+
"nuitka": {
67+
"args": ["--include-package={import_name}"]
68+
}
69+
},
70+
"PyYAML": {
71+
"nuitka": {
72+
"args": ["--include-module={import_name}"]
73+
}
74+
},
75+
"multiprocessing": {
76+
"nuitka": {
77+
"args": ["--enable-plugin=multiprocessing"]
78+
}
79+
},
80+
"PySide6": {
81+
"nuitka": {
82+
"args": ["--enable-plugin=pyside6"]
83+
}
84+
},
85+
"PySide2": {
86+
"nuitka": {
87+
"args": ["--enable-plugin=pyside2"]
88+
}
89+
},
90+
"PyQt5": {
91+
"nuitka": {
92+
"args": ["--enable-plugin=pyqt5"]
93+
}
94+
},
95+
"PyQt6": {
96+
"nuitka": {
97+
"args": ["--enable-plugin=pyqt6"]
98+
}
99+
}
100+
}

engine_sdk/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
from __future__ import annotations
1717

1818
# Re-export auto_plugins helpers for convenience
19-
from .auto_build_command import compute_for_all, register_auto_builder
19+
from .auto_build_command import (
20+
compute_auto_for_engine,
21+
compute_for_all,
22+
register_auto_builder,
23+
)
2024

2125
__version__ = "1.0.0"
2226
# Re-export the base interface used by the host
@@ -213,6 +217,7 @@ def check_engine_compatibility(engine_class, required_sdk_version: str = None) -
213217
"CompilerEngine",
214218
"engine_register",
215219
"register",
220+
"compute_auto_for_engine",
216221
"compute_for_all",
217222
"register_auto_builder",
218223
"registry",

engine_sdk/auto_build_command.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from __future__ import annotations
22

33
# Pass-through to host auto_plugins helpers
4-
from Core.Auto_Command_Builder import compute_for_all, register_auto_builder
4+
from Core.Auto_Command_Builder import (
5+
compute_auto_for_engine,
6+
compute_for_all,
7+
register_auto_builder,
8+
)
59

6-
__all__ = ["compute_for_all", "register_auto_builder"]
10+
__all__ = ["compute_auto_for_engine", "compute_for_all", "register_auto_builder"]

0 commit comments

Comments
 (0)