Message281993
| Author |
xdegaye |
| Recipients |
Alex.Willmer, doko, dstufft, eric.araujo, martin.panter, vstinner, xdegaye, zach.ware |
| Date |
2016年11月29日.14:51:39 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1480431100.4.0.611325572748.issue28833@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
With this patch, cross compiling a third-party extension module is done with the command:
XBUILD_PYTHON_DIR=/path/to/python/dir python setup.py build
where XBUILD_PYTHON_DIR is the location of the directory of the cross-compiled python executable.
It may be:
a) The build tree, which is the source tree when the cross compilation is not out of the source tree.
b) '$DESTDIR/$exec_prefix/bin' when the cross built python has been installed with 'make DESTDIR=/some/path install'. In that case 'prefix' and 'exec_prefix' may be different.
c) When the result of the cross compilation has been manually copied (for example to /some/path) and if 'prefix' and 'exec_prefix' are identical, this is /some/path/bin.
In case b), one can use the 'install' setup.py command instead of the 'build' command, to build and install the extension module to '$DESTDIR/$exec_prefix/lib/python$VERSION/site-packages' with the appropriate 'egg-info' file.
The patch uses the 'python-config' shell script (created at issue 16235 [1]) that is initialized with the proper variables at the configure stage to provide the minimum information required by the sysconfig module to create (with the option --generate-posix-vars) the sysconfigdata file or to import the sysconfigdata module.
The patch also fixes issue 22724 [2] as sys.path is only modified during the time needed to import the sysconfigdata module.
The patch fixes two minor problems:
* '_PYTHON_HOST_PLATFORM' in Makefile.pre.in was not added to the sysconfig variables as intended, since those variables may not be prefixed with an underscore.
* The sysconfigdata file name was terminated with a dangling underscore when 'multiarch' is not defined.
Patch also tested with pyephem on an Android emulator.
The patch misses the documentation.
Please run autoconf after installing the patch.
[1] issue 16235: add python-config.sh for use during cross compilation
http://bugs.python.org/issue16235
[2] issue 22724: byte-compile fails for cross-builds
http://bugs.python.org/issue22724 |
|