From 3e24bad3e8ed82fec0a4b0fadc65b5137523a8d4 Mon Sep 17 00:00:00 2001 From: Matthew Duane Hardcastle Date: Wed, 3 Jul 2024 11:35:38 -0400 Subject: [PATCH 1/4] [Py3] Use /usr/bin/python3 --- create.py | 2 +- info.plist | 6 +++--- queries.py | 2 +- search.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/create.py b/create.py index c292bf2..e2800fb 100644 --- a/create.py +++ b/create.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # encoding: utf-8 """ diff --git a/info.plist b/info.plist index e7d3e15..0fd25e1 100644 --- a/info.plist +++ b/info.plist @@ -82,7 +82,7 @@ runningsubtext Searching... script - /usr/bin/python search.py "{query}" + /usr/bin/python3 search.py "{query}" scriptargtype 0 scriptfile @@ -179,7 +179,7 @@ fi runningsubtext Searching... script - /usr/bin/python search.py -t a "{query}" + /usr/bin/python3 search.py -t a "{query}" scriptargtype 0 scriptfile @@ -226,7 +226,7 @@ fi runningsubtext Searching... script - /usr/bin/python create.py "{query}" + /usr/bin/python3 create.py "{query}" scriptargtype 0 scriptfile diff --git a/queries.py b/queries.py index 5d7f8de..7dada67 100644 --- a/queries.py +++ b/queries.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # encoding: utf-8 """ diff --git a/search.py b/search.py index b653330..223b953 100644 --- a/search.py +++ b/search.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # encoding: utf-8 """ From 15283e5bb5507402aacb1cf9c96a816404eabb6b Mon Sep 17 00:00:00 2001 From: Matthew Duane Hardcastle Date: Thu, 4 Jul 2024 10:40:53 -0400 Subject: [PATCH 2/4] [wip] use python and python3 --- info.plist | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/info.plist b/info.plist index 0fd25e1..3833112 100644 --- a/info.plist +++ b/info.plist @@ -82,7 +82,18 @@ runningsubtext Searching... script - /usr/bin/python3 search.py "{query}" + #!/bin/bash + +if [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 +elif [ -e /usr/bin/python ]; then + py=/usr/bin/python +else + echo "Couldn't find system python" + exit 1 +fi + +/usr/bin/python search.py "{query}" scriptargtype 0 scriptfile @@ -179,7 +190,18 @@ fi runningsubtext Searching... script - /usr/bin/python3 search.py -t a "{query}" + #!/bin/bash + +if [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 +elif [ -e /usr/bin/python ]; then + py=/usr/bin/python +else + echo "Couldn't find system python" + exit 1 +fi + +/usr/bin/python search.py -t a "{query}" scriptargtype 0 scriptfile @@ -226,7 +248,18 @@ fi runningsubtext Searching... script - /usr/bin/python3 create.py "{query}" + #!/bin/bash + +if [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 +elif [ -e /usr/bin/python ]; then + py=/usr/bin/python +else + echo "Couldn't find system python" + exit 1 +fi + +/usr/bin/python create.py "{query}" scriptargtype 0 scriptfile From 9b7c179ac8a126a60674ffa54820ea579b8852b9 Mon Sep 17 00:00:00 2001 From: Matthew Duane Hardcastle Date: Thu, 4 Jul 2024 15:12:56 -0400 Subject: [PATCH 3/4] Use $py for python (whoops) --- info.plist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.plist b/info.plist index 3833112..3133e11 100644 --- a/info.plist +++ b/info.plist @@ -93,7 +93,7 @@ else exit 1 fi -/usr/bin/python search.py "{query}" +$py search.py "{query}" scriptargtype 0 scriptfile @@ -201,7 +201,7 @@ else exit 1 fi -/usr/bin/python search.py -t a "{query}" +$py search.py -t a "{query}" scriptargtype 0 scriptfile @@ -259,7 +259,7 @@ else exit 1 fi -/usr/bin/python create.py "{query}" +$py create.py "{query}" scriptargtype 0 scriptfile From 84517f0a496698c407e9431cf292a61b8d9243f2 Mon Sep 17 00:00:00 2001 From: Matthew Duane Hardcastle Date: Thu, 4 Jul 2024 15:21:16 -0400 Subject: [PATCH 4/4] Use python as default over python3 A stub /usr/bin/python3 exists on BigSur (perhaps others) that triggers an xcode install window the first time the plugin runs. This change avoids the unexpected window by using the version of Python that's already available. --- info.plist | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/info.plist b/info.plist index 3133e11..ae99ed2 100644 --- a/info.plist +++ b/info.plist @@ -84,10 +84,10 @@ script #!/bin/bash -if [ -e /usr/bin/python3 ]; then - py=/usr/bin/python3 -elif [ -e /usr/bin/python ]; then +if [ -e /usr/bin/python ]; then py=/usr/bin/python +elif [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 else echo "Couldn't find system python" exit 1 @@ -192,10 +192,10 @@ fi script #!/bin/bash -if [ -e /usr/bin/python3 ]; then - py=/usr/bin/python3 -elif [ -e /usr/bin/python ]; then +if [ -e /usr/bin/python ]; then py=/usr/bin/python +elif [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 else echo "Couldn't find system python" exit 1 @@ -250,10 +250,10 @@ $py search.py -t a "{query}" script #!/bin/bash -if [ -e /usr/bin/python3 ]; then - py=/usr/bin/python3 -elif [ -e /usr/bin/python ]; then +if [ -e /usr/bin/python ]; then py=/usr/bin/python +elif [ -e /usr/bin/python3 ]; then + py=/usr/bin/python3 else echo "Couldn't find system python" exit 1