Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
continue-on-error: true

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5

# EmuFlight version
- name: Get code version
Expand Down
42 changes: 19 additions & 23 deletions make/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,26 @@
# and the ARM toolchain installed to either the Taulabs/tools directory, their
# respective default installation locations, or made available on the system path.

# Check for and find Python 2

# Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Get major version from aforementioned list
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# Just in case Make has some weird scope stuff
PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),2)
# Then we can just use the normal Python executable
PYTHON:=python
# First look for `python3`. If `which` doesn't return a null value, then it exists!
ifneq ($(shell which python3), "")
PYTHON:=python3
else
# However, this isn't always the case..
# Let's look for `python2`. If `which` doesn't return a null value, then
# it exists!
ifneq ($(shell which python2), "")
PYTHON:=python2
else
# And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND.
PYTHON:=python
echo "Python not found."
endif
# Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Get major version from aforementioned list
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# Just in case Make has some weird scope stuff
PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),3)
# Then we can just use the normal Python executable
PYTHON:=python
else
# And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND.
PYTHON:=python
echo "Python not found."
endif
endif

export PYTHON
42 changes: 19 additions & 23 deletions make/macosx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,26 @@
# ARM toolchain installed to either their respective default installation
# locations, the tools directory or made available on the system path.

# Check for and find Python 2

# Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Get major version from aforementioned list
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# Just in case Make has some weird scope stuff
PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),2)
# Then we can just use the normal Python executable
PYTHON:=python
# First look for `python3`. If `which` doesn't return a null value, then it exists!
ifneq ($(shell which python3), "")
PYTHON:=python3
else
# However, this isn't always the case..
# Let's look for `python2`. If `which` doesn't return a null value, then
# it exists!
ifneq ($(shell which python2), "")
PYTHON:=python2
else
# And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND.
PYTHON:=python
echo "Python not found."
endif
# Get Python version, separate major/minor/patch, then put into wordlist
PYTHON_VERSION_=$(wordlist 2,4,$(subst ., ,$(shell python -V 2>&1)))
# Get major version from aforementioned list
PYTHON_MAJOR_VERSION_=$(word 1,$(PYTHON_VERSION_))
# Just in case Make has some weird scope stuff
PYTHON=0
# If the major Python version is the one we want..
ifeq ($(PYTHON_MAJOR_VERSION_),3)
# Then we can just use the normal Python executable
PYTHON:=python
else
# And if it doesn't exist, let's use the default Python, and warn the user.
# PYTHON NOT FOUND.
PYTHON:=python
echo "Python not found."
endif
endif

export PYTHON