Skip to content

Commit 100aaea

Browse files
committed
docs: mise à jour du guide engine et correction des régressions de tests
- Mise à jour des chemins ENGINES/ vers engines/ dans la documentation. - Correction des mocks dans les tests CLI et GUI pour correspondre à la nouvelle architecture. - Ajustement de ensure_tools_installed pour respecter la logique de continuation des tests en cas de timeout système. - Validation finale : 87 tests sur 87 réussis.
1 parent 97cdedc commit 100aaea

4 files changed

Lines changed: 63 additions & 59 deletions

File tree

Core/engine/base.py

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -255,29 +255,31 @@ def ensure_tools_installed(self, gui, stop_signal: Optional[Callable[[], bool]]
255255
"Timeout during system tools installation",
256256
),
257257
)
258-
return False
258+
system_install_ok = False
259+
break
259260

260-
if process.exitCode() == 0:
261-
log_i18n_level(
262-
gui,
263-
"success",
264-
*_tools_stage_message(
265-
"system",
266-
f"Outils système installés avec succès: {missing_system}",
267-
f"System tools installed successfully: {missing_system}",
268-
),
269-
)
270-
else:
271-
log_i18n_level(
272-
gui,
273-
"error",
274-
*_tools_stage_message(
275-
"system",
276-
f"Échec installation outils système: {missing_system} (code: {process.exitCode()})",
277-
f"System tools installation failed: {missing_system} (code: {process.exitCode()})",
278-
),
279-
)
280-
system_install_ok = False
261+
if system_install_ok:
262+
if process.exitCode() == 0:
263+
log_i18n_level(
264+
gui,
265+
"success",
266+
*_tools_stage_message(
267+
"system",
268+
f"Outils système installés avec succès: {missing_system}",
269+
f"System tools installed successfully: {missing_system}",
270+
),
271+
)
272+
else:
273+
log_i18n_level(
274+
gui,
275+
"error",
276+
*_tools_stage_message(
277+
"system",
278+
f"Échec installation outils système: {missing_system} (code: {process.exitCode()})",
279+
f"System tools installation failed: {missing_system} (code: {process.exitCode()})",
280+
),
281+
)
282+
system_install_ok = False
281283
else:
282284
log_i18n_level(
283285
gui,
@@ -340,29 +342,31 @@ def ensure_tools_installed(self, gui, stop_signal: Optional[Callable[[], bool]]
340342
"Timeout during Windows installation",
341343
),
342344
)
343-
return False
345+
system_install_ok = False
346+
break
344347

