kumquat-buildroot/package/python
Thomas Petazzoni 4b6e8f010a package/pkg-python: fix for per-package directories
With per-package directory support, Python external modules are
causing a problem: the _sysconfigdata.py module installed by the
Python interpreter contains a number of paths that are relative to the
current package per-package directory, i.e python or python3. For
example:

'BLDSHARED': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-gcc -shared',
'CC': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-gcc',
'CXX': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-g++',
etc.

These paths are problematic, because it means that the wrong compiler
gets used when building external Python modules: instead of using the
compiler from the external Python module per-package host directory,
it uses the one from the 'python' or 'python3' per-package host
directory. Due to this, any native dependency needed by the external
Python module is not found, even though it is properly present in the
current package per-package directory.

Of course, the problem occurs with both target Python modules and host
Python modules.

To fix this, we simply rewrite those paths in _sysconfigdata.py before
building a Python package.

Interestingly, until now, the _sysconfidata.py that was used during
the build was the one from $(TARGET_DIR), which is a bit unusual: it
is more common to use files from $(STAGING_DIR) during the build
process. So this commit changes the PYTHON_PATH and PYTHON3_PATH
variables so that they point to $(STAGING_DIR), which makes the
_sysconfigdata.py fixup in $(STAGING_DIR) effective.

Fixes:

  http://autobuild.buildroot.net/results/a24b0555fd4261b50dc3986635c30717d9cbe764/ (python-psycopg2)
  http://autobuild.buildroot.net/results/080fa893e1b0e7a8c8a31ac1c98eb8871b97264d/ (python-alsaaudio)
  http://autobuild.buildroot.net/results/79bc070f98d6d9d8ef78df12b248cdc7d0e405c3/ (python-lxml)
  and many more Python packages that use native code with a native library

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-18 23:16:15 +01:00
..
0001-setup.py-do-not-add-invalid-header-locations.patch
0002-Fix-get_python_inc-for-cross-compilation.patch
0003-Change-the-install-location-of-_sysconfigdata.py.patch
0004-Make-the-compilation-of-.pyc-and-.pyo-conditional.patch
0005-Adjust-getaddrinfo-test-for-cross-compilation.patch
0006-Add-minimal-infrastructure-to-be-able-to-disable-ext.patch
0007-Adjust-library-header-paths-for-cross-compilation.patch
0008-Don-t-look-in-usr-lib-termcap-for-libraries.patch
0009-Fix-python-config-for-cross-builds.patch
0010-Remove-the-python-symlink-install-rules.patch
0011-Don-t-add-multiarch-paths.patch
0012-Abort-on-failed-module-build.patch
0013-sqlite3-fix-build-when-threads-are-not-used-availabl.patch
0014-Serial-ioctl-workaround.patch
0015-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch
0016-Add-an-option-to-disable-installation-of-test-module.patch
0017-Add-an-option-to-disable-pydoc.patch
0018-Add-an-option-to-disable-lib2to3.patch
0019-Add-option-to-disable-the-sqlite3-module.patch
0020-Add-an-option-to-disable-the-tk-module.patch
0021-Add-an-option-to-disable-the-curses-module.patch
0022-Add-an-option-to-disable-expat.patch
0023-Add-an-option-to-disable-CJK-codecs.patch
0024-Add-an-option-to-disable-NIS.patch
0025-Add-an-option-to-disable-unicodedata.patch
0026-Add-an-option-to-disable-bsddb.patch
0027-Add-an-option-to-disable-the-ssl-module.patch
0028-Add-an-option-to-disable-the-bz2-module.patch
0029-Add-an-option-to-disable-the-zlib-module.patch
0030-Do-not-install-the-idle-editor.patch
0031-Add-an-option-to-disable-the-ossaudiodev-module.patch
0032-Add-option-to-disable-the-hashlib-module.patch
0033-Add-an-option-to-disable-readline-module.patch
0034-Override-system-locale-and-set-to-default-when-addin.patch
Config.in
Config.in.host
python.hash
python.mk