Skip to content

Commit

Permalink
[email protected]_py312.rb:checkin new version of coin3d, bump #1
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatch committed Oct 10, 2024
1 parent 387abbd commit af1b1df
Showing 1 changed file with 151 additions and 0 deletions.
151 changes: 151 additions & 0 deletions Formula/[email protected]_py312.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
class Coin3dAT403Py312 < Formula

Check warning on line 1 in Formula/[email protected]_py312.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

`brew linkage --cached --test --strict freecad/freecad/[email protected]_py312` failed on Linux!

libxi
desc "Open Inventor 2.1 API implementation (Coin) with Python bindings (Pivy)"
homepage "https://coin3d.github.io/"
license all_of: ["BSD-3-Clause", "ISC"]

stable do
url "https://github.com/coin3d/coin/releases/download/v4.0.3/coin-4.0.3-src.tar.gz"
sha256 "66e3f381401f98d789154eb00b2996984da95bc401ee69cc77d2a72ed86dfda8"

# We use the pre-release to support `pyside` and `[email protected]`.
# This matches Arch Linux[^1] and Debian[^2] packages.
#
# [^1]: https://archlinux.org/packages/extra/x86_64/python-pivy/
# [^2]: https://packages.debian.org/trixie/python3-pivy
resource "pivy" do
url "https://github.com/coin3d/pivy/archive/refs/tags/0.6.9.a0.tar.gz"
sha256 "2c2da80ae216fe06394562f4a8fc081179d678f20bf6f8ec412cda470d7eeb91"
end

resource "soqt" do
url "https://github.com/coin3d/soqt/releases/download/v1.6.2/soqt-1.6.2-src.tar.gz"
sha256 "fb483b20015ab827ba46eb090bd7be5bc2f3d0349c2f947c3089af2b7003869c"
end
end

livecheck do
url :stable
strategy :github_latest
end

head do
url "https://github.com/coin3d/coin.git", branch: "master"

resource "pivy" do
url "https://github.com/coin3d/pivy.git", branch: "master"
end

# resource "soqt" do
# url "https://github.com/coin3d/soqt.git", brach: "master"
# end
end

keg_only :versioned_formula

depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "freecad/freecad/[email protected]" => :build
depends_on "python-setuptools" => :build
depends_on "boost"
depends_on "freecad/freecad/[email protected]_py312"
depends_on "[email protected]"
depends_on "qt@5"

on_linux do
depends_on "mesa"
depends_on "mesa-glu"
end

def python3
"python3.12"
end

def install
system "cmake", "-S", ".", "-B", "_build-coin",
"-DCMAKE_CXX_STANDARD=11",
"-DCOIN_BUILD_DOCUMENTATION=ON",
"-DCOIN_BUILD_DOCUMENTATION_MAN=ON",
"-DCMAKE_INSTALL_PREFIX=#{prefix}",
"-L"
system "cmake", "--build", "_build-coin"
system "cmake", "--install", "_build-coin"

resource("pivy").stage do
ENV.append_path "CMAKE_PREFIX_PATH", prefix.to_s
ENV["LDFLAGS"] = "-Wl,-rpath,#{opt_lib}"
system python3, "-m", "pip", "install", *std_pip_args, "."
end

resource("soqt").stage do
system "cmake", "-S", ".", "-B", "_build-soqt",
"-DCMAKE_INSTALL_RPATH=#{rpath}",
"-DSOQT_BUILD_MAC_FRAMEWORK=OFF",
"-DSOQT_BUILD_DOCUMENTATION=OFF",
"-DSOQT_BUILD_TESTS=OFF",
"-DSOQT_USE_QT6:BOOL=OFF",
"-DCMAKE_PREFIX_PATH=#{prefix}",
"-L",
*std_cmake_args(find_framework: "FIRST")
system "cmake", "--build", "_build-soqt"
system "cmake", "--install", "_build-soqt"
end
end

def post_install
# explicitly set python version
python_version = "3.12"

# Unlink the existing .pth file to avoid reinstall issues
pth_file = lib/"python#{python_version}/coin3d_py312-pivy.pth"
pth_file.unlink if pth_file.exist?

ohai "Creating .pth file for pivy module"
# write the .pth file to the site-packages directory
(lib/"python#{python_version}/coin3d_py312-pivy.pth").write <<~EOS
import site; site.addsitedir('#{lib}/python#{python_version}/site-packages/')
EOS
end

