mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 08:31:04 +02:00
Replace Python script with Unix Shell and Powershell script.
Fixes #246.
This commit is contained in:
+12
-3
@@ -1,7 +1,16 @@
|
||||
LOVE_JNI_DIR := $(call my-dir)
|
||||
IS_NDK_R17 := $(shell python ${LOVE_JNI_DIR}/detect_ndkrel.py $(NDK_ROOT)/source.properties 17)
|
||||
IS_ANDROID_21 := $(shell python ${LOVE_JNI_DIR}/detect_androidapi.py $(TARGET_PLATFORM) 21)
|
||||
HAS_LOVE := $(shell python ${LOVE_JNI_DIR}/detect_love.py ${LOVE_JNI_DIR})
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
SHELL_EXECUTOR := powershell -executionpolicy unrestricted
|
||||
SCRIPT_EXTENSION := ps1
|
||||
else
|
||||
SHELL_EXECUTOR := sh
|
||||
SCRIPT_EXTENSION := sh
|
||||
endif
|
||||
|
||||
IS_NDK_R17 := $(shell ${SHELL_EXECUTOR} ${LOVE_JNI_DIR}/detect_ndkrel.${SCRIPT_EXTENSION} $(NDK_ROOT)/source.properties 17)
|
||||
IS_ANDROID_21 := $(shell ${SHELL_EXECUTOR} ${LOVE_JNI_DIR}/detect_androidapi.${SCRIPT_EXTENSION} $(TARGET_PLATFORM) 21)
|
||||
HAS_LOVE := $(shell ${SHELL_EXECUTOR} ${LOVE_JNI_DIR}/detect_love.${SCRIPT_EXTENSION} ${LOVE_JNI_DIR})
|
||||
|
||||
ifneq (${HAS_LOVE},yes)
|
||||
$(error Missing LOVE. Make sure to initialize the submodule correctly!)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
if ($args.Length -gt 1) {
|
||||
# $args[0] = android-%d
|
||||
# $args[1] = %d
|
||||
$found = $args[0] -match 'android-(\d+)'
|
||||
|
||||
if ($found -and $matches[1] -ge $args[1]) {
|
||||
Write-Output "yes"
|
||||
} else {
|
||||
Write-Output "no"
|
||||
}
|
||||
} else {
|
||||
Write-Output "unknown"
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import sys
|
||||
import re
|
||||
|
||||
def main(argv):
|
||||
if len(argv) > 1:
|
||||
# argv[0] = android-%d
|
||||
# argv[1] = %d
|
||||
matches = re.findall("android-(\d+)", argv[0])
|
||||
if len(matches) >= 1 and int(matches[0]) >= int(argv[1]):
|
||||
print("yes")
|
||||
else:
|
||||
print("no")
|
||||
else:
|
||||
print("unknown")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
# $1 = android-%d
|
||||
# $2 = %d
|
||||
version=$(echo $1 | grep -o 'android-[0-9]*' | grep -o '[0-9]*')
|
||||
|
||||
if [ $version -ge $2 ]; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
@@ -0,0 +1,7 @@
|
||||
$path = $args[0]
|
||||
|
||||
if (Test-Path -Path "$path/love/Android.mk") {
|
||||
Write-Output "yes"
|
||||
} else {
|
||||
Write-Output "no"
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import sys
|
||||
from os import path
|
||||
|
||||
def main(argv):
|
||||
if len(argv) > 0:
|
||||
if path.isdir(argv[0] + "/love") and path.isfile(argv[0] + "/love/Android.mk"):
|
||||
print("yes")
|
||||
else:
|
||||
print("no")
|
||||
else:
|
||||
print("no")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d "$1/love" ] && [ -f "$1/love/Android.mk" ]; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
@@ -0,0 +1,15 @@
|
||||
# $args[0] = source.properties
|
||||
# $args[1] = NDK version to be checked
|
||||
|
||||
if ($args.Count -ne 2) {
|
||||
Write-Output "unknown"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ndkVersion = (Select-String -Pattern "Pkg.Revision = (\d+)" -Path $args[0] | ForEach-Object { $_.Matches[0].Groups[1].Value })
|
||||
|
||||
if ($ndkVersion -ge $args[1]) {
|
||||
Write-Output "yes"
|
||||
} else {
|
||||
Write-Output "no"
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import sys
|
||||
import re
|
||||
|
||||
def main(argv):
|
||||
if len(argv) > 1:
|
||||
# argv[0] = source.properties
|
||||
# argv[1] = desired NDK version
|
||||
f = open(argv[0], "r")
|
||||
contents = f.read()
|
||||
f.close()
|
||||
matches = re.findall("Pkg.Revision = (\d+)", contents)
|
||||
if len(matches) >= 1 and int(matches[0]) >= int(argv[1]):
|
||||
print("yes")
|
||||
else:
|
||||
print("no")
|
||||
else:
|
||||
print("unknown")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
# $1 = source.properties
|
||||
# $2 = NDK version to be checked
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "unknown"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ndkVersion=$(grep -Po 'Pkg.Revision = (\d+)' "$1" | grep -Po '\d+')
|
||||
|
||||
if [ "$ndkVersion" -ge "$2" ]; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
Reference in New Issue
Block a user