mfc.sh: add --prebuilt-prefix for running against prebuilt binaries#1444
Merged
Merged
Conversation
Lets 'mfc.sh run' and 'mfc.sh test' use an externally-installed MFC
(e.g. a Spack install prefix) instead of rebuilding from source.
Also settable via the MFC_PREBUILT_PREFIX environment variable, so
package managers can flip the mode in setup_run_environment.
When set:
- is_buildable() returns False (implies --no-build) for all targets
- get_install_binpath() resolves to <prefix>/bin/<target> instead of
<root>/build/install/<slug>/bin/<target>
- toolchain/bootstrap/python.sh skips venv creation; the caller is
responsible for putting python3 + toolchain deps + the mfc package
on PYTHONPATH
Zero behavior change when the env var is unset and the flag is absent.
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1444 +/- ##
=======================================
Coverage 61.31% 61.31%
=======================================
Files 72 72
Lines 19771 19771
Branches 2852 2852
=======================================
Hits 12123 12123
Misses 5699 5699
Partials 1949 1949 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sbryngelson
added a commit
to sbryngelson/spack-packages
that referenced
this pull request
May 17, 2026
mfc.sh's build path creates a Python venv (toolchain/bootstrap/python.sh calls `python3 -m venv build/venv` and pip-installs the toolchain into it). On most Linux distros the venv module ships with python's stdlib, but spack's python-venv package makes the dependency explicit so the build cannot fail on systems where venv support is split off. Run-time does not need this dep because spack's setup_run_environment sets MFC_PREBUILT_PREFIX, which makes mfc.sh skip venv setup entirely (MFlowCode/MFC#1444).
sbryngelson
added a commit
that referenced
this pull request
May 18, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds support for running
mfc.sh runandmfc.sh testagainst an externally-installed MFC (e.g. a Spack install prefix) instead of rebuilding from source.Motivation
A separate Spack package for MFC is being prepared. Without first-class support in MFC for "use my prebuilt binaries from /bin", the Spack recipe has to ship a ~100-line shell wrapper that fakes an MFC working tree via cache-dir symlinks and aspirational env vars (
MFC_PREBUILT_BIN_DIRand friends) that no MFC code actually reads. Reviewers on the Spack side will (rightly) push back on that. This change moves the "find installed binaries + skip the build steps" logic where it belongs: inside MFC.Changes
--prebuilt-prefix=<PATH>onmfc.sh runandmfc.sh test. Also settable viaMFC_PREBUILT_PREFIXenvironment variable (CLI wins).Target.is_buildable()returns False for every target (implies--no-build).Target.get_install_binpath()resolves to<prefix>/bin/<target>instead of<cwd>/build/install/<slug>/bin/<target>.toolchain/bootstrap/python.shskips venv creation; caller is responsible for puttingpython3+ toolchain deps + themfcpackage onPYTHONPATH.mfc.sh's trailingdeactivatecall is now guarded (no-op when there's no venv to deactivate).Testing
Local:
./mfc.sh format -j 8clean./mfc.sh precheck -j 86/6 pass (formatting, spelling, toolchain lint, source lint, doc refs, parameter docs)--prebuilt-prefixshows in bothrun --helpandtest --helpget_prebuilt_prefix()precedence verified: CLI > env > None, empty-string CLI falls back to envMFC_PREBUILT_PREFIX=/tmp/fake ./mfc.sh run --helpruns cleanly, skips venvEnd-to-end MFC build + test verification is what this PR's CI will cover (local build blocked by an unrelated apple-clang 21 + ncurses toolchain issue).
Follow-up
After this merges, the planned spack-packages PR for
mfccollapses from ~360 lines (with embedded shell wrapper) to ~120 lines and just setsMFC_PREBUILT_PREFIX=<prefix>insetup_run_environment.