def caveats
<<~EOS
this formula is keg-only, and intended to aid in the building of freecad
this formula should NOT be linked using `brew link` or else errors will
arise when opening the #{python3} repl
the test in this formula will fail if a screen (GUI) can not be accessed
EOS
end

test do

Check failure on line 118 in Formula/[email protected]_py312.rb

View workflow job for this annotation

GitHub Actions / test-bot (ubuntu-22.04)

`brew test --verbose freecad/freecad/[email protected]_py312` failed on Linux!

==> /usr/bin/gcc-11 test.cpp -L/home/linuxbrew/.linuxbrew/Cellar/[email protected]_py312/4.0.3/lib -lCoin -L/home/linuxbrew/.linuxbrew/opt/mesa/lib -lGL -o test -I/home/linuxbrew/.linuxbrew/opt/[email protected]_py312/include ==> ./test ==> /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.12 -c import shiboken2 from pivy.sogui import SoGui assert SoGui.init("test") is not None SoGui proxy error: None of the known Gui bindings were found! Please specify one! Error: freecad/freecad/[email protected]_py312: failed ::error::freecad/freecad/[email protected]_py312: failed An exception occurred within a child process: BuildError: Failed executing: /home/linuxbrew/.linuxbrew/opt/[email protected]/bin/python3.12 -c import\ shiboken2 from\ pivy.sogui\ import\ SoGui assert\ SoGui.init("test")\ is\ not\ None /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3078:in `block in system' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3014:in `open' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3014:in `system' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `bind_call' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `validate_call_skip_block_type' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:109:in `block in create_validator_slow_skip_block_type' /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/freecad/homebrew-freecad/Formula/[email protected]_py312.rb:150:in `block in <class:Coin3dAT403Py312>' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2813:in `block (3 levels) in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/extend/kernel.rb:536:in `with_env' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2812:in `block (2 levels) in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:1199:in `with_logging' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2811:in `block in run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `block in run' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `chdir' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/mktemp.rb:75:in `run' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:3129:in `mktemp' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/formula.rb:2805:in `run_test' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:48:in `block in <main>' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:195:in `timeout' /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb:52:in `<main>'

Check failure on line 118 in Formula/[email protected]_py312.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-14)

`brew test --verbose freecad/freecad/[email protected]_py312` failed on macOS Sonoma (14) on Apple Silicon!

