@@ -73,62 +73,64 @@ def install
7373 # 2. Sets up toolchain symlink so mfc.sh can find toolchain/util.sh
7474 # 3. Ensures mfc.sh doesn't reinstall packages by copying pyproject.toml
7575 ( bin /"mfc" ) . write <<~EOS
76- #!/bin/bash
77- set -e
76+ #!/bin/bash
77+ set -e
7878
79- # Unset VIRTUAL_ENV to ensure mfc.sh uses the copied venv, not the Cellar one
80- unset VIRTUAL_ENV
79+ # Unset VIRTUAL_ENV to ensure mfc.sh uses the copied venv, not the Cellar one
80+ unset VIRTUAL_ENV
8181
82- # Create a temporary working directory (Cellar is read-only)
83- TMPDIR=$(mktemp -d)
84- trap "rm -rf $TMPDIR" EXIT
82+ # Create a temporary working directory (Cellar is read-only)
83+ TMPDIR=$(mktemp -d)
84+ trap "rm -rf $TMPDIR" EXIT
8585
86- # Copy mfc.sh to temp dir (it may try to write build artifacts)
87- cp "#{ libexec } /mfc.sh" "$TMPDIR/"
88- cd "$TMPDIR"
86+ # Copy mfc.sh to temp dir (it may try to write build artifacts)
87+ cp "#{ libexec } /mfc.sh" "$TMPDIR/"
88+ cd "$TMPDIR"
8989
90- # Copy toolchain directory (not symlink) so Python paths resolve correctly
91- # This prevents paths from resolving back to read-only Cellar
92- cp -R "#{ prefix } /toolchain" toolchain
90+ # Copy toolchain directory (not symlink) so Python paths resolve correctly
91+ # This prevents paths from resolving back to read-only Cellar
92+ cp -R "#{ prefix } /toolchain" toolchain
9393
94- # Patch toolchain to use Homebrew-installed binaries
95- # Replace get_install_binpath to return Homebrew bin directory
96- cat >> toolchain/mfc/build.py << 'PATCH_EOF'
94+ # Patch toolchain to use Homebrew-installed binaries
95+ # Replace get_install_binpath to return Homebrew bin directory
96+ cat >> toolchain/mfc/build.py << 'PATCH_EOF'
9797
9898 # Homebrew patch: Override get_install_binpath to use pre-installed binaries
9999 _original_get_install_binpath = MFCTarget.get_install_binpath
100100 def _homebrew_get_install_binpath(self, case):
101101 return "#{ bin } /" + self.name
102102 MFCTarget.get_install_binpath = _homebrew_get_install_binpath
103103
104- # Also override is_built to check Homebrew bin directory
105- _original_is_built = MFCTarget.is_built
106- def _homebrew_is_built(self, case):
107- import os
108- if self.name in ["pre_process", "simulation", "post_process"]:
109- return os.path.isfile("#{ bin } /" + self.name)
110- return _original_is_built(self, case)
111- MFCTarget.is_built = _homebrew_is_built
112- PATCH_EOF
113-
114- # Copy examples directory (required by mfc.sh Python code)
115- cp -R "#{ prefix } /examples" examples
116-
117- # Create build directory and copy venv (not symlink - needs to be writable)
118- # Use cp -R for a full recursive copy
119- mkdir -p build
120- cp -R "#{ venv } " build/venv
121-
122- # Copy pyproject.toml to build/ so mfc.sh thinks dependencies are already installed
123- cp "#{ prefix } /toolchain/pyproject.toml" build/pyproject.toml
124-
125- # For 'mfc run', add --no-build flag to skip compilation
126- if [ "$1" = "run" ]; then
127- exec ./mfc.sh "$@" --no-build
128- else
129- exec ./mfc.sh "$@"
130- fi
104+ # Override is_buildable to skip building main targets and syscheck
105+ _original_is_buildable = MFCTarget.is_buildable
106+ def _homebrew_is_buildable(self):
107+ if self.name in ["pre_process", "simulation", "post_process", "syscheck"]:
108+ return False # Skip building - use pre-installed binaries
109+ return _original_is_buildable(self)
110+ MFCTarget.is_buildable = _homebrew_is_buildable
111+ PATCH_EOF
112+
113+ # Copy examples directory (required by mfc.sh Python code)
114+ cp -R "#{ prefix } /examples" examples
115+
116+ # Create build directory and copy venv (not symlink - needs to be writable)
117+ # Use cp -R for a full recursive copy
118+ mkdir -p build
119+ cp -R "#{ venv } " build/venv
120+
121+ # Copy pyproject.toml to build/ so mfc.sh thinks dependencies are already installed
122+ cp "#{ prefix } /toolchain/pyproject.toml" build/pyproject.toml
123+
124+ # For 'mfc run', add --no-build flag to skip compilation
125+ if [ "$1" = "run" ]; then
126+ exec ./mfc.sh "$@" --no-build
127+ else
128+ exec ./mfc.sh "$@"
129+ fi
131130 EOS
131+
132+ # Make the wrapper script executable
133+ ( bin /"mfc" ) . chmod 0755
132134 end
133135
134136 def caveats
0 commit comments