PyQt5 install fails with parallelized make

Dmitry Shachnev <[email protected]>
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hi Phil!

Currently the top-level Makefile generated by qmake has the following line:

  install:install_subtargets install_init_py install_uic_package install_pylupdate install_pyrcc install_tools install_pep484_stubs install_distinfo  FORCE

With this code, make may attempt to run all dependencies of install target
simultaneously.

However, install_distinfo will fail if it is run before install_subtargets
is complete.

In my case, the Debian build tools ran “make -j4 install” and it failed with
this error. See how QtQml.so is installed just after mk_distinfo.py fails:

  Traceback (most recent call last):
    File "/home/mitya57/pyqt5/mk_distinfo.py", line 112, in <module>
      fn_f = open(fn, 'rb')
  FileNotFoundError: [Errno 2] No such file or directory: '/home/mitya57/pyqt5/debian/tmp/usr/lib/python3.8/dist-packages/PyQt5/QtQml.so'
  make[2]: *** [Makefile:2104: install_distinfo] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[3]: Entering directory '/home/mitya57/pyqt5/build-3.8/QtQml'
  /usr/lib/qt5/bin/qmake -install qinstall /home/mitya57/pyqt5/build-3.8/QtQml/QtQml.so /home/mitya57/pyqt5/debian/tmp/usr/lib/python3.8/dist-packages/PyQt5/QtQml.so
  make[3]: Leaving directory '/home/mitya57/pyqt5/build-3.8/QtQml'

I am attaching a patch that fixes this. Not sure if it is an elegant solution,
but forcing -j1 seemed even less elegant to me.

Or maybe mk_distinfo.py should open files from build directory, not from the
directory they will be installed into?

--
Dmitry Shachnev

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
distinfo_dependencies.diff (text/x-diff, 2.7 KB)
From: Dmitry Shachnev <[email protected]>
Date: Mon, 6 Jan 2020 18:03:23 +0300
Subject: Make the install_distinfo target depend on all other targets

Otherwise when building in parallel, mk_distinfo.py will fail because
some files are not yet installed.
---
 configure.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.py b/configure.py
index cf56cf3..24b5e15 100644
--- a/configure.py
+++ b/configure.py
@@ -1685,6 +1685,7 @@ INSTALLS += init_py
 ''' % (' '.join(subdirs), root_dir))
 
     all_installs.append(root_dir + '/__init__.py')
+    distinfo_dependencies = ['install_subtargets', 'install_init_py']
 
     # Install the uic module.
     out_f.write('''
@@ -1694,6 +1695,7 @@ INSTALLS += uic_package
 ''' % (source_path('pyuic', 'uic'), root_dir))
 
     all_installs.append(root_dir + '/uic')
+    distinfo_dependencies.append('install_uic_package')
 
     # Install the tool main scripts and wrappers.
     if wrappers:
@@ -1709,10 +1711,12 @@ INSTALLS += %s
 ''' % (tool, source_path('sip', tool, tool_main), tool, root_dir, tool))
 
                 all_installs.append(root_dir + '/' + tool_main)
+                distinfo_dependencies.append('install_' + tool)
 
             wrapper_exes.append(wrapper)
             all_installs.append(target_config.pyqt_bin_dir + '/' + wrapper)
 
+        distinfo_dependencies.append('install_tools')
         out_f.write('''
 tools.files = %s
 tools.path = %s
@@ -1739,6 +1743,7 @@ INSTALLS += sip%s
 ))
 
                     all_installs.append(mdir)
+                    distinfo_dependencies.append('install_sip%s' % mname)
 
     # Install the stub files.
     if target_config.py_version >= 0x030500 and target_config.pyqt_stubs_dir:
@@ -1755,6 +1760,7 @@ INSTALLS += pep484_stubs
         all_installs.extend(
                 [target_config.pyqt_stubs_dir + '/' + pyi
                         for pyi in pyi_names])
+        distinfo_dependencies.append('install_pep484_stubs')
 
     # Install the QScintilla .api file.
     if target_config.qsci_api:
@@ -1767,6 +1773,7 @@ INSTALLS += qscintilla_api
 ''' % qmake_quote(api_dir))
 
         all_installs.append(api_dir + '/PyQt5.api')
+        distinfo_dependencies.append('install_qscintilla_api')
 
     if distinfo:
         # The command to run to generate the .dist-info directory.
@@ -1779,8 +1786,9 @@ INSTALLS += qscintilla_api
         out_f.write('''
 distinfo.extra = %s
 distinfo.path = %s
+distinfo.depends = %s
 INSTALLS += distinfo
-''' % (run_mk_distinfo, root_dir))
+''' % (run_mk_distinfo, root_dir, ' '.join(distinfo_dependencies)))
 
         # Create the file containing all installed files.
         installed = open('installed.txt', 'w')
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE5688gqe4PSusUZcLZkYmW1hrg8sFAl4TXvsACgkQZkYmW1hr
g8v+cg/+KAIphjF87HXP+LogJXi1Q/VqvyRM1AKTJmzZenAMXZlj+DQG2w2gWW5a
fRDSyqM3lY8uFZpL/i0VIc3XeUlVJAWWfP/iO/8OwEeDd52P8xeK0s42l/EvBQxZ
VFaC1YfGpLSTWSoO3Fpqf/+uC8Xyc/XZcy2fPOMbD2Hxp/8NvpCWV0ZB+qKyNzSO
Gaemlr2NwDwC77N1Ea2FgQ6V/1QvFssvTzEkNnVN+9S87iBpJYFkgGaNKuqOa6iS
WlySh2iSrLTiJO3MdWUI2fEv9Hn7RbeuCkZa/6DO2wAd/CpJrsSjBTC4MKmfDft0
JXe9dG9Far50EkltpsSVPV/8oERu1hegSlN54dINu9hKBvGFVH3T7xUYBlD4L1Tw
ySGaVHGTVwAqNHAogKuzAAoLjtqGBaa8jQYXojPJWl9Gsku8ROnV8fYYpAG3d0en
/Bcibq/vB3VjuHjy2I9MdR0yBRCDHwagScluFojvKB6HWd+WGyPv8dFhcWVHlpTq
olPQ72Do+OG/AQX2LQ6tFo0O1igq/W7D694VqVFfAywC++lMnM3UYlB4a2wqs2Fk
Bmii759BJ6hlGs3ap3CHLUbrpbD55UZx7os9WdSikxmY9ijiGiwgPe5YbAIc83NW
K81/jWOl493C0r1m4ztYjDCTkhM68by6X+0sSi5ZKP+74ib32UQ=
=n9K7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.