Re: [PATCH 1/1] perf tools: Use Python devtools for version autodetection rather than runtime

From: German Gomez
Date: Tue Apr 12 2022 - 11:45:22 EST



On 12/04/2022 16:30, German Gomez wrote:
> Hi James,
>
> On 09/03/2022 19:43, James Clark wrote:
>> This fixes the issue where the build will fail if only the Python2
>> runtime is installed but the Python3 devtools are installed. Currently
>> the workaround is 'make PYTHON=python3'.
>>
>> Fix it by autodetecting Python based on whether python[x]-config exists
>> rather than just python[x] because both are needed for the build. Then
>> -config is stripped to find the Python runtime.
>>
>> Testing
>> =======
>>
>> * Auto detect links with Python3 when the v3 devtools are installed
>> and only Python 2 runtime is installed
>> * Auto detect links with Python2 when both devtools are installed
>> * Sensible warning is printed if no Python devtools are installed
>> * 'make PYTHON=x' still automatically sets PYTHON_CONFIG=x-config
>> * 'make PYTHON=x' fails if x-config doesn't exist
> If x is a valid python but no x-config is found in the system, the build
> fails, instead of printing a warning like before. If we use this approach
> I think [1] in the Makefile is never hit and needs to be cleaned up.

Sorry, small correction:

The line in the Makefile is never hit when PYTHON is explicitly defined (probably not a big deal).

Still I wanted to point the small change in behaviour with the build warning vs. build fail.