Skip to content

Commit b235d62

Browse files
committed
Fix lock.yaml write error by redirecting MFC paths to temp directory
The mfc wrapper was trying to write lock.yaml to the read-only Cellar location. This patch overrides mfc.common paths to use the temporary working directory for writable files (build/, lock.yaml) while keeping toolchain and examples pointing to the Homebrew installation.
1 parent f07fe4b commit b235d62

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packaging/homebrew/mfc.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,23 @@ def install
122122
# Copy only pyproject.toml (tiny file, prevents reinstall checks)
123123
cp "#{prefix}/toolchain/pyproject.toml" build/pyproject.toml
124124
125-
# Create a minimal patch file for build.py overrides
125+
# Create a minimal patch file for build.py overrides and path redirection
126126
mkdir -p .mfc_patch
127127
cat > .mfc_patch/build_patch.py << 'PATCH_EOF'
128128
import sys
129+
import os
129130
sys.path.insert(0, "#{prefix}/toolchain")
131+
132+
# Override MFC_ROOT_DIR to point to our temporary directory
133+
# This ensures lock.yaml and other build artifacts are written to writable temp location
134+
import mfc.common
135+
mfc.common.MFC_ROOT_DIR = os.getcwd()
136+
mfc.common.MFC_BUILD_DIR = os.path.join(mfc.common.MFC_ROOT_DIR, "build")
137+
mfc.common.MFC_LOCK_FILEPATH = os.path.join(mfc.common.MFC_BUILD_DIR, "lock.yaml")
138+
# Keep toolchain and examples pointing to Homebrew installation
139+
mfc.common.MFC_TOOLCHAIN_DIR = "#{prefix}/toolchain"
140+
mfc.common.MFC_EXAMPLE_DIRPATH = "#{prefix}/examples"
141+
130142
from mfc.build import MFCTarget
131143
132144
# Override get_install_binpath to use pre-installed binaries

0 commit comments

Comments
 (0)