Skip to content

Commit 7907e2b

Browse files
authored
Merge branch 'master' into 5EqnPC
2 parents a16e1c3 + 49d4ae9 commit 7907e2b

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

.github/Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,23 @@ ARG COMPILER_PATH
99
ARG COMPILER_LD_LIBRARY_PATH
1010

1111
RUN apt-get update -y && \
12+
apt-get install -y software-properties-common ca-certificates gnupg && \
13+
add-apt-repository ppa:deadsnakes/ppa && \
14+
apt-get update -y && \
1215
if [ "$TARGET" != "gpu" ]; then \
1316
apt-get install -y \
14-
build-essential git make cmake gcc g++ gfortran bc\
15-
python3 python3-venv python3-pip \
17+
build-essential git make cmake gcc g++ gfortran bc \
18+
python3.11 python3.11-venv python3-pip \
1619
openmpi-bin libopenmpi-dev libfftw3-dev \
1720
mpich libmpich-dev; \
1821
else \
1922
apt-get install -y \
20-
build-essential git make cmake bc\
21-
python3 python3-venv python3-pip \
23+
build-essential git make cmake bc \
24+
python3.11 python3.11-venv python3-pip \
2225
libfftw3-dev \
2326
openmpi-bin libopenmpi-dev; \
2427
fi && \
28+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 && \
2529
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2630

2731
ENV OMPI_ALLOW_RUN_AS_ROOT=1

packaging/homebrew/mfc.rb

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,43 @@ 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-
system venv/"bin/pip", "install", "--upgrade", "pip", "setuptools", "wheel"
32+
system venv/"bin/pip", "install", "--upgrade", "pip", "setuptools", "wheel", "setuptools-scm"
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"
36+
# Match the version constraint from toolchain/pyproject.toml
37+
system venv/"bin/pip", "install", "--only-binary=:all:", "cantera>=3.1.0"
3738

3839
# Install MFC Python package and dependencies into venv
3940
# Use editable install (-e) to avoid RECORD file issues when venv is symlinked at runtime
4041
# Dependencies will use pre-built wheels from PyPI
4142
# Keep toolchain in buildpath for now - mfc.sh needs it there
42-
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+
"SETUPTOOLS_SCM_PRETEND_VERSION" => version.to_s, # Fallback for hatch-vcs/setuptools-scm
51+
}
52+
saved_env = {}
53+
pretend_env.each do |k, v|
54+
saved_env[k] = ENV.fetch(k, nil)
55+
ENV[k] = v
56+
end
57+
58+
begin
59+
system venv/"bin/pip", "install", "-e", buildpath/"toolchain"
60+
ensure
61+
pretend_env.each_key do |k|
62+
if saved_env[k].nil?
63+
ENV.delete(k)
64+
else
65+
ENV[k] = saved_env[k]
66+
end
67+
end
68+
end
4369

4470
# Create symlink so mfc.sh uses our pre-installed venv
4571
mkdir_p "build"

0 commit comments

Comments
 (0)