PyQtBuilder and Python from source on Windows

Patrick Stinson patrickkidd at gmail.com
Wed Oct 7 01:05:27 BST 2020


Phil,

Here is a pyqtbuild workaround that got me moving again. No idea if it is clean enough but demonstrates the problem.

--- a/builder.py
+++ b/builder.py
@@ -386,9 +386,15 @@ macx {
                     'QMAKE_LFLAGS += -Wl,--version-script={}.exp'.format(
                             buildable.target))

-        pro_lines.append(
-                'INCLUDEPATH += {}'.format(
-                        self.qmake_quote(project.py_include_dir)))
+        # pks
+        if ';' in project.py_include_dir:
+            py_include_dir_parts = project.py_include_dir.split(';')
+        else:
+            py_include_dir_parts = [project.py_include_dir]
+        for part in py_include_dir_parts:
+            pro_lines.append(
+                    'INCLUDEPATH += {}'.format(
+                            self.qmake_quote(part)))

         # Python.h on Windows seems to embed the need for pythonXY.lib, so tell
         # it where it is.




> On Oct 4, 2020, at 10:46 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
> 
> Maybe this is because sip is not handling the paths correctly?
> 
> Here is the first failing args to cl.exe. Note the paths returned from distutils.sysconfig.get_python_inc() are correct but sip doesn’t separate them on the ‘;’ token, and then maybe also doesn’t use the correct os.sep?
> 
> cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DPy_LIMITED_API=0x03040000 -DNDEBUG -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -D_WINDLL -I. -I. -I.. -IC:/familydiagram/vendor/sysroot-dev/Python-3.7.8/include;C:/familydiagram/vendor/sysroot-dev/Python-3.7.8/PC -IC:\familydiagram\vendor\sysroot-dev\Qt-5.15.1\mkspecs\win32-msvc -Forelease\ @C:\Users\patrick\AppData\Local\Temp\nm1BE7.tmp
> 
>> On Oct 4, 2020, at 10:43 PM, Patrick Stinson <patrickkidd at gmail.com> wrote:
>> 
>> sip-build for PyQt5 fails to find Python.h with Python [3.7.8] built from source on Windows [10]. I imagine this has to do with how the python source seems to have no notion of an install prefix on Windows and leaves binaries in the build dir.
>> 
>> Is there any way to specify include dirs and probably also lib dirs to sip-build for PyQt5? Python headers are in <PY_SOURCE>\include and <PY_SOURCE>\PC.
>> 
>> -Patrick
> 



More information about the PyQt mailing list