-
Notifications
You must be signed in to change notification settings - Fork 4
[FIX] Release 1.1.1: prefix manager, msix support, config fixes #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """Command implementations used by the CLI entrypoint.""" | ||
|
|
||
| __all__ = ["status", "install", "list_installers"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| """ | ||
| Subpackage containing core building blocks (distro detection, installer scanning, wine helpers). | ||
| """ | ||
|
|
||
| __all__ = [ | ||
| "config_loader", | ||
| "distro_detector", | ||
| "installer_scanner", | ||
| "wine_manager", | ||
| "wine_executor", | ||
| "prefix_manager", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| """Wine prefix management helpers.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import os | ||
| import subprocess | ||
| from pathlib import Path | ||
| from typing import Optional, Tuple | ||
|
|
||
| from affinity_cli.core.wine_manager import WineManager | ||
|
|
||
|
|
||
| class PrefixManager: | ||
| """ | ||
| Minimal manager for creating and checking a Wine prefix. | ||
|
|
||
| This implementation intentionally keeps side effects small; it is enough for | ||
| status checks and install flows while avoiding fragile assumptions. | ||
| """ | ||
|
|
||
| def __init__(self, prefix_path: Path, wine_manager: Optional[WineManager] = None) -> None: | ||
| self.prefix_path = Path(prefix_path).expanduser() | ||
| self.wine_manager = wine_manager or WineManager() | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Basic introspection helpers | ||
| # ------------------------------------------------------------------ | ||
| def prefix_exists(self) -> bool: | ||
| """Return True when the prefix directory looks initialized.""" | ||
| return (self.prefix_path / "drive_c").exists() | ||
|
|
||
| # ------------------------------------------------------------------ | ||
| # Creation helpers | ||
| # ------------------------------------------------------------------ | ||
| def create_prefix(self) -> Tuple[bool, str]: | ||
| """ | ||
| Initialize the Wine prefix using wineboot. | ||
|
|
||
| Returns: | ||
| (success flag, human-readable message) | ||
| """ | ||
| wine_bin = self.wine_manager.get_wine_path() | ||
| if not wine_bin: | ||
| return False, "Wine binary not found; install Wine first." | ||
|
|
||
| try: | ||
| self.prefix_path.mkdir(parents=True, exist_ok=True) | ||
| except OSError as exc: # pragma: no cover - filesystem issues | ||
| return False, f"Unable to create prefix directory: {exc}" | ||
|
|
||
| env = os.environ.copy() | ||
| env["WINEPREFIX"] = str(self.prefix_path) | ||
| env.setdefault("WINEARCH", "win64") | ||
|
|
||
| try: | ||
| result = subprocess.run( | ||
| [str(wine_bin), "wineboot", "-u"], | ||
| env=env, | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=120, | ||
| ) | ||
| except subprocess.TimeoutExpired: # pragma: no cover - rare | ||
| return False, "wineboot timed out while initializing the prefix." | ||
| except Exception as exc: # pragma: no cover - defensive | ||
| return False, f"Failed to initialize prefix: {exc}" | ||
|
|
||
| if result.returncode != 0: | ||
| return False, f"wineboot failed: {result.stderr.strip() or result.stdout.strip()}" | ||
|
|
||
| return True, f"Prefix initialized at {self.prefix_path}" | ||
|
|
||
|
|
||
| __all__ = ["PrefixManager"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.