@@ -604,9 +604,11 @@ def _syscmd_uname(option, default=''):
604
604
605
605
""" Interface to the system's uname command.
606
606
"""
607
- if sys .platform in ('dos' , 'win32' , 'win16' ):
608
- # XXX Others too ?
609
- return default
607
+ # TODO: fix RustPython
608
+ return default
609
+ # if sys.platform in ('dos', 'win32', 'win16'):
610
+ # # XXX Others too ?
611
+ # return default
610
612
611
613
import subprocess
612
614
try :
@@ -967,6 +969,14 @@ def processor():
967
969
r'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
968
970
r'\[PyPy [^\]]+\]?' )
969
971
972
+ _rustpython_sys_version_parser = re .compile (
973
+ r'RustPython '
974
+ r'([\w.+]+)\s*' # "version<space>"
975
+ r'\(#?([^,]+)' # "(#buildno"
976
+ r'(?:,\s*([\w ]*)' # ", builddate"
977
+ r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
978
+ r'\[([^\]]+)\]?' , re .ASCII ) # "[compiler]"
979
+
970
980
_sys_version_cache = {}
971
981
972
982
def _sys_version (sys_version = None ):
@@ -1039,6 +1049,16 @@ def _sys_version(sys_version=None):
1039
1049
version , buildno , builddate , buildtime = match .groups ()
1040
1050
compiler = ""
1041
1051
1052
+ elif "RustPython" in sys_version :
1053
+ # RustPython
1054
+ name = "RustPython"
1055
+ match = _rustpython_sys_version_parser .match (sys_version )
1056
+ if match is None :
1057
+ raise ValueError ("failed to parse RustPython sys.version: %s" %
1058
+ repr (sys_version ))
1059
+ version , buildno , builddate , buildtime , compiler = \
1060
+ match .groups ()
1061
+
1042
1062
else :
1043
1063
# CPython
1044
1064
match = _sys_version_parser .match (sys_version )
0 commit comments