Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fc_bundle_py312: update formula to include missing python modules for unit testing #668

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Formula/fc_bundle_py312.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class FcBundlePy312 < Formula

Check warning on line 1 in Formula/fc_bundle_py312.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

`brew linkage --cached --test --strict freecad/freecad/fc_bundle_py312` failed on Linux!

zlib
desc "Meta formula for bundling needed python modules"
homepage "https://www.freecadweb.org"
# Dummy URL since no source is being downloaded
Expand All @@ -18,17 +18,40 @@
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 @@
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
Loading