triplus wrote: ↑Sat Mar 16, 2019 1:50 am
No Shiboken2 and PySide2, no fun. In addition i am not all that sure if Qt for Python official wheel is currently useful at all for FreeCAD compiling purposes.
Therefore if you would like to compile FreeCAD yourself, on Gentoo, currently Conda is likely your best bet.
I've actually had some limited success installing these via pip in a virtual environment. I had to hack on freecad a bit in order to recognize/respect the virtual environment (see below), but the Part workbench appears to compile and run just fine using this method.
I was beginning to put together a pull request, but that's when I realized that I needed to manually specify the Shiboken2 and PySide2 installations, thus my original question.
Here is the patch to enable python to recognize virtual environments:
Code: Select all
[diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp
index 927a4e101..5a35ec40d 100644
--- a/src/Base/Interpreter.cpp
+++ b/src/Base/Interpreter.cpp
@@ -492,6 +492,15 @@ const char* InterpreterSingleton::init(int argc,char *argv[])
// https://bugs.python.org/issue17797#msg197474
//
Py_Initialize();
+ PyRun_SimpleString(R"(
+# Check for virtualenv, and activate if present. See https://virtualenv.pypa.io/en/latest/userguide/#using-virtualenv-without-bin-python
+import os
+import sys
+base_path = os.getenv("VIRTUAL_ENV")
+if not base_path is None:
+ activate_this = os.path.join(base_path, "bin", "activate_this.py")
+ exec(open(activate_this).read(), {'__file__':activate_this})
+)");
PyEval_InitThreads();
#if PY_MAJOR_VERSION >= 3
size_t size = argc;
/code]