@@ -77,26 +77,26 @@ def install
7777 wrapper_script = buildpath /"mfc_wrapper"
7878 wrapper_script . write <<~EOS
7979 #!/bin/bash
80- set -e
80+ set -euo pipefail
8181
8282 # Unset VIRTUAL_ENV to ensure mfc.sh uses the copied venv, not the Cellar one
83- unset VIRTUAL_ENV
83+ unset VIRTUAL_ENV || true
8484
8585 # Create a temporary working directory (Cellar is read-only)
86- TMPDIR=$(mktemp -d)
87- trap " rm -rf $ TMPDIR" EXIT
86+ TMPDIR=" $(mktemp -d)"
87+ trap ' rm -rf "${ TMPDIR}"' EXIT
8888
8989 # Copy mfc.sh to temp dir (it may try to write build artifacts)
90- cp "#{ libexec } /mfc.sh" "$TMPDIR/"
91- cd "$TMPDIR"
90+ cp "#{ libexec } /mfc.sh" "${ TMPDIR} /"
91+ cd "${ TMPDIR} "
9292
9393 # Copy toolchain directory (not symlink) so Python paths resolve correctly
9494 # This prevents paths from resolving back to read-only Cellar
95- cp -R "#{ prefix } /toolchain" toolchain
95+ cp -R "#{ prefix } /toolchain" " toolchain"
9696
9797 # Patch toolchain to use Homebrew-installed binaries
9898 # Replace get_install_binpath to return Homebrew bin directory
99- cat >> toolchain/mfc/build.py << 'PATCH_EOF'
99+ cat >> " toolchain/mfc/build.py" << 'PATCH_EOF'
100100
101101 # Homebrew patch: Override get_install_binpath to use pre-installed binaries
102102 _original_get_install_binpath = MFCTarget.get_install_binpath
@@ -114,18 +114,18 @@ def _homebrew_is_buildable(self):
114114 PATCH_EOF
115115
116116 # Copy examples directory (required by mfc.sh Python code)
117- cp -R "#{ prefix } /examples" examples
117+ cp -R "#{ prefix } /examples" " examples"
118118
119119 # Create build directory and copy venv (not symlink - needs to be writable)
120120 # Use cp -R for a full recursive copy
121- mkdir -p build
122- cp -R "#{ venv } " build/venv
121+ mkdir -p " build"
122+ cp -R "#{ venv } " " build/venv"
123123
124124 # Copy pyproject.toml to build/ so mfc.sh thinks dependencies are already installed
125- cp "#{ prefix } /toolchain/pyproject.toml" build/pyproject.toml
125+ cp "#{ prefix } /toolchain/pyproject.toml" " build/pyproject.toml"
126126
127127 # For 'mfc run', add --no-build flag to skip compilation
128- if [ "$1 " = "run" ]; then
128+ if [ "${1-} " = "run" ]; then
129129 exec ./mfc.sh "$@" --no-build
130130 else
131131 exec ./mfc.sh "$@"
0 commit comments