1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- From 1cd1ff0216d5beb2a2523031398d4dba7d12729d Mon Sep 17 00:00:00 2001
- From: James Hilliard <james.hilliard1@gmail.com>
- Date: Tue, 2 Jul 2024 14:51:26 -0600
- Subject: [PATCH] Fix python3 shebang paths and add python option.
- Using absolute paths can result in the wrong python3 binary being
- used, such as when cross compiling using a non-system python3.
- Use the normal python3 env shebang instead.
- Also add a meson option to allow overriding the python path.
- Upstream: https://github.com/fwupd/fwupd-efi/commit/1cd1ff0216d5beb2a2523031398d4dba7d12729d
- Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
- ---
- contrib/reformat-code.py | 2 +-
- efi/generate_binary.py | 2 +-
- efi/generate_sbat.py | 2 +-
- efi/meson.build | 4 ++--
- meson.build | 7 +++++++
- meson_options.txt | 1 +
- 6 files changed, 13 insertions(+), 5 deletions(-)
- diff --git a/contrib/reformat-code.py b/contrib/reformat-code.py
- index 65a4ac4..ff6014d 100755
- --- a/contrib/reformat-code.py
- +++ b/contrib/reformat-code.py
- @@ -1,4 +1,4 @@
- -#!/usr/bin/python3
- +#!/usr/bin/env python3
- #
- # Copyright (C) 2017 Dell Inc.
- #
- diff --git a/efi/generate_binary.py b/efi/generate_binary.py
- index 443472a..a4611bb 100755
- --- a/efi/generate_binary.py
- +++ b/efi/generate_binary.py
- @@ -1,4 +1,4 @@
- -#!/usr/bin/python3
- +#!/usr/bin/env python3
- #
- # Copyright (C) 2021 Javier Martinez Canillas <javierm@redhat.com>
- # Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
- diff --git a/efi/generate_sbat.py b/efi/generate_sbat.py
- index 6c904e5..b9b80ac 100755
- --- a/efi/generate_sbat.py
- +++ b/efi/generate_sbat.py
- @@ -1,4 +1,4 @@
- -#!/usr/bin/python3
- +#!/usr/bin/env python3
- #
- # Copyright (C) 2021 Javier Martinez Canillas <javierm@redhat.com>
- # Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
- diff --git a/efi/meson.build b/efi/meson.build
- index 75ade7a..008ba3d 100644
- --- a/efi/meson.build
- +++ b/efi/meson.build
- @@ -1,5 +1,5 @@
- -generate_sbat = find_program('generate_sbat.py', native: true)
- -generate_binary = find_program('generate_binary.py', native: true)
- +generate_sbat = [python3, files('generate_sbat.py')]
- +generate_binary = [python3, files('generate_binary.py')]
-
- # get source version, falling back
- git = find_program('git', required : false)
- diff --git a/meson.build b/meson.build
- index a5612a6..5836213 100644
- --- a/meson.build
- +++ b/meson.build
- @@ -19,6 +19,13 @@ libexecdir = join_paths(prefix, get_option('libexecdir'))
-
- genpeimg = find_program ('genpeimg', required: get_option('genpeimg'))
-
- +python3path = get_option('python')
- +if python3path == ''
- + python3 = import('python').find_installation('python3')
- +else
- + python3 = find_program(python3path)
- +endif
- +
- efi_app_location = join_paths(libexecdir, 'fwupd', 'efi')
- host_cpu = host_machine.cpu_family()
- if host_cpu == 'x86'
- diff --git a/meson_options.txt b/meson_options.txt
- index 588ae29..5f6f521 100644
- --- a/meson_options.txt
- +++ b/meson_options.txt
- @@ -8,3 +8,4 @@ option('efi_sbat_distro_pkgname', type : 'string', value : '', description : 'SB
- option('efi_sbat_distro_version', type : 'string', value : '', description : 'SBAT distribution version, e.g. fwupd-1.5.6.fc33')
- option('efi_sbat_distro_url', type : 'string', value : '', description : 'SBAT distribution URL, e.g. https://src.fedoraproject.org/rpms/fwupd')
- option('genpeimg', type : 'feature', description : 'Use genpeimg to add NX support to binaries')
- +option('python', type : 'string', description : 'the absolute path of the python3 binary')
- --
- 2.34.1
|