diff --git a/Formula/fc_bundle.rb b/Formula/fc_bundle.rb index dd0eb91f..92807a6b 100644 --- a/Formula/fc_bundle.rb +++ b/Formula/fc_bundle.rb @@ -22,13 +22,31 @@ class FcBundle < Formula depends_on "freecad/freecad/pyside2@5.15.11_py310" depends_on "freecad/freecad/shiboken2@5.15.11_py310" + resource "six" do + url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz" + sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926" + end + def install # explicitly set python version pyver = "3.10" + venv_dir = libexec/"vendor" + + # Create a virtual environment + system "python3.10", "-m", "venv", venv_dir + venv_pip = venv_dir/"bin/pip" + + # Install the six module using pip in the virtual environment + # certain freecad workbenches require the python six module + resource("six").stage do + system venv_pip, "install", "." + end + # Read the contents of the .pth file into a variable # shiboken2_pth_contents = \ # File.read("#{Formula["shiboken2@5.15.11"].opt_prefix}/lib/python#{pyver}/site-packages/shiboken2.pth").strip + pyside2_pth_contents = File.read("#{Formula["pyside2@5.15.11_py310"].opt_prefix}/lib/python#{pyver}/pyside2.pth").strip @@ -44,6 +62,7 @@ def install #{pyside2_pth_contents} #{coin3d_pivy_pth_contents} #{numpy_pth_contents} + #{venv_dir}/lib/python#{pyver}/site-packages EOS (prefix/site_packages/"freecad-py-modules.pth").write pth_contents end