@@ -33,20 +33,38 @@ def install
3333
3434 # Install Cantera from PyPI using pre-built wheel (complex package, doesn't need custom flags)
3535 # Cantera has CMake compatibility issues when building from source with newer CMake versions
36- system venv /"bin/pip" , "install" , "cantera==3.1.0"
37-
38- # MFC's toolchain uses VCS-derived versioning (via Hatch/hatch-vcs) and Homebrew builds from
39- # GitHub release tarballs without a .git directory. Provide a fallback/pretend version so
40- # metadata generation succeeds during pip install.
41- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION" ] = version . to_s
42- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MFC" ] = version . to_s
43- ENV [ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mfc" ] = version . to_s
36+ # Match the version constraint from toolchain/pyproject.toml
37+ system venv /"bin/pip" , "install" , "--only-binary=:all:" , "cantera>=3.1.0"
4438
4539 # Install MFC Python package and dependencies into venv
4640 # Use editable install (-e) to avoid RECORD file issues when venv is symlinked at runtime
4741 # Dependencies will use pre-built wheels from PyPI
4842 # Keep toolchain in buildpath for now - mfc.sh needs it there
49- system venv /"bin/pip" , "install" , "-e" , buildpath /"toolchain"
43+ #
44+ # MFC's toolchain uses VCS-derived versioning (via Hatch/hatch-vcs) and Homebrew builds from
45+ # GitHub release tarballs without a .git directory. Scope pretend-version env vars tightly
46+ # to avoid polluting subsequent pip installs.
47+ pretend_env = {
48+ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_MFC" => version . to_s ,
49+ "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_mfc" => version . to_s ,
50+ }
51+ saved_env = { }
52+ pretend_env . each do |k , v |
53+ saved_env [ k ] = ENV [ k ]
54+ ENV [ k ] = v
55+ end
56+
57+ begin
58+ system venv /"bin/pip" , "install" , "-e" , buildpath /"toolchain"
59+ ensure
60+ pretend_env . each_key do |k |
61+ if saved_env [ k ] . nil?
62+ ENV . delete ( k )
63+ else
64+ ENV [ k ] = saved_env [ k ]
65+ end
66+ end
67+ end
5068
5169 # Create symlink so mfc.sh uses our pre-installed venv
5270 mkdir_p "build"
0 commit comments