@@ -29,11 +29,13 @@ def install
2929 # Create Python virtual environment inside libexec (inside Cellar for proper bottling)
3030 venv = libexec /"venv"
3131 system Formula [ "python@3.12" ] . opt_bin /"python3.12" , "-m" , "venv" , venv
32+
3233 system venv /"bin/pip" , "install" , "--upgrade" ,
3334 "pip" , "setuptools" , "wheel" ,
3435 "setuptools-scm" ,
3536 "hatchling" , "hatch-vcs" ,
3637 "editables"
38+
3739 # Install Cantera from PyPI using pre-built wheel (complex package, doesn't need custom flags)
3840 # Cantera has CMake compatibility issues when building from source with newer CMake versions
3941 # Match the version constraint from toolchain/pyproject.toml
@@ -45,9 +47,8 @@ def install
4547 # Keep toolchain in buildpath for now - mfc.sh needs it there
4648 #
4749 # MFC's toolchain uses VCS-derived versioning (via Hatch/hatch-vcs) and Homebrew builds from
48- # GitHub release tarballs without a .git directory. Use --no-build-isolation so the build
49- # backend can see our environment variables, and set SETUPTOOLS_SCM_PRETEND_VERSION which
50- # hatch-vcs respects when VCS metadata is unavailable.
50+ # GitHub release tarballs without a .git directory. Scope pretend-version env vars tightly
51+ # to avoid polluting subsequent pip installs.
5152 pretend_env = {
5253 "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MFC" => version . to_s ,
5354 "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mfc" => version . to_s ,
@@ -60,7 +61,7 @@ def install
6061 end
6162
6263 begin
63- system venv /"bin/pip" , "install" , "--no-build-isolation" , "- e", buildpath /"toolchain"
64+ system venv /"bin/pip" , "install" , "-e" , buildpath /"toolchain"
6465 ensure
6566 pretend_env . each_key do |k |
6667 if saved_env [ k ] . nil?
@@ -78,12 +79,7 @@ def install
7879 # Now build MFC with pre-configured venv
7980 # Set VIRTUAL_ENV so mfc.sh uses existing venv instead of creating new one
8081 ENV [ "VIRTUAL_ENV" ] = venv
81-
82- # Also set pretend-version env vars for mfc.sh in case it tries to reinstall toolchain
83- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MFC" ] = version . to_s
84- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mfc" ] = version . to_s
85- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION" ] = version . to_s
86-
82+
8783 # Build MFC using pre-configured venv
8884 # Must run from buildpath (MFC root directory) where toolchain/ exists
8985 Dir . chdir ( buildpath ) do
@@ -353,4 +349,4 @@ def caveats
353349 assert_path_exists testpath_case /"silo_hdf5"
354350 assert_predicate testpath_case /"silo_hdf5" , :directory?
355351 end
356- end
352+ end
0 commit comments