<div dir="ltr">Building a PyQt5 wheel on Linux using sip-wheel, with Qt's official `5.15.0` binary distribution and the downloaded PyQt5-5.15.0.tar.xz tarball contents as my build components, I managed to blunder myself into a perfect storm of factors that triggered a relatively obscure bug in the pyqtbuilder/builder.py code. It seems that if you:<div><ol><li>Are running in a virtualenv, or otherwise choose to invoke sip-wheel via a relative path instead of relying on $PATH</li><li>Are using a non-PEP 517 build system like sip-wheel</li><li>Also give sip-wheel a <b>build directory</b> argument, so that the build Makefile is written at a <i>different</i> location relative to where bin/sip-wheel is located in the venv</li></ol><div>Then the install_distinfo target of the Makefile will get written out with a sip-distinfo command that gets prefixed with the same (now incorrect) relative path that you originally used to invoke sip-wheel. Which means that, <i>waaaaay</i> at the end of a very long build, the process will suddenly error out when it fails to execute sip-distinfo.</div></div><div><br></div><div>In concrete terms:</div><div><font face="monospace"><br></font></div><div><font face="monospace">$ cd /tmp</font></div><div><font face="monospace">$ python3 -m venv .</font></div><div><font face="monospace">$ . ./bin/activate</font></div><div><font face="monospace">$ ./bin/pip3 install PyQt-builder sip setuptools dbus-python</font></div><div><font face="monospace">$ tar xf PyQt5-5.15.0.tar.xz</font></div><div><font face="monospace">$ cd PyQt5-5.15.0</font></div><div><font face="monospace">$ ../bin/sip-wheel --qmake /path/to/5.15.0/gcc_64/bin/qmake --build-dir build/</font></div><div><br></div><div>Will leave you with a /tmp/PyQt5-5.15.0/build/Makefile containing:</div><div><br></div><div><font face="monospace">install_distinfo: install_subtargets install_uic install_init FORCE<br>        @test -d $(INSTALL_ROOT)/tmp/PyQt5-5.15.0/build/wheel || mkdir -p </font></div><div><font face="monospace">$(INSTALL_ROOT)/tmp/PyQt5-5.15.0/build/wheel<br>        <b><font color="#ff0000">../bin/sip-distinfo</font></b> --inventory /tmp/PyQt5-5.15.0/build/inventory.txt </font></div><div><font face="monospace">--project-root /tmp/PyQt5-5.15.0 --prefix "$(INSTALL_ROOT)" --generator sip-wheel </font></div><div><font face="monospace">--wheel-tag cp35.cp36.cp37.cp38-abi3-linux_x86_64 --console-script </font></div><div><font face="monospace">pylupdate5=PyQt5.pylupdate_main:main --console-script pyrcc5=PyQt5.pyrcc_main:main </font></div><div><font face="monospace">--console-script pyuic5=PyQt5.uic.pyuic:main --requires-dist "PyQt5-sip (>=12.8, <13)" </font></div><div><font face="monospace">/tmp/PyQt5-5.15.0/build/wheel/PyQt5-5.15.0.dist-info</font><br></div><div><font face="monospace"><br></font></div><div><font face="arial, sans-serif">...Which will ultimately fail, because sip-distinfo is located at ../../bin/sip-distinfo, relative to the build directory.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">The attached patch changes builder.py to first take the os.path.abspath() of os.path.dirname(sys.argv[0]), before prepending it to 'sip-distinfo' and inserting it into the Makefile. This ensures the build is viable from anywhere in the filesystem.</font></div><div><font face="arial, sans-serif"><br></font></div></div>