Patcher¶
Applies platform-specific source code fixes to gen~ exports (e.g. exp2f -> exp2 on macOS).
patcher ¶
Platform-specific patches for gen~ exports.
Handles issues like: - exp2f -> exp2 for macOS compatibility
PatchResult ¶
PatchResult(
file_path: Path,
patch_name: str,
applied: bool,
message: str,
original_content: Optional[str] = None,
new_content: Optional[str] = None,
)
Result of applying a patch.
Patcher ¶
Apply platform-specific patches to gen~ exports.
Initialize patcher with target directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_path
|
Path | str
|
Path to the gen~ export or project directory. |
required |
apply_all ¶
Apply all available patches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dry_run
|
bool
|
If True, don't modify files, just report what would be done. |
False
|
Returns:
| Type | Description |
|---|---|
list[PatchResult]
|
List of PatchResult objects. |
apply_exp2f_fix ¶
Apply the exp2f -> exp2 fix for macOS compatibility.
On macOS, exp2f may not be found in the math library. The fix is to use exp2 instead, which works on all platforms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dry_run
|
bool
|
If True, don't modify the file, just report. |
False
|
Returns:
| Type | Description |
|---|---|
Optional[PatchResult]
|
PatchResult or None if file not found. |
check_patches_needed ¶
Check which patches are needed without applying them.
Returns:
| Type | Description |
|---|---|
dict[str, bool]
|
Dict mapping patch name to whether it's needed. |