[Patch] Correct relative-path issue in PyQt-builder that can lead to build failures
FeRD
ferdnyc at gmail.com
Mon Aug 3 12:02:39 BST 2020
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:
1. Are running in a virtualenv, or otherwise choose to invoke sip-wheel
via a relative path instead of relying on $PATH
2. Are using a non-PEP 517 build system like sip-wheel
3. Also give sip-wheel a *build directory* argument, so that the build
Makefile is written at a *different* location relative to where
bin/sip-wheel is located in the venv
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, *waaaaay* at the end of a very long build, the process will suddenly
error out when it fails to execute sip-distinfo.
In concrete terms:
$ cd /tmp
$ python3 -m venv .
$ . ./bin/activate
$ ./bin/pip3 install PyQt-builder sip setuptools dbus-python
$ tar xf PyQt5-5.15.0.tar.xz
$ cd PyQt5-5.15.0
$ ../bin/sip-wheel --qmake /path/to/5.15.0/gcc_64/bin/qmake --build-dir
build/
Will leave you with a /tmp/PyQt5-5.15.0/build/Makefile containing:
install_distinfo: install_subtargets install_uic install_init FORCE
@test -d $(INSTALL_ROOT)/tmp/PyQt5-5.15.0/build/wheel || mkdir -p
$(INSTALL_ROOT)/tmp/PyQt5-5.15.0/build/wheel
*../bin/sip-distinfo* --inventory
/tmp/PyQt5-5.15.0/build/inventory.txt
--project-root /tmp/PyQt5-5.15.0 --prefix "$(INSTALL_ROOT)" --generator
sip-wheel
--wheel-tag cp35.cp36.cp37.cp38-abi3-linux_x86_64 --console-script
pylupdate5=PyQt5.pylupdate_main:main --console-script
pyrcc5=PyQt5.pyrcc_main:main
--console-script pyuic5=PyQt5.uic.pyuic:main --requires-dist "PyQt5-sip
(>=12.8, <13)"
/tmp/PyQt5-5.15.0/build/wheel/PyQt5-5.15.0.dist-info
...Which will ultimately fail, because sip-distinfo is located at
../../bin/sip-distinfo, relative to the build directory.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200803/6abd3bda/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-builder-Use-absolute-paths-in-Makefile.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200803/6abd3bda/attachment.bin>
More information about the PyQt
mailing list