From eb274775d7053732f820ac264c652fc4f03ee749 Mon Sep 17 00:00:00 2001 From: jmackay2 <1.732mackay@gmail.com> Date: Wed, 23 Jul 2025 02:30:04 -0400 Subject: [PATCH] Update tools shebangs to python3 (#24739) Co-authored-by: jmackay2 --- Tools/boot_now.py | 2 +- Tools/compress.py | 2 +- Tools/fetch_file.py | 6 +++--- Tools/geotag_images_ulog.py | 10 +++++----- Tools/package_firmware.py | 2 +- Tools/parameter_update.py | 4 ++-- Tools/process_sensor_caldata.py | 2 +- Tools/px4.py | 2 +- Tools/px_mkfw.py | 2 +- Tools/px_process_airframes.py | 2 +- Tools/px_process_events.py | 2 +- Tools/px_process_module_doc.py | 2 +- Tools/px_romfs_pruner.py | 2 +- Tools/run-clang-tidy.py | 2 +- Tools/uorb_graph/create.py | 2 +- Tools/validate_yaml.py | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Tools/boot_now.py b/Tools/boot_now.py index 5a9e608dad..39e455f298 100755 --- a/Tools/boot_now.py +++ b/Tools/boot_now.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2012-2015 PX4 Development Team. All rights reserved. diff --git a/Tools/compress.py b/Tools/compress.py index e4511e293f..157c2a64dc 100755 --- a/Tools/compress.py +++ b/Tools/compress.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import argparse import lzma diff --git a/Tools/fetch_file.py b/Tools/fetch_file.py index 5e8fba8449..78a19bb3c8 100755 --- a/Tools/fetch_file.py +++ b/Tools/fetch_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2013-2014 PX4 Development Team. All rights reserved. @@ -34,7 +34,7 @@ """Fetch files via nsh console -Usage: python fetch_file.py [-l] [-f] [-d device] [-s speed] [-o out_path] path +Usage: python3 fetch_file.py [-l] [-f] [-d device] [-s speed] [-o out_path] path \t-l\tList files \t-f\tOverwrite existing files \t-d\tSerial device @@ -134,7 +134,7 @@ def _get_files_in_dir(ser, path, path_out, force, timeout): _get_file(ser, path_fn, path_fn_out, force, timeout) def _usage(): - print("""Usage: python fetch_file.py [-l] [-f] [-d device] [-s speed] [-o out_path] path + print("""Usage: python3 fetch_file.py [-l] [-f] [-d device] [-s speed] [-o out_path] path \t-l\tList files \t-f\tOverwrite existing files \t-d\tSerial device diff --git a/Tools/geotag_images_ulog.py b/Tools/geotag_images_ulog.py index d8b0a9e09f..d1acf21fd5 100755 --- a/Tools/geotag_images_ulog.py +++ b/Tools/geotag_images_ulog.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ####################################################################################### # # DeltaTag: enhanced geo-referencing survey images @@ -15,8 +15,8 @@ # Note: DeltaTag does not make copies, it writes the Exif information directly to the images # # Install: pip install pyulog piexif Pillow numpy -# Run: python geotag_images_ulog.py [logfile] [image dir] (optional offset) -# eg: python geotag_images_ulog.py mylog.ulg ./images +# Run: python3 geotag_images_ulog.py [logfile] [image dir] (optional offset) +# eg: python3 geotag_images_ulog.py mylog.ulg ./images # # Parameters # logfile: a ulog formatted logfile containing camera_capture events (survey missions) @@ -39,8 +39,8 @@ from fractions import Fraction if(len(sys.argv)) < 3: - print("Usage: python geotag_images_ulog.py [logfile] [image dir]") - print("Example: python geotag_images_ulog.py mylog.ulg ./images") + print("Usage: python3 geotag_images_ulog.py [logfile] [image dir]") + print("Example: python3 geotag_images_ulog.py mylog.ulg ./images") print(len(sys.argv)) sys.exit() diff --git a/Tools/package_firmware.py b/Tools/package_firmware.py index 338d41ded3..45471e3d24 100755 --- a/Tools/package_firmware.py +++ b/Tools/package_firmware.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import glob import zipfile diff --git a/Tools/parameter_update.py b/Tools/parameter_update.py index d421869f78..6d92dde4cb 100755 --- a/Tools/parameter_update.py +++ b/Tools/parameter_update.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################################################ @@ -55,7 +55,7 @@ Usage: The script needs a list of files as an input. To quickly find and feed all the file that it needs to inspect, one can simply pipe the result of a ripgrep -l command as follows: - rg -l '\.[gs]et\(|px4::params::' -tcpp | python parameter_update.py + rg -l '\.[gs]et\(|px4::params::' -tcpp | python3 parameter_update.py """ import re diff --git a/Tools/process_sensor_caldata.py b/Tools/process_sensor_caldata.py index 15ef1c84ce..e70ffc8878 100755 --- a/Tools/process_sensor_caldata.py +++ b/Tools/process_sensor_caldata.py @@ -23,7 +23,7 @@ Data can be gathered using the following sequence: 5) Move to a warm dry, still air, constant pressure environment. 6) Apply power for 45 minutes, keeping the board still. 7) Remove power and extract the .ulog file -8) Open a terminal window in the Firmware/Tools directory and run the python calibration script script file: 'python process_sensor_caldata.py +8) Open a terminal window in the Firmware/Tools directory and run the python calibration script script file: 'python3 process_sensor_caldata.py 9) Power the board, connect QGC and load the parameter from the generated .params file onto the board using QGC. Due to the number of parameters, loading them may take some time. 10) TODO - we need a way for user to reliably tell when parameters have all been changed and saved. 11) After parameters have finished loading, set SDLOG_MODE and SDLOG_PROFILE to their respective values prior to step 4) and remove power. diff --git a/Tools/px4.py b/Tools/px4.py index a51238265f..68badab005 100755 --- a/Tools/px4.py +++ b/Tools/px4.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (c) 2017-2020 PX4 Development Team. All rights reserved. diff --git a/Tools/px_mkfw.py b/Tools/px_mkfw.py index 3f005f7d42..f31d2a8972 100755 --- a/Tools/px_mkfw.py +++ b/Tools/px_mkfw.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved. diff --git a/Tools/px_process_airframes.py b/Tools/px_process_airframes.py index 4d5f9f57aa..b27bb77766 100755 --- a/Tools/px_process_airframes.py +++ b/Tools/px_process_airframes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2013-2017 PX4 Development Team. All rights reserved. diff --git a/Tools/px_process_events.py b/Tools/px_process_events.py index e79c956cf4..14d618eeb8 100755 --- a/Tools/px_process_events.py +++ b/Tools/px_process_events.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2020 PX4 Development Team. All rights reserved. diff --git a/Tools/px_process_module_doc.py b/Tools/px_process_module_doc.py index b09ec606c3..4f1e28e6af 100755 --- a/Tools/px_process_module_doc.py +++ b/Tools/px_process_module_doc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2017 PX4 Development Team. All rights reserved. diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index 20ae3109bf..14f935f9ab 100755 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # # Copyright (C) 2014-2018 PX4 Development Team. All rights reserved. diff --git a/Tools/run-clang-tidy.py b/Tools/run-clang-tidy.py index 21aa2ac7dc..134e284447 100755 --- a/Tools/run-clang-tidy.py +++ b/Tools/run-clang-tidy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # #===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===# # diff --git a/Tools/uorb_graph/create.py b/Tools/uorb_graph/create.py index cd213c9385..c7f73208a3 100755 --- a/Tools/uorb_graph/create.py +++ b/Tools/uorb_graph/create.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 from __future__ import print_function diff --git a/Tools/validate_yaml.py b/Tools/validate_yaml.py index e7b9a25fd8..ebeae8745b 100755 --- a/Tools/validate_yaml.py +++ b/Tools/validate_yaml.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3 +#!/usr/bin/env python3 """ Script to validate YAML file(s) against a YAML schema file """ from __future__ import print_function