makepanda: fix for python >= 3.13 on android
android is now a supported platform Python since Python 3.13. Earlier logic for figuring out android is still kept to preserve backwards compatibility with Python versions <= 3.12. Also have added a comment where we are monkeypatching sys.platform to "android" to remove it once minimum python requirement is removed Found initially during Python bump for Termux (https://github.com/termux/termux-packages/pull/27739) Also seems like Pyright too hasn't caught up with this yet. So it needs to be made aware as well
This commit is contained in:
parent
5a82ac3208
commit
586b92a4ab
|
|
@ -284,7 +284,7 @@ def GetHost():
|
|||
return 'darwin'
|
||||
elif sys.platform.startswith('linux'):
|
||||
try:
|
||||
# Python seems to offer no built-in way to check this.
|
||||
# Python versions before 3.13 reported android as "linux"
|
||||
osname = subprocess.check_output(["uname", "-o"])
|
||||
if osname.strip().lower() == b'android':
|
||||
return 'android'
|
||||
|
|
@ -294,6 +294,9 @@ def GetHost():
|
|||
return 'linux'
|
||||
elif sys.platform.startswith('freebsd'):
|
||||
return 'freebsd'
|
||||
# Handle for Python >= 3.13
|
||||
elif sys.platform == 'android':
|
||||
return 'android'
|
||||
else:
|
||||
exit('Unrecognized sys.platform: %s' % (sys.platform))
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from importlib.machinery import ModuleSpec
|
|||
|
||||
from importlib import _bootstrap_external
|
||||
|
||||
# This should not be needed once we bump the minimum python version requirement to 3.13
|
||||
sys.platform = "android"
|
||||
|
||||
class AndroidExtensionFinder(MetaPathFinder):
|
||||
|
|
|
|||
Loading…
Reference in New Issue