[Python-Dev] Is distutils.util.get_platform() the "current" or the "target" platform

Xavier de Gaye xdegaye at gmail.com
Tue Feb 19 15:05:36 EST 2019


> [Any reason for dropping python-dev?]

Sorry. just clicked the wrong button.

> And the answer is a resounding "yes, it returns the target platform"? It seems you're saying this, but the wording of your email sounds just enough of a question that I'm not sure whether you are definitively answering it or not.

The answer is yes indeed, it returns the target platform.
This is a listing of the non-obvious steps that lead to this conclusion.

Xavier


On 2/19/19 8:45 PM, Steve Dower wrote:
> [Any reason for dropping python-dev?]
> 
> On 19Feb2019 1139, Xavier de Gaye wrote:
>> Is distutils.util.get_platform() the "current" or the "target" platform ?
> 
> I *think* you're answering this below, yes?
> 
>> * When cross-compiling on posix platforms using autoconf, configure is
>>    run with the '--host=host-type' [1] command line option to specify
>>    the target platform.
>>
>> * The AC_CANONICAL_HOST macro is used by configure.ac to get the
>>    canonical variables `host' and `host_cpu' [2].
>>    Those variables are used to compute _PYTHON_HOST_PLATFORM.
>>
>> * The Makefile generated by configure runs setup.py,
>>    generate-posix-vars, etc... on the build platform using
>>    PYTHON_FOR_BUILD, a native python interpreter that is set
>>    to run with the _PYTHON_HOST_PLATFORM environment variable.
>>
>> * get_platform() in setup.py and in Lib/distutils/util.py returns the
>>    value of _PYTHON_HOST_PLATFORM when cross-compiling.
>>
>> So the process of cross-compilation on posix platforms has
>> get_platform() return the target ('host' in autoconf terminology) platform.
>>
>> [1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Specifying-Target-Triplets.html
>> [2] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Canonicalizing.html
> 
> And the answer is a resounding "yes, it returns the target platform"? It seems you're saying this, but the wording of your email sounds just enough of a question that I'm not sure whether you are definitively answering it or not.
> 
> Cheers,
> Steve



More information about the Python-Dev mailing list