[Buildroot] [PATCH v3 3/4] support/testing: switch to Python 3 only

Arnout Vandecappelle arnout at mind.be
Mon Oct 28 21:28:55 UTC 2019



On 27/10/2019 14:37, Nicolas Carrier wrote:
> From: Ricardo Martincoski <ricardo.martincoski at gmail.com>
> 
> Python 2.7 will not be maintained past 2020.
> 
> Many scripts on the tree are used during the build and should keep
> Python 2 compatibility for a while.
> This is not the case for the runtime test infra. It's meant to be run in
> modern distros only, so it can safely switch to support Python 3 only.
> 
> An advantage of this approach is to have less scenarios to test in.
> Otherwise every change to the test infra or runtime tests would need to
> be tested against both versions of the interpreter, increasing the
> effort of the developers, to ensure the compatibility to Python 2 was
> not broken.
> 
> In order to accomplish the change to Python 3:
>  - change the shebang for run-tests;
>  - use Python 3 urllib as a drop-in replacement for Python 2 urllib2;
>  - when writing the downloaded binary files, explicitly open the output
>    file as binary;
>  - when subprocess is used to retrieve the text output from commands,
>    explicitly ask for text output. For this, use 'universal_newlines'
>    because 'text' was added only on Python 3.7;
>  - when pexpect is used to retrieve the text output from qemu or git,
>    explicitly ask for text output using 'encoding';
>  - the code using csv currently follows the example in the documentation
>    for the Python 2 module, change it to follow the example in the
>    documentation for the Python 3 module;
>  - fix the relative import for test_git.py to be Python 3 compliant.
> 
> Signed-off-by: Ricardo Martincoski <ricardo.martincoski at gmail.com>
> Cc: Arnout Vandecappelle <arnout at mind.be>
> Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
> Cc: Yann E. MORIN <yann.morin.1998 at free.fr>
> Tested-by: Romain Naour <romain.naour at smile.fr>
> Tested-by: Nicolas Carrier <nicolas.carrier at orolia.com>
> Signed-off-by: Nicolas Carrier <nicolas.carrier at orolia.com>

 Applied to master, thanks.

 Regards,
 Arnout



More information about the buildroot mailing list