[CRIU] [PATCH 2/5] Makefiles: auto-detect python version - prefer python2

Dmitry Safonov 0x7f454c46 at gmail.com
Mon May 14 17:55:59 MSK 2018


2018-05-14 14:40 GMT+01:00 Mike Rapoport <rppt at linux.vnet.ibm.com>:
> On Mon, May 14, 2018 at 01:07:08PM +0000, Adrian Reber wrote:
>> From: Adrian Reber <areber at redhat.com>
>>
>> This prepares CRIT for python2/python3 compatibility by auto-detecting
>> the installed python version. python2 is detected first and then the
>> variable CRIU_PYTHON is set.
>>
>> Signed-off-by: Adrian Reber <areber at redhat.com>
>> ---
>>  Makefile.config        | 9 +++++++++
>>  lib/Makefile           | 3 +--
>>  lib/py/images/Makefile | 4 ++--
>>  3 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git a/Makefile.config b/Makefile.config
>> index 0e55780..cb0fd77 100644
>> --- a/Makefile.config
>> +++ b/Makefile.config
>> @@ -12,6 +12,15 @@ ifeq ($(call pkg-config-check,libselinux),y)
>>          FEATURE_DEFINES      += -DCONFIG_HAS_SELINUX
>>  endif
>>
>> +ifndef CRIU_PYTHON
>> +     CRIU_PYTHON := $(shell python2 -V 2>/dev/null || echo python3)
>
> Maybe
>         CRIU_PYTHON := $(shell which python2 || which python3)

Hmm, can we define it as just $(PYTHON) and in scripts/nmk/scripts/tools.mk
near other tools definitions?
It's already weakly defined there, but not used anywhere, so we can just
fix definition to python2/python3.

Thanks,
             Dmitry


More information about the CRIU mailing list