Skip to content

Commit

Permalink
shiboken2: update formula to include py module .pth file
Browse files Browse the repository at this point in the history
  • Loading branch information
ipatch committed Dec 7, 2023
1 parent 9c3db46 commit 4ce48a7
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions Formula/shiboken2@5.15.11.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Shiboken2AT51511 < Formula
desc "GeneratorRunner plugin that outputs C++ code for CPython extensions"
homepage "https://code.qt.io/cgit/pyside/pyside-setup.git/tree/README.shiboken2-generator.md?h=5.15.2"
license all_of: ["GFDL-1.3-only", "GPL-2.0-only", "GPL-3.0-only", "LGPL-2.1-only", "LGPL-3.0-only"]
revision 3
revision 4
head "https://github.com/qt/qt5.git", branch: "dev", shallow: false

stable do
Expand All @@ -26,12 +26,18 @@ class Shiboken2AT51511 < Formula
depends_on "llvm"
depends_on "numpy"
depends_on "qt@5"
depends_on "sphinx-doc"

uses_from_macos "libxml2"
uses_from_macos "libxslt"

def python3
"python3.11"
Formula["python@3.11"].opt_bin/"python3"
end

def pythons
deps.map(&:to_formula)
.select { |f| f.name.match?(/^python@3\.\d+$/) }
end

def install

Check failure on line 43 in Formula/shiboken2@5.15.11.rb

View workflow job for this annotation

GitHub Actions / test-bot (macos-13)

`brew install --verbose --build-bottle freecad/freecad/shiboken2@5.15.11` failed on macOS Ventura (13)!

==> Fetching freecad/freecad/shiboken2@5.15.11 ==> Downloading https://download.qt.io/official_releases/QtForPython/shiboken2/PySide2-5.15.11-src/pyside-setup-opensource-src-5.15.11.zip Already downloaded: /Users/runner/Library/Caches/Homebrew/downloads/37d807d5657aec5748ff37811a1c72407c9d6bea7acc1e9f5b1fdd2d0cae6396--pyside-setup-opensource-src-5.15.11.zip ==> Verifying checksum for '37d807d5657aec5748ff37811a1c72407c9d6bea7acc1e9f5b1fdd2d0cae6396--pyside-setup-opensource-src-5.15.11.zip' ==> Installing shiboken2@5.15.11 from freecad/freecad /usr/bin/env PATH=/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/cmake/bin:/usr/local/opt/python@3.11/bin:/usr/local/opt/openssl@3/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/xz/bin:/usr/local/opt/z3/bin:/usr/local/opt/lz4/bin:/usr/local/opt/zstd/bin:/usr/local/opt/llvm/bin:/usr/local/opt/gcc/bin:/usr/local/opt/numpy/bin:/usr/local/opt/libpng/bin:/usr/local/opt/freetype/bin:/usr/local/opt/pcre2/bin:/usr/local/opt/gettext/bin:/usr/local/opt/glib/bin:/usr/local/opt/jpeg-turbo/bin:/usr/local/opt/giflib/bin:/usr/local/opt/libtiff/bin:/usr/local/opt/webp/bin:/usr/local/opt/qt@5/bin:/usr/local/opt/docutils/bin:/usr/local/opt/pygments/bin:/usr/local/opt/python-tabulate/bin:/usr/local/opt/python@3.12/bin:/usr/local/opt/sphinx-doc/bin:/usr/local/opt/python@3.12/libexec/bin:/usr/local/opt/python@3.11/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin unzip -o /Users/runner/Library/Caches/Homebrew/downloads/37d807d5657aec5748ff37811a1c72407c9d6bea7acc1e9f5b1fdd2d0cae6396--pyside-setup-opensource-src-5.15.11.zip -d /private/tmp/d20231207-10886-gzsx00 /usr/bin/env cp -pR /private/tmp/d20231207-10886-gzsx00/pyside-setup-opensource-src-5.15.11/. /private/tmp/shiboken2A5.15.11-20231207-10886-2060ls/pyside-setup-opensource-src-5.15.11 Error: An exception occurred within a child process: NameError: undefined local variable or method `args' for #<Formula shiboken2@5.15.11 (stable) /usr/local/Homebrew/Library/Taps/freecad/homebrew-freecad/Formula/shiboken2@5.15.11.rb>
Expand All @@ -44,19 +50,40 @@ def install

ENV.append_path "CMAKE_PREFIX_PATH", Formula["qt@5"].opt_lib

# "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
if MacOS.version >= :catalina
python_executable = Formula["python@3.11"].opt_bin/"python3"
args << "-DPYTHON_EXECUTABLE=#{python_executable}"
end

system "cmake", "-S", "./sources/shiboken2", "-B", "build",
"-DPYTHON_EXECUTABLE=#{which(python3)}",
"-DFORCE_LIMITED_API=no",
"-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
*args,
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

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

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

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

def caveats
<<-EOS
this formula is keg-only
this formula is keg-only
got a build failure on macos catalina,
see: https://github.com/FreeCAD/homebrew-freecad/pull/449#issuecomment-1846177315
EOS
end

Expand Down

0 comments on commit 4ce48a7

Please sign in to comment.