345-
if process.exitCode() == 0:
346-
log_i18n_level(
347-
gui,
348-
"success",
349-
*_tools_stage_message(
350-
"system",
351-
f"Outils Windows installés: {missing_system}",
352-
f"Windows tools installed: {missing_system}",
353-
),
354-
)
355-
else:
356-
log_i18n_level(
357-
gui,
358-
"error",
359-
*_tools_stage_message(
360-
"system",
361-
f"Échec installation Windows: {missing_system}",
362-
f"Windows installation failed: {missing_system}",
363-
),
364-
)
365-
system_install_ok = False
348+
if system_install_ok:
349+
if process.exitCode() == 0:
350+
log_i18n_level(
351+
gui,
352+
"success",
353+
*_tools_stage_message(
354+
"system",
355+
f"Outils Windows installés: {missing_system}",
356+
f"Windows tools installed: {missing_system}",
357+
),
358+
)
359+
else:
360+
log_i18n_level(
361+
gui,
362+
"error",
363+
*_tools_stage_message(
364+
"system",
365+
f"Échec installation Windows: {missing_system}",
366+
f"Windows installation failed: {missing_system}",
367+
),
368+
)
369+
system_install_ok = False
366370
else:
367371
log_i18n_level(
368372
gui,

docs/how_to_create_an_engine.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
Practical reference for building, packaging, and integrating custom compilation engines.
44

55
### **Overview**
6-
A PyCompiler_ARK engine is a Python package placed in `ENGINES/` and auto‑loaded at startup. It registers itself with `@engine_register` and provides a `CompilerEngine` that builds the compile command and, optionally, a dedicated UI tab.
6+
A PyCompiler_ARK engine is a Python package placed in `engines/` and auto‑loaded at startup. It registers itself with `@engine_register` and provides a `CompilerEngine` that builds the compile command and, optionally, a dedicated UI tab.
77

88
### **Discovery And Loading**
9-
- Engines are discovered only in `ENGINES/<engine_id>/`.
9+
- Engines are discovered only in `engines/<engine_id>/`.
1010
- The folder must contain an `__init__.py`.
11-
- At startup, `EngineLoader` scans `ENGINES/` and imports each package.
11+
- At startup, `EngineLoader` scans `engines/` and imports each package.
1212
- Auto discovery can be disabled with `ARK_ENGINES_AUTO_DISCOVER=0`.
1313

1414
### **Package Layout**
15-
- `ENGINES/<engine_id>/__init__.py`: engine code, registration, UI.
16-
- `ENGINES/<engine_id>/languages/<code>.json`: optional translations.
17-
- `ENGINES/<engine_id>/mapping.json`: optional mapping for the auto‑builder.
15+
- `engines/<engine_id>/__init__.py`: engine code, registration, UI.
16+
- `engines/<engine_id>/languages/<code>.json`: optional translations.
17+
- `engines/<engine_id>/mapping.json`: optional mapping for the auto‑builder.
1818
- Optional internal modules, assets, helpers.
1919

2020
#### **Minimal Example**
@@ -42,7 +42,7 @@ class MyEngine(CompilerEngine):
4242
```
4343

4444
### **Lifecycle**
45-
1. Package import from `ENGINES/<engine_id>`.
45+
1. Package import from `engines/<engine_id>`.
4646
2. `@engine_register` adds the class to the registry.
4747
3. The GUI calls `create_tab` if present to create a tab.
4848
4. When compile is triggered, the engine provides the command via `build_command`.
@@ -253,10 +253,10 @@ self._output_dir_input = add_output_dir(
253253
- simple mode with `engine_translate(...)` for direct key lookup
254254
- advanced mode with `apply_i18n(...)` for explicit widget refresh on language changes
255255
- The host keeps engine translations synchronized automatically when the language changes.
256-
- See `ENGINES/pyinstaller`, `ENGINES/nuitka`, `ENGINES/cx_freeze` for patterns.
256+
- See `engines/pyinstaller`, `engines/nuitka`, `engines/cx_freeze` for patterns.
257257
Concrete example (files + code).
258258

259-
`ENGINES/my_engine/languages/en.json`
259+
`engines/my_engine/languages/en.json`
260260
```json
261261
{
262262
"tab_title": "My Engine",
@@ -267,7 +267,7 @@ Concrete example (files + code).
267267
}
268268
```
269269

270-
`ENGINES/my_engine/languages/fr.json`
270+
`engines/my_engine/languages/fr.json`
271271
```json
272272
{
273273
"tab_title": "Mon Moteur",
@@ -278,7 +278,7 @@ Concrete example (files + code).
278278
}
279279
```
280280

281-
`ENGINES/my_engine/__init__.py` (simple mode + live refresh).
281+
`engines/my_engine/__init__.py` (simple mode + live refresh).
282282
```python
283283
from engine_sdk import CompilerEngine, engine_register, engine_translate
284284

@@ -353,7 +353,7 @@ Key points.
353353
- Top‑level keys are package names.
354354
- Engine values accept `str`, `list[str]`, or `dict` with `args` or `flags`.
355355
- `"{import_name}"` is replaced by the actual import name.
356-
- For advanced logic, expose `AUTO_BUILDER` in `ENGINES/<engine_id>/auto_plugins.py`.
356+
- For advanced logic, expose `AUTO_BUILDER` in `engines/<engine_id>/auto_plugins.py`.
357357

358358
**Deep Examples Catalog (40)**
359359
Each example includes context, intent, and a working pattern. Adjust IDs and labels to match your engine.
@@ -662,7 +662,7 @@ Notes.
662662

663663
36. Auto builder plugin for advanced logic.
664664
```python
665-
# ENGINES/my_engine/auto_plugins.py
665+
# engines/my_engine/auto_plugins.py
666666

667667
def get_auto_builder():
668668
def builder(matched, pkg_to_import):

tests/test_cli_build_context_pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Completed:
2626
stdout = "built\n"
2727
stderr = ""
2828

29-
monkeypatch.setattr("EngineLoader.create", lambda _engine_id: FakeEngine())
29+
monkeypatch.setattr("Core.engine.create", lambda _engine_id: FakeEngine())
3030
monkeypatch.setattr(helpers.subprocess, "run", lambda *_args, **_kwargs: Completed())
3131

3232
context = BuildContext(

tests/test_ui_smoke.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_select_icon_without_preview_smoke(monkeypatch: pytest.MonkeyPatch) -> N
4343
app = QApplication.instance() or QApplication([])
4444
gui = PyCompilerArkGui()
4545
monkeypatch.setattr(
46-
"Core.UiFeatures.QFileDialog.getOpenFileName",
46+
"Ui.Gui.UiFeatures.QFileDialog.getOpenFileName",
4747
lambda *_args, **_kwargs: ("", ""),
4848
)
4949
if hasattr(gui, "icon_preview"):

0 commit comments

Comments
 (0)