Skip to content

Commit 56083b9

Browse files
committed
Fix: Modify ENV directly instead of passing hash to system
The error was: TypeError: Parameter 'cmd': Expected type T.any(Pathname, String), got type Hash with value {"CC" => "clang", ...} Homebrew's type-checked system() method doesn't accept a hash as the first argument. Instead, we must modify ENV directly: Changed from: cantera_env = { "CC" => ENV.cc, ... } system cantera_env, venv/"bin/python", ... To: ENV["CC"] = ENV.cc ENV["CXX"] = ENV.cxx ENV["CFLAGS"] = "..." ENV["CXXFLAGS"] = "..." system venv/"bin/python", ... This is the standard Homebrew pattern for setting environment variables before running subprocesses.
1 parent 5564cd6 commit 56083b9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packaging/homebrew/mfc.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,14 @@ def install
3939
system venv/"bin/pip", "install", "cython", "numpy", "ruamel.yaml", "packaging", "scons"
4040

4141
# Configure Cantera build
42-
# Set compiler environment variables for scons (not as command-line args)
43-
cantera_env = {
44-
"CC" => ENV.cc,
45-
"CXX" => ENV.cxx,
46-
"CFLAGS" => "-isysroot#{MacOS.sdk_path}",
47-
"CXXFLAGS" => "-isysroot#{MacOS.sdk_path}",
48-
}
42+
# Set compiler environment variables for scons
43+
ENV["CC"] = ENV.cc
44+
ENV["CXX"] = ENV.cxx
45+
ENV["CFLAGS"] = "-isysroot#{MacOS.sdk_path}"
46+
ENV["CXXFLAGS"] = "-isysroot#{MacOS.sdk_path}"
4947

5048
# Run scons with the venv's Python so it can find installed packages
51-
system cantera_env, venv/"bin/python", "-m", "SCons", "build",
49+
system venv/"bin/python", "-m", "SCons", "build",
5250
"python_package=y",
5351
"f90_interface=n",
5452
"system_sundials=y",
@@ -61,7 +59,7 @@ def install
6159
"-j#{ENV.make_jobs}"
6260

6361
# Install Cantera
64-
system cantera_env, venv/"bin/python", "-m", "SCons", "install"
62+
system venv/"bin/python", "-m", "SCons", "install"
6563

6664
# Install Cantera Python package into venv
6765
cd "build/python" do

0 commit comments

Comments
 (0)