[PyQt] pyqt-bundle without Qt Network Auth

Phil Thompson phil at riverbankcomputing.com
Sun Feb 16 10:38:15 GMT 2020


On 14/02/2020 19:40, Florian Bruhin wrote:
> Hey,
> 
> Thanks so much for pyqt-bundle - it makes my life a lot easier to be 
> able to
> test new Qt Alpha/Betas without having to recompile PyQt!
> 
> One thing I noticed is that it crashes when the optional Qt Network 
> Auth module
> isn't installed. If I only install Qt and the WebEngine addon (but not 
> Qt
> Network Auth) via the Qt installer, then try to run it, I get:
> 
>     $ pyqt-bundle
> PyQt5-5.14.1-5.14.1-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl
> --qt-dir ~/code/qt/bin/5.15.0/gcc_64/
>     [...]
>     PyQt5/QtNetworkAuth.abi3.so: RPATH=$ORIGIN/Qt/lib
>     PyQt5/QtNetworkAuth.abi3.so: new RPATH: $ORIGIN/Qt/lib
>     pyqt-bundle: An internal error occurred...
>     Traceback (most recent call last):
>       File ".venv/bin/pyqt-bundle", line 10, in <module>
>         sys.exit(main())
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/main.py",
> line 77, in main
>         handle_exception(e)
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/sipbuild/exceptions.py",
> line 81, in handle_exception
>         raise e
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/main.py",
> line 72, in main
>         bundle(wheel_path=args.wheels[0], qt_dir=args.qt_dir,
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/bundle.py",
> line 117, in bundle
>         package.bundle_qt(target_qt_dir, qt_dir, arch)
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/abstract_package.py",
> line 105, in bundle_qt
>         md.bundle(name, target_qt_dir, qt_dir,
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 66, in bundle
>         self._bundle_qt_library(self._name, target_qt_dir, qt_dir, 
> arch,
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 217, in _bundle_qt_library
>         cls._bundle_library(cls._impl_from_library(name, arch, 
> qt_version),
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 209, in _bundle_library
>         cls._bundle_file(name,
>       File
> "/home/florian/tmp/bundle/.venv/lib/python3.8/site-packages/pyqtbuild/bundle/qt_metadata.py",
> line 201, in _bundle_file
>         shutil.copy2(src, dst)
>       File "/usr/lib/python3.8/shutil.py", line 426, in copy2
>         copyfile(src, dst, follow_symlinks=follow_symlinks)
>       File "/usr/lib/python3.8/shutil.py", line 259, in copyfile
>         with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
>     FileNotFoundError: [Errno 2] No such file or directory:
> '/home/florian/code/qt/bin/5.15.0/gcc_64/lib/libQt5NetworkAuth.so.5'
> 
> I'm not sure what should happen in that case, though. I think it should 
> be
> possible for pyqt-bundle to just not bundle that .so (even though PyQt
> originally was compiled against it), and the wheel would work fine in 
> general?
> Then when trying to import QtNetworkAuth I suppose one would just get a
> slightly more cryptic ImportError rather than a ModuleNotFoundError.

Explicit being better than implicit I've added a --exclude option to 
pyqt-bundle (default branch of the repo, untested).

This also means you can create a custom PyQt5 wheel containing only the 
modules you are actually interested in.

Phil


More information about the PyQt mailing list