Update python requirement:
- Support both python 3 and 2 for building and running mods - Require python 3 for packaging
This commit is contained in:
parent
6be7740144
commit
eb3826e935
10
Makefile
10
Makefile
@ -23,10 +23,18 @@
|
||||
.PHONY: utility stylecheck build clean engine version check check-scripts check-sdk-scripts check-packaging-scripts check-variables
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
PYTHON = $(shell command -v python3 2> /dev/null)
|
||||
ifeq ($(PYTHON),)
|
||||
PYTHON = $(shell command -v python 2> /dev/null)
|
||||
endif
|
||||
ifeq ($(PYTHON),)
|
||||
$(error "The OpenRA mod template requires python.")
|
||||
endif
|
||||
|
||||
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
|
||||
MOD_ID = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/MOD_ID/ { print $$2; exit }')
|
||||
ENGINE_DIRECTORY = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/ENGINE_DIRECTORY/ { print $$2; exit }')
|
||||
MOD_SEARCH_PATHS = "$(shell python -c "import os; print(os.path.realpath('.'))")/mods,./mods"
|
||||
MOD_SEARCH_PATHS = "$(shell $(PYTHON) -c "import os; print(os.path.realpath('.'))")/mods,./mods"
|
||||
|
||||
WHITELISTED_OPENRA_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_OPENRA_ASSEMBLIES/ { print $$2; exit }')"
|
||||
WHITELISTED_THIRDPARTY_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_THIRDPARTY_ASSEMBLIES/ { print $$2; exit }')"
|
||||
|
||||
@ -3,7 +3,12 @@
|
||||
# This should not be called manually
|
||||
|
||||
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl or wget."; exit 1; }
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON="python3"
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
PYTHON="python"
|
||||
fi
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
@ -17,7 +22,7 @@ require_variables() {
|
||||
fi
|
||||
}
|
||||
|
||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||
|
||||
# shellcheck source=mod.config
|
||||
|
||||
@ -5,8 +5,13 @@
|
||||
# Read the file to see which settings you can override
|
||||
|
||||
set -e
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON="python3"
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
PYTHON="python"
|
||||
fi
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
@ -20,7 +25,7 @@ require_variables() {
|
||||
fi
|
||||
}
|
||||
|
||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||
|
||||
|
||||
@ -2,6 +2,12 @@
|
||||
|
||||
set -e
|
||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON="python3"
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
PYTHON="python"
|
||||
fi
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
@ -15,15 +21,7 @@ require_variables() {
|
||||
fi
|
||||
}
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
TEMPLATE_LAUNCHER=$(python3 -c "import os; print(os.path.realpath('$0'))")
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||
else
|
||||
echo >&2 "The OpenRA mod template requires python."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires make."; exit 1; }
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python 3."; exit 1; }
|
||||
command -v tar >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires tar."; exit 1; }
|
||||
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires curl or wget."; exit 1; }
|
||||
|
||||
@ -24,7 +24,7 @@ if [ $# -eq "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
TEMPLATE_ROOT="${PACKAGING_DIR}/../../"
|
||||
ARTWORK_DIR="${PACKAGING_DIR}/../artwork/"
|
||||
|
||||
@ -42,9 +42,9 @@ require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGIN
|
||||
|
||||
TAG="$1"
|
||||
if [ $# -eq "1" ]; then
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))")
|
||||
else
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('$2'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))")
|
||||
fi
|
||||
|
||||
BUILTDIR="${PACKAGING_DIR}/${PACKAGING_INSTALLER_NAME}.appdir"
|
||||
@ -169,4 +169,4 @@ install -m 0755 include/gtk-dialog.py "${BUILTDIR}/usr/bin/gtk-dialog.py"
|
||||
ARCH=x86_64 ./squashfs-root/AppRun "${BUILTDIR}" "${OUTPUTDIR}/${PACKAGING_INSTALLER_NAME}-${TAG}-x86_64.AppImage"
|
||||
|
||||
# Clean up
|
||||
rm -rf openra-mod.temp openra-mod-server.temp openra-mod-utility.temp temp.desktop temp.xml AppRun.temp appimagetool-x86_64.AppImage squashfs-root "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" "${BUILTDIR}"
|
||||
rm -rf openra-mod.temp openra-mod-server.temp openra-mod-utility.temp temp.desktop temp.xml AppRun.temp appimagetool-x86_64.AppImage squashfs-root "${PACKAGING_APPIMAGE_DEPENDENCIES_TEMP_ARCHIVE_NAME}" "${BUILTDIR}"
|
||||
|
||||
@ -20,7 +20,7 @@ if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
fi
|
||||
|
||||
command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires make."; exit 1; }
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
@ -39,7 +39,7 @@ if [ $# -eq "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
TEMPLATE_ROOT="${PACKAGING_DIR}/../../"
|
||||
ARTWORK_DIR="${PACKAGING_DIR}/../artwork/"
|
||||
|
||||
@ -70,9 +70,9 @@ fi
|
||||
|
||||
TAG="$1"
|
||||
if [ $# -eq "1" ]; then
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))")
|
||||
else
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('$2'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))")
|
||||
fi
|
||||
|
||||
BUILTDIR="${PACKAGING_DIR}/build"
|
||||
|
||||
@ -13,7 +13,7 @@ else
|
||||
OUTPUTDIR=$2
|
||||
fi
|
||||
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python 3."; exit 1; }
|
||||
command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires make."; exit 1; }
|
||||
|
||||
if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
@ -21,7 +21,7 @@ if [[ "$OSTYPE" != "darwin"* ]]; then
|
||||
command -v makensis >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires makensis."; exit 1; }
|
||||
fi
|
||||
|
||||
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo "Windows packaging requires a Linux host."
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
set -e
|
||||
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
|
||||
command -v convert >/dev/null 2>&1 || { echo >&2 "Windows packaging requires ImageMagick."; exit 1; }
|
||||
command -v python3 >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
@ -20,7 +21,7 @@ if [ $# -eq "0" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGING_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
PACKAGING_DIR=$(python3 -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
|
||||
TEMPLATE_ROOT="${PACKAGING_DIR}/../../"
|
||||
ARTWORK_DIR="${PACKAGING_DIR}/../artwork/"
|
||||
|
||||
@ -38,9 +39,9 @@ require_variables "MOD_ID" "ENGINE_DIRECTORY" "PACKAGING_DISPLAY_NAME" "PACKAGIN
|
||||
|
||||
TAG="$1"
|
||||
if [ $# -eq "1" ]; then
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('.'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('.'))")
|
||||
else
|
||||
OUTPUTDIR=$(python -c "import os; print(os.path.realpath('$2'))")
|
||||
OUTPUTDIR=$(python3 -c "import os; print(os.path.realpath('$2'))")
|
||||
fi
|
||||
|
||||
BUILTDIR="${PACKAGING_DIR}/build"
|
||||
|
||||
10
utility.sh
10
utility.sh
@ -5,9 +5,15 @@
|
||||
|
||||
set -e
|
||||
command -v make >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires make."; exit 1; }
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
command -v mono >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires mono."; exit 1; }
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON="python3"
|
||||
else
|
||||
command -v python >/dev/null 2>&1 || { echo >&2 "The OpenRA mod template requires python."; exit 1; }
|
||||
PYTHON="python"
|
||||
fi
|
||||
|
||||
require_variables() {
|
||||
missing=""
|
||||
for i in "$@"; do
|
||||
@ -20,7 +26,7 @@ require_variables() {
|
||||
fi
|
||||
}
|
||||
|
||||
TEMPLATE_LAUNCHER=$(python -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_LAUNCHER=$(${PYTHON} -c "import os; print(os.path.realpath('$0'))")
|
||||
TEMPLATE_ROOT=$(dirname "${TEMPLATE_LAUNCHER}")
|
||||
MOD_SEARCH_PATHS="${TEMPLATE_ROOT}/mods,./mods"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user