Skip to content

Commit

Permalink
fc_bundle_py312: update formula to include missing python modules for…
Browse files Browse the repository at this point in the history
… unit testing

Closes #668.

Signed-off-by: Chris <[email protected]>
  • Loading branch information
ipatch committed Jan 7, 2025
1 parent c879aca commit d07f4cc
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Formula/fc_bundle_py312.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,40 @@ class FcBundlePy312 < Formula
sha256 cellar: :any_skip_relocation, x86_64_linux: "fa916c83def42476422e0e917e3b031e3da16c5bc5177f22d80572ea13eb3a03"
end

depends_on "patchelf" => :build
depends_on "pkgconf" => :build
# epends_on "brotli" if OS.linux?
depends_on "freecad/freecad/[email protected]_py312"
depends_on "freecad/freecad/[email protected]_py312"
depends_on "freecad/freecad/[email protected]_py312"
depends_on "freecad/freecad/pybind11_py312"
depends_on "freecad/freecad/[email protected]_py312" # pyside includes the shiboken2 module as well
depends_on "freetype"
# epends_on "libxau" if OS.linux?
depends_on "libyaml" # reqd by pyyaml
depends_on "webp" if OS.linux?
# epends_on "pillow" if OS.linux?

resource "six" do
url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz"
sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"
end

resource "matplotlib" do
url "https://files.pythonhosted.org/packages/68/dd/fa2e1a45fce2d09f4aea3cee169760e672c8262325aa5796c49d543dc7e6/matplotlib-3.10.0.tar.gz"
sha256 "b886d02a581b96704c9d1ffe55709e49b4d2d52709ccebc4be42db856e511278"
end

resource "ply" do
url "https://files.pythonhosted.org/packages/e5/69/882ee5c9d017149285cab114ebeab373308ef0f874fcdac9beb90e0ac4da/ply-3.11.tar.gz"
sha256 "00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3"
end

resource "pyyaml" do
url "https://files.pythonhosted.org/packages/54/ed/79a089b6be93607fa5cdaedf301d7dfb23af5f25c398d5ead2525b063e17/pyyaml-6.0.2.tar.gz"
sha256 "d584d9ec91ad65861cc08d42e834324ef890a082e591037abe114850ff7bbc3e"
end

def install
# explicitly set python version
pyver = "3.12"
Expand All @@ -45,6 +68,36 @@ def install
system venv_pip, "install", "."
end

resource("matplotlib").stage do
(buildpath/"mplsetup.cfg").write <<~EOS
[libs]
system_freetype = true
EOS

# Set MPLSETUPCFG to point to the custom config
ENV["MPLSETUPCFG"] = buildpath/"mplsetup.cfg"
ENV.prepend_path "PKG_CONFIG_PATH", Formula["freetype"].opt_lib/"pkgconfig"
ENV.prepend_path "PKG_CONFIG_PATH", Formula["webp"].opt_lib/"pkgconfig"

# Install matplotlib within the virtual environment
system venv_pip, "install", "."

lib_path = "#{libexec}/vendor/lib/python3.12/site-packages/pillow.libs"
if Dir.exist?(lib_path)
Dir["#{lib_path}/*.so.*"].each do |so|
system "patchelf", "--set-rpath", lib_path, so
end
end
end

resource("ply").stage do
system venv_pip, "install", "."
end

resource("pyyaml").stage do
system venv_pip, "install", "."
end

# Example: Read the contents of the .pth file into a variable
# shiboken2_pth_contents = \
# File.read("#{Formula["[email protected]"].opt_prefix}/lib/python#{pyver}/site-packages/shiboken2.pth").strip
Expand Down

0 comments on commit d07f4cc

Please sign in to comment.