==> /usr/bin/clang test.cpp -L/opt/homebrew/Cellar/[email protected]_py312/4.0.3/lib -lCoin -Wl,-framework,OpenGL -o test -I/opt/homebrew/opt/[email protected]_py312/include ==> ./test ==> /opt/homebrew/opt/[email protected]/bin/python3.12 -c import shiboken2 from pivy.sogui import SoGui assert SoGui.init("test") is not None SoGui proxy error: None of the known Gui bindings were found! Please specify one! Error: freecad/freecad/[email protected]_py312: failed ::error::freecad/freecad/[email protected]_py312: failed An exception occurred within a child process: BuildError: Failed executing: /opt/homebrew/opt/[email protected]/bin/python3.12 -c import\ shiboken2 from\ pivy.sogui\ import\ SoGui assert\ SoGui.init("test")\ is\ not\ None /opt/homebrew/Library/Homebrew/formula.rb:3078:in `block in system' /opt/homebrew/Library/Homebrew/formula.rb:3014:in `open' /opt/homebrew/Library/Homebrew/formula.rb:3014:in `system' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `bind_call' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `validate_call_skip_block_type' /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:109:in `block in create_validator_slow_skip_block_type' /opt/homebrew/Library/Taps/freecad/homebrew-freecad/Formula/[email protected]_py312.rb:150:in `block in <class:Coin3dAT403Py312>' /opt/homebrew/Library/Homebrew/formula.rb:2813:in `block (3 levels) in run_test' /opt/homebrew/Library/Homebrew/extend/kernel.rb:536:in `with_env' /opt/homebrew/Library/Homebrew/formula.rb:2812:in `block (2 levels) in run_test' /opt/homebrew/Library/Homebrew/formula.rb:1199:in `with_logging' /opt/homebrew/Library/Homebrew/formula.rb:2811:in `block in run_test' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `block in run' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `chdir' /opt/homebrew/Library/Homebrew/mktemp.rb:75:in `run' /opt/homebrew/Library/Homebrew/formula.rb:3129:in `mktemp' /opt/homebrew/Library/Homebrew/formula.rb:2805:in `run_test' /opt/homebrew/Library/Homebrew/test.rb:48:in `block in <main>' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout' /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:195:in `timeout' /opt/homebrew/Library/Homebrew/test.rb:52:in `<main>'

Check failure on line 118 in Formula/[email protected]_py312.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-13)

`brew test --verbose freecad/freecad/[email protected]_py312` failed on macOS Ventura (13)!

==> /usr/bin/clang test.cpp -L/usr/local/Cellar/[email protected]_py312/4.0.3/lib -lCoin -Wl,-framework,OpenGL -o test -I/usr/local/opt/[email protected]_py312/include ==> ./test ==> /usr/local/opt/[email protected]/bin/python3.12 -c import shiboken2 from pivy.sogui import SoGui assert SoGui.init("test") is not None SoGui proxy error: None of the known Gui bindings were found! Please specify one! Error: freecad/freecad/[email protected]_py312: failed ::error::freecad/freecad/[email protected]_py312: failed An exception occurred within a child process: BuildError: Failed executing: /usr/local/opt/[email protected]/bin/python3.12 -c import\ shiboken2 from\ pivy.sogui\ import\ SoGui assert\ SoGui.init("test")\ is\ not\ None /usr/local/Homebrew/Library/Homebrew/formula.rb:3078:in `block in system' /usr/local/Homebrew/Library/Homebrew/formula.rb:3014:in `open' /usr/local/Homebrew/Library/Homebrew/formula.rb:3014:in `system' /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `bind_call' /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:167:in `validate_call_skip_block_type' /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/3.3.0/gems/sorbet-runtime-0.5.11600/lib/types/private/methods/call_validation.rb:109:in `block in create_validator_slow_skip_block_type' /usr/local/Homebrew/Library/Taps/freecad/homebrew-freecad/Formula/[email protected]_py312.rb:150:in `block in <class:Coin3dAT403Py312>' /usr/local/Homebrew/Library/Homebrew/formula.rb:2813:in `block (3 levels) in run_test' /usr/local/Homebrew/Library/Homebrew/extend/kernel.rb:536:in `with_env' /usr/local/Homebrew/Library/Homebrew/formula.rb:2812:in `block (2 levels) in run_test' /usr/local/Homebrew/Library/Homebrew/formula.rb:1199:in `with_logging' /usr/local/Homebrew/Library/Homebrew/formula.rb:2811:in `block in run_test' /usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `block in run' /usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `chdir' /usr/local/Homebrew/Library/Homebrew/mktemp.rb:75:in `run' /usr/local/Homebrew/Library/Homebrew/formula.rb:3129:in `mktemp' /usr/local/Homebrew/Library/Homebrew/formula.rb:2805:in `run_test' /usr/local/Homebrew/Library/Homebrew/test.rb:48:in `block in <main>' /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout' /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout' /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/lib/ruby/3.3.0/timeout.rb:195:in `timeout' /usr/local/Homebrew/Library/Homebrew/test.rb:52:in `<main>'
# NOTE: required because formula is keg_only
coin3d_py312_include = Formula["[email protected]_py312"].opt_include

(testpath/"test.cpp").write <<~EOS
#include <Inventor/SoDB.h>
int main() {
SoDB::init();
SoDB::cleanup();
return 0;
}
EOS

opengl_flags = if OS.mac?
["-Wl,-framework,OpenGL"]
else
["-L#{Formula["mesa"].opt_lib}", "-lGL"]
end

system ENV.cc, "test.cpp", "-L#{lib}", "-lCoin", *opengl_flags, "-o", "test", "-I#{coin3d_py312_include}"
system "./test"

ENV.append_path "PYTHONPATH", Formula["[email protected]_py312"].opt_prefix/Language::Python.site_packages(python3)
ENV.append_path "PYTHONPATH", Formula["[email protected]_py312"].opt_prefix/Language::Python.site_packages(python3)
# Set QT_QPA_PLATFORM to minimal to avoid error:
# "This application failed to start because no Qt platform plugin could be initialized."
ENV["QT_QPA_PLATFORM"] = "minimal" if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"]
system Formula["[email protected]"].opt_bin/"python3.12", "-c", <<~EOS
import shiboken2
from pivy.sogui import SoGui
assert SoGui.init("test") is not None
EOS
end
end

0 comments on commit af1b1df

Please sign in to comment.