GaijinEntertainment / DagorEngine

Dagor Engine and Tools source code from Gaijin Games KFT
Other
2.2k stars 274 forks source link

Fixed Python3.3 support breakage with `sys.platform` being 'linux2' prior to Python3.3 #78

Closed RandomGamingDev closed 2 months ago

RandomGamingDev commented 2 months ago

Fixes issue #77

When identifying linux this is used:

sys.platform == 'linux'

but it fails for versions prior to python 3.3 since sys.platform used to include the kernel version, which was removed in python 3.3 which can be seen here: https://bugs.python.org/issue12326

The standard usage which is documented here is to replace it with sys.platform.startswith('linux') not only for linux, both other OSes as well, which provides better backwards and forward compatibility, and also means better support for other platforms (e.g. bsd): https://docs.python.org/3/library/sys.html#sys.platform

Unrelated Question: Will bsd support ever come to the DagorEngine?

including replacing other instances of sys.platform == * (even for those not comparing against linux) with the standard sys.platform.startswith(*)