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

[email protected]_py312: update test block #603

Closed

Conversation

ipatch
Copy link
Collaborator

@ipatch ipatch commented Oct 27, 2024

brew style freecad/freecad/[NAME_OF_FORMULA_FILE] 

output from running above command should output something similiar to the below

1 file inspected, no offenses detected
  • Have you ensured your commit passed audit checks, ie.
brew audit freecad/freecad/[NAME_OF_FORMULA_FILE] --online --new-formula

Not all PRs require passing these checks ie. adding [no ci] in the commit message will prevent the CI from running but PRs that change formula files generally should run through the CI checks that way new bottles are built and uploaded to the repository thus not having to build all formula from source but rather installing from a bottle (significantly faster 🐰 ... 🐢)

For more information about this template file learn more

@ipatch ipatch self-assigned this Oct 27, 2024
@ipatch
Copy link
Collaborator Author

ipatch commented Oct 27, 2024

it looks like i'll need to update the PYTHONPATH to include the keg-only installation for the tap specific install of pyside for test block,

==> FAILED
Full test freecad/freecad/[email protected]_py312 output
  /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/bin/bundle clean
  ==> Testing freecad/freecad/[email protected]_py312
  ==> python3.12 -c import PySide2
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'PySide2'

i think the test past locally when i was manually testing because i had the fc_bundle formula installed.

@ipatch
Copy link
Collaborator Author

ipatch commented Oct 29, 2024

test do
# NOTE: ipatch, the below resolve to something like, HOMEBREW_PREFIX/Cellar/formula/lib/python/site-packages
ENV.append_path "PYTHONPATH", prefix/Language::Python.site_packages(python3)
puts "--------------------------------------------------------"
puts "PYTHON=#{ENV["PYTHON"]}"
puts "PYTHONPATH=#{ENV["PYTHONPATH"]}"
puts "--------------------------------------------------------"
system python3, "-c", "import PySide2"
system python3, "-c", "import shiboken2"
modules = %w[
Core
Gui
Network
Positioning
Quick
Svg
Widgets
Xml
]
modules << "WebEngineCore" if OS.linux? || (DevelopmentTools.clang_build_version > 1200)
modules.each { |mod| system python3, "-c", "import PySide2.Qt#{mod}" }
pyincludes = shell_output("#{python3}-config --includes").chomp.split
pylib = shell_output("#{python3}-config --ldflags --embed").chomp.split
if OS.linux?
pyver = Language::Python.major_minor_version python3
pylib += %W[
-Wl,-rpath,#{Formula["python@#{pyver}"].opt_lib}
-Wl,-rpath,#{lib}
]
end
(testpath/"test.cpp").write <<~EOS
#include <shiboken.h>
int main()
{
Py_Initialize();
Shiboken::AutoDecRef module(Shiboken::Module::import("shiboken2"));
assert(!module.isNull());
return 0;
}
EOS
shiboken_lib = if OS.mac?
"shiboken2.cpython-312-darwin"
else
"shiboken2.cpython-312-x86_64-linux-gnu"
end
system ENV.cxx, "-std=c++17", "test.cpp",
"-I#{include}/shiboken2",
"-L#{lib}", "-l#{shiboken_lib}",
"-L#{Formula["gettext"].opt_lib}",
*pyincludes, *pylib, "-o", "test"
system "./test"
Language::Python.each_python(build) do |python, _version|
system python, "-c", "from PySide2 import QtCore"
end
end

@ipatch ipatch closed this Oct 29, 2024
@ipatch ipatch deleted the [email protected]_py312-updates branch October 29, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant