diff mbox series

[v2,1/5] devtool: ide_sdk: Use bitbake's python3 for generated scripts

Message ID 20240219165525.714512-2-enguerrand.de-ribaucourt@savoirfairelinux.com
State Accepted, archived
Commit 45704319661570b45ef69fddd6b4b4fa22ca80d1
Headers show
Series devtool: ide: Improve VSCode support | expand

Commit Message

Enguerrand de Ribaucourt Feb. 19, 2024, 4:55 p.m. UTC
The generated scripts use the sys.path configuration found inside
bitbake. It can be a different python version than the one used on the
host through the IDE.

For instance, when running the generated script
deploy_target_cmake-example-core2-64 from an eSDK generated on another
machine, I got the following exception:
    AssertionError: SRE module mismatch

We need to match the sys.executable to the sys.path.

Signed-off-by: Enguerrand de Ribaucourt <enguerrand.de-ribaucourt@savoirfairelinux.com>
---
 scripts/lib/devtool/ide_sdk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adrian Freihofer Feb. 20, 2024, 9:03 a.m. UTC | #1
On Mon, 2024-02-19 at 17:55 +0100, Enguerrand de Ribaucourt wrote:
> The generated scripts use the sys.path configuration found inside
> bitbake. It can be a different python version than the one used on
> the
> host through the IDE.
> 
> For instance, when running the generated script
> deploy_target_cmake-example-core2-64 from an eSDK generated on
> another
> machine, I got the following exception:
>     AssertionError: SRE module mismatch
> 
> We need to match the sys.executable to the sys.path.
> 
> Signed-off-by: Enguerrand de Ribaucourt
> <enguerrand.de-ribaucourt@savoirfairelinux.com>
> ---
>  scripts/lib/devtool/ide_sdk.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/devtool/ide_sdk.py
> b/scripts/lib/devtool/ide_sdk.py
> index 3986dc1436a..14679744807 100755
> --- a/scripts/lib/devtool/ide_sdk.py
> +++ b/scripts/lib/devtool/ide_sdk.py
> @@ -750,7 +750,7 @@ class RecipeModified:
>          does not need to start a bitbake server. All information
> from tinfoil
>          is hard-coded in the generated script.
>          """
> -        cmd_lines = ['#!/usr/bin/env python3']
> +        cmd_lines = ['#!%s' % str(sys.executable)]
>          cmd_lines.append('import sys')
>          cmd_lines.append('devtool_sys_path = %s' % str(sys.path))
>          cmd_lines.append('devtool_sys_path.reverse()')

LGTM.

Adrian
diff mbox series

Patch

diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index 3986dc1436a..14679744807 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -750,7 +750,7 @@  class RecipeModified:
         does not need to start a bitbake server. All information from tinfoil
         is hard-coded in the generated script.
         """
-        cmd_lines = ['#!/usr/bin/env python3']
+        cmd_lines = ['#!%s' % str(sys.executable)]
         cmd_lines.append('import sys')
         cmd_lines.append('devtool_sys_path = %s' % str(sys.path))
         cmd_lines.append('devtool_sys_path.reverse()')