From 2bd98c688770a662b9af3d4602498e60f70bcd2b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Sun, 9 May 2021 17:42:26 +0100 Subject: [PATCH] add python 3 tests to most shell scripts --- hardware/LEDborg/nrgpio | 5 ++++- hardware/LEDborg/package.json | 2 +- hardware/PiGpio/nrgpio | 6 +++++- hardware/PiGpio/package.json | 2 +- hardware/PiLcd/nrlcd | 6 +++++- hardware/PiLcd/package.json | 2 +- hardware/PiLiter/nrgpio | 6 +++++- hardware/PiLiter/package.json | 2 +- hardware/PiSrf/nrsrf | 6 +++++- hardware/PiSrf/package.json | 2 +- hardware/Pibrella/nrgpio | 5 ++++- hardware/Pibrella/package.json | 2 +- hardware/neopixel/neopix | 5 ++++- hardware/neopixel/package.json | 2 +- hardware/sensehat/package.json | 2 +- hardware/sensehat/sensehat | 6 +++++- hardware/unicorn/package.json | 2 +- hardware/unicorn/unihat | 6 +++++- 18 files changed, 51 insertions(+), 18 deletions(-) diff --git a/hardware/LEDborg/nrgpio b/hardware/LEDborg/nrgpio index 6040b37c..a758c429 100755 --- a/hardware/LEDborg/nrgpio +++ b/hardware/LEDborg/nrgpio @@ -1,4 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/nrgpio.py $@ +sudo $python_cmd -u $BASEDIR/nrgpio.py $@ diff --git a/hardware/LEDborg/package.json b/hardware/LEDborg/package.json index 9d5dbdb7..fec2d726 100644 --- a/hardware/LEDborg/package.json +++ b/hardware/LEDborg/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-ledborg", - "version" : "0.0.22", + "version" : "0.0.23", "description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.", "dependencies" : { }, diff --git a/hardware/PiGpio/nrgpio b/hardware/PiGpio/nrgpio index d81fcf44..efbaacbd 100755 --- a/hardware/PiGpio/nrgpio +++ b/hardware/PiGpio/nrgpio @@ -13,5 +13,9 @@ # limitations under the License. # +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) -python -u $BASEDIR/nrgpio.py $@ +$python_cmd -u $BASEDIR/nrgpio.py $@ diff --git a/hardware/PiGpio/package.json b/hardware/PiGpio/package.json index 69742e96..5ccba479 100644 --- a/hardware/PiGpio/package.json +++ b/hardware/PiGpio/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-pi-gpio", - "version": "2.0.0-beta2", + "version": "2.0.0-beta3", "description": "The basic Node-RED node for Pi GPIO", "dependencies" : { }, diff --git a/hardware/PiLcd/nrlcd b/hardware/PiLcd/nrlcd index 7536a6ce..9eac530d 100755 --- a/hardware/PiLcd/nrlcd +++ b/hardware/PiLcd/nrlcd @@ -1,3 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/nrlcd.py $@ +sudo $python_cmd -u $BASEDIR/nrlcd.py $@ diff --git a/hardware/PiLcd/package.json b/hardware/PiLcd/package.json index fd9950ec..c7f8afaa 100644 --- a/hardware/PiLcd/package.json +++ b/hardware/PiLcd/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pilcd", - "version" : "0.2.0", + "version" : "0.2.1", "description" : "A Node-RED node for Raspberry Pi to write to HD44780 style LCD panels.", "dependencies" : { }, diff --git a/hardware/PiLiter/nrgpio b/hardware/PiLiter/nrgpio index c28bfd1c..bb111c0a 100755 --- a/hardware/PiLiter/nrgpio +++ b/hardware/PiLiter/nrgpio @@ -1,3 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/nrgpio.py $@ +sudo $python_cmd -u $BASEDIR/nrgpio.py $@ \ No newline at end of file diff --git a/hardware/PiLiter/package.json b/hardware/PiLiter/package.json index 13e092bf..d6eaf089 100644 --- a/hardware/PiLiter/package.json +++ b/hardware/PiLiter/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-piliter", - "version" : "0.0.14", + "version" : "0.0.15", "description" : "A Node-RED node to drive a Raspberry Pi Pi-LITEr 8 LED board.", "dependencies" : { }, diff --git a/hardware/PiSrf/nrsrf b/hardware/PiSrf/nrsrf index 5e4852e7..6c8fcbc1 100755 --- a/hardware/PiSrf/nrsrf +++ b/hardware/PiSrf/nrsrf @@ -1,3 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/nrsrf.py $@ +sudo $python_cmd -u $BASEDIR/nrsrf.py $@ diff --git a/hardware/PiSrf/package.json b/hardware/PiSrf/package.json index 5f8b96af..2788e051 100644 --- a/hardware/PiSrf/package.json +++ b/hardware/PiSrf/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pisrf", - "version" : "0.1.4", + "version" : "0.1.5", "description" : "A Node-RED node for a Raspberry Pi to use a SRF04 or SRF05 range finder", "dependencies" : { }, diff --git a/hardware/Pibrella/nrgpio b/hardware/Pibrella/nrgpio index 6040b37c..bb111c0a 100755 --- a/hardware/Pibrella/nrgpio +++ b/hardware/Pibrella/nrgpio @@ -1,4 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/nrgpio.py $@ +sudo $python_cmd -u $BASEDIR/nrgpio.py $@ \ No newline at end of file diff --git a/hardware/Pibrella/package.json b/hardware/Pibrella/package.json index a38806d5..9eda91bd 100644 --- a/hardware/Pibrella/package.json +++ b/hardware/Pibrella/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pibrella", - "version" : "0.0.15", + "version" : "0.0.16", "description" : "A Node-RED node to read from and write to a Pibrella Raspberry Pi add-on board", "dependencies" : { }, diff --git a/hardware/neopixel/neopix b/hardware/neopixel/neopix index 357bc91d..e135bbd6 100755 --- a/hardware/neopixel/neopix +++ b/hardware/neopixel/neopix @@ -1,4 +1,7 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/neopix.py $@ +sudo $python_cmd -u $BASEDIR/neopix.py $@ diff --git a/hardware/neopixel/package.json b/hardware/neopixel/package.json index 6a1e65eb..12028093 100644 --- a/hardware/neopixel/package.json +++ b/hardware/neopixel/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-neopixel", - "version" : "0.1.1", + "version" : "0.1.2", "description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.", "dependencies" : { }, diff --git a/hardware/sensehat/package.json b/hardware/sensehat/package.json index 7babe47e..b32e91a7 100644 --- a/hardware/sensehat/package.json +++ b/hardware/sensehat/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-sense-hat", - "version" : "0.1.0", + "version" : "0.1.1", "description" : "A Node-RED node to interact with a Raspberry Pi Sense HAT", "repository" : { "type":"git", diff --git a/hardware/sensehat/sensehat b/hardware/sensehat/sensehat index 9674d293..1f583827 100755 --- a/hardware/sensehat/sensehat +++ b/hardware/sensehat/sensehat @@ -1,5 +1,9 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) ID=$(id -u) @@ -11,4 +15,4 @@ then SUDO="" fi -$SUDO python -u $BASEDIR/sensehat.py $@ +$SUDO $python_cmd -u $BASEDIR/sensehat.py $@ diff --git a/hardware/unicorn/package.json b/hardware/unicorn/package.json index 902b3f58..3551b043 100644 --- a/hardware/unicorn/package.json +++ b/hardware/unicorn/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-unicorn-hat", - "version" : "0.0.22", + "version" : "0.0.23", "description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.", "dependencies" : { "pngjs": "2.2.*" diff --git a/hardware/unicorn/unihat b/hardware/unicorn/unihat index 1be100cc..0b3133b2 100755 --- a/hardware/unicorn/unihat +++ b/hardware/unicorn/unihat @@ -1,4 +1,8 @@ #!/bin/bash +python_cmd='python3' +# Fallback to Python 2, if Python 3 is not available +command -v python3 > /dev/null || python_cmd=`python` + BASEDIR=$(dirname $0) -sudo python -u $BASEDIR/unihat.py $@ +sudo $python_cmd -u $BASEDIR/unihat.py $@