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 35f97e9
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Formula/[email protected]
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["[email protected]"].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/[email protected]

View workflow job for this annotation

GitHub Actions / test-bot (self-hosted-catalinavm)

`brew install --verbose --build-bottle freecad/freecad/[email protected]` failed on macOS Catalina (10.15)!

Warning: You are using macOS 10.15. We (and Apple) do not provide support for this old version. It is expected behaviour that some formulae will fail to build in this old version. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from Homebrew or its maintainers on social media. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it. ==> Fetching freecad/freecad/[email protected] ==> 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/brewer/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 [email protected] from freecad/freecad /usr/bin/env PATH=/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/cmake/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/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/gettext/bin:/usr/local/opt/pcre2/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/gdbm/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/sphinx-doc/bin:/usr/local/opt/[email protected]/libexec/bin:/usr/local/opt/[email protected]/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin unzip -o /Users/brewer/Library/Caches/Homebrew/downloads/37d807d5657aec5748ff37811a1c72407c9d6bea7acc1e9f5b1fdd2d0cae6396--pyside-setup-opensource-src-5.15.11.zip -d /private/tmp/d20231207-15653-ar8sdy /usr/bin/env cp -pR /private/tmp/d20231207-15653-ar8sdy/pyside-setup-opensource-src-5.15.11/. /private/tmp/shiboken2A5.15.11-20231207-15653-gz5uu5/pyside-setup-opensource-src-5.15.11 ==> cmake -S ./sources/shiboken2 -B build -DPYTHON_EXECUTABLE=/usr/local/opt/[email protected]/bin/python3 -DFORCE_LIMITED_API=no -DCMAKE_INSTALL_RPATH=@loader_path/../lib;@loader_path/../../.. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/[email protected]/5.15.11_4 -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -- The C compiler identification is AppleClang 12.0.0.12000032 -- The CXX compiler identification is AppleClang 12.0.0.12000032 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using Qt 5 -- Found PythonInterp: /usr/local/opt/[email protected]/bin/python3 -- Found PythonLibs: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib (found version "3.11.0") -- PYTHON_ARCH: -- CLANG: /usr/local/opt/llvm, /usr/local/opt/llvm/lib/libclang.dylib detected by LLVM_INSTALL_DIR -- Looking for C++ include clang-c/Index.h -- Looking for C++ include clang-c/Index.h - found CMake Erro

Check failure on line 43 in Formula/[email protected]

View workflow job for this annotation

GitHub Actions / test-bot (self-hosted-mojavevm)

`brew install --verbose --build-bottle freecad/freecad/[email protected]` failed on macOS Mojave (10.14)!

Warning: You are using macOS 10.14. We (and Apple) do not provide support for this old version. It is expected behaviour that some formulae will fail to build in this old version. It is expected behaviour that Homebrew will be buggy and slow. Do not create any issues about this on Homebrew's GitHub repositories. Do not create any issues even if you think this message is unrelated. Any opened issues will be immediately closed without response. Do not ask for help from Homebrew or its maintainers on social media. You may ask for help in Homebrew's discussions but are unlikely to receive a response. Try to figure out the problem yourself and submit a fix as a pull request. We will review it but may or may not accept it. ==> Fetching freecad/freecad/[email protected] ==> 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/brewer/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 [email protected] from freecad/freecad /usr/bin/env PATH=/usr/local/Homebrew/Library/Homebrew/shims/mac/super:/usr/local/opt/cmake/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/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/gdbm/bin:/usr/local/opt/[email protected]/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/sphinx-doc/bin:/usr/local/opt/[email protected]/libexec/bin:/usr/local/opt/[email protected]/libexec/bin:/usr/bin:/bin:/usr/sbin:/sbin unzip -o /Users/brewer/Library/Caches/Homebrew/downloads/37d807d5657aec5748ff37811a1c72407c9d6bea7acc1e9f5b1fdd2d0cae6396--pyside-setup-opensource-src-5.15.11.zip -d /private/tmp/d20231207-51058-vvn7i8 /usr/bin/env cp -pR /private/tmp/d20231207-51058-vvn7i8/pyside-setup-opensource-src-5.15.11/. /private/tmp/shiboken2A5.15.11-20231207-51058-itvvty/pyside-setup-opensource-src-5.15.11 ==> cmake -S ./sources/shiboken2 -B build -DPYTHON_EXECUTABLE=/usr/local/opt/[email protected]/bin/python3 -DFORCE_LIMITED_API=no -DCMAKE_INSTALL_RPATH=@loader_path/../lib;@loader_path/../../.. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/[email protected]/5.15.11_4 -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -- The C compiler identification is AppleClang 11.0.0.11000033 -- The CXX compiler identification is AppleClang 11.0.0.11000033 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using Qt 5 -- Found PythonInterp: /usr/local/opt/[email protected]/bin/python3 -- Found PythonLibs: /usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib (found version "3.11.0") -- PYTHON_ARCH: -- CLANG: /usr/local/opt/llvm, /usr/local/opt/llvm/lib/libclang.dylib detected by LLVM_INSTALL_DIR -- Looking for C++ include clang-c/Index.h -- Looking for C++ include clang-c/Index.h - found CMake Erro
Expand All @@ -44,16 +50,30 @@ def install

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

# "-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
system "cmake", "-S", "./sources/shiboken2", "-B", "build",
"-DPYTHON_EXECUTABLE=#{which(python3)}",
"-DPYTHON_EXECUTABLE=#{python3}",
"-DFORCE_LIMITED_API=no",
"-DCMAKE_INSTALL_RPATH=#{rpaths.join(";")}",
*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
Expand Down

0 comments on commit 35f97e9

Please sign in to comment.