Skip to content

Commit c110495

Browse files
committed
feat(installer): introduce python_module parameter for module name handling
Add a new parameter `python_module` to the `PythonProjectInstaller` class to facilitate the use of module names in wrappers, particularly when the CLI name contains hyphens. Update the logic to derive the module name from this parameter, ensuring consistency in module naming across different installations. Additionally, propagate this change to the `_ToolPythonInstaller` class to maintain compatibility.
1 parent 795e897 commit c110495

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

GameAssets/src/gameassets/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,7 @@ def _run_check_glb(
11471147
) -> StageResult:
11481148
import time as _time
11491149

1150-
bin_ = _bin_or_none("GAMEDEV_LAB_BIN", "gamedev-lab")
1150+
bin_ = _bin_or_none("GAMEDEVLAB_BIN", "gamedev-lab")
11511151
if not bin_:
11521152
return StageResult("validate", False, 0.0, "gamedev-lab não encontrado no PATH")
11531153
argv = [bin_, "check", "glb", str(glb), str(rules)]

Shared/src/gamedev_shared/installer/python_installer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def __init__(
7474
skip_pytorch: bool = False,
7575
min_python: tuple[int, int] = (3, 10),
7676
cross_dep_folders: list[tuple[Path, str]] | None = None,
77+
python_module: str | None = None,
7778
) -> None:
7879
super().__init__(
7980
project_name=project_name,
@@ -87,6 +88,10 @@ def __init__(
8788
self.skip_models = skip_models
8889
self.force = force
8990
self.skip_pytorch = skip_pytorch
91+
# ``python_module`` é usado em ``-m <module>`` nos wrappers; difere do
92+
# ``cli_name`` quando este contém hífens (ex.: ``gamedev-lab`` →
93+
# módulo ``gamedev_lab``).
94+
self.python_module = python_module or cli_name.replace("-", "_")
9095
self.min_python = min_python
9196
self._use_uv = has_uv()
9297
self.cross_dep_folders: list[tuple[Path, str]] = cross_dep_folders or []
@@ -412,9 +417,9 @@ def create_cli_wrappers(self, extra_aliases: list[str] | None = None) -> None:
412417
self.create_wrapper(
413418
self.cli_name,
414419
python_path=python_path,
415-
module_name=self.cli_name,
420+
module_name=self.python_module,
416421
)
417-
mod = self.cli_name
422+
mod = self.python_module
418423
for alias in extra_aliases or []:
419424
if self.is_windows:
420425
w = self.bin_dir / f"{alias}.cmd"

Shared/src/gamedev_shared/installer/unified.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(
4949
skip_pytorch=not spec.needs_pytorch,
5050
min_python=spec.min_python,
5151
cross_dep_folders=self._resolve_cross_deps(spec, monorepo),
52+
python_module=spec.python_module or None,
5253
)
5354
self.spec = spec
5455
self.skip_env_config = skip_env_config

0 commit comments

Comments
 (0)