@@ -971,14 +971,6 @@ def processor():
971
971
r'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
972
972
r'\[PyPy [^\]]+\]?' )
973
973
974
- _rustpython_sys_version_parser = re .compile (
975
- r'RustPython '
976
- r'([\w.+]+)\s*' # "version<space>"
977
- r'\(#?([^,]+)' # "(#buildno"
978
- r'(?:,\s*([\w ]*)' # ", builddate"
979
- r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
980
- r'\[([^\]]+)\]?' , re .ASCII ) # "[compiler]"
981
-
982
974
_sys_version_cache = {}
983
975
984
976
def _sys_version (sys_version = None ):
@@ -1051,16 +1043,6 @@ def _sys_version(sys_version=None):
1051
1043
version , buildno , builddate , buildtime = match .groups ()
1052
1044
compiler = ""
1053
1045
1054
- elif "RustPython" in sys_version :
1055
- # RustPython
1056
- name = "RustPython"
1057
- match = _rustpython_sys_version_parser .match (sys_version )
1058
- if match is None :
1059
- raise ValueError ("failed to parse RustPython sys.version: %s" %
1060
- repr (sys_version ))
1061
- version , buildno , builddate , buildtime , compiler = \
1062
- match .groups ()
1063
-
1064
1046
else :
1065
1047
# CPython
1066
1048
match = _sys_version_parser .match (sys_version )
@@ -1095,28 +1077,8 @@ def _sys_version(sys_version=None):
1095
1077
_sys_version_cache [sys_version ] = result
1096
1078
return result
1097
1079
1098
- def python_implementation ():
1099
-
1100
- """ Returns a string identifying the Python implementation.
1101
-
1102
- Currently, the following implementations are identified:
1103
- 'CPython' (C implementation of Python),
1104
- 'IronPython' (.NET implementation of Python),
1105
- 'Jython' (Java implementation of Python),
1106
- 'PyPy' (Python implementation of Python).
1107
-
1108
- """
1109
- return _sys_version ()[0 ]
1110
-
1111
- def python_version ():
1112
-
1113
- """ Returns the Python version as string 'major.minor.patchlevel'
1114
-
1115
- Note that unlike the Python sys.version, the returned value
1116
- will always include the patchlevel (it defaults to 0).
1117
-
1118
- """
1119
- return _sys_version ()[1 ]
1080
+ # RustPython specific
1081
+ from _platform import *
1120
1082
1121
1083
def python_version_tuple ():
1122
1084
@@ -1127,50 +1089,7 @@ def python_version_tuple():
1127
1089
will always include the patchlevel (it defaults to 0).
1128
1090
1129
1091
"""
1130
- return tuple (_sys_version ()[1 ].split ('.' ))
1131
-
1132
- def python_branch ():
1133
-
1134
- """ Returns a string identifying the Python implementation
1135
- branch.
1136
-
1137
- For CPython this is the SCM branch from which the
1138
- Python binary was built.
1139
-
1140
- If not available, an empty string is returned.
1141
-
1142
- """
1143
-
1144
- return _sys_version ()[2 ]
1145
-
1146
- def python_revision ():
1147
-
1148
- """ Returns a string identifying the Python implementation
1149
- revision.
1150
-
1151
- For CPython this is the SCM revision from which the
1152
- Python binary was built.
1153
-
1154
- If not available, an empty string is returned.
1155
-
1156
- """
1157
- return _sys_version ()[3 ]
1158
-
1159
- def python_build ():
1160
-
1161
- """ Returns a tuple (buildno, builddate) stating the Python
1162
- build number and date as strings.
1163
-
1164
- """
1165
- return _sys_version ()[4 :6 ]
1166
-
1167
- def python_compiler ():
1168
-
1169
- """ Returns a string identifying the compiler used for compiling
1170
- Python.
1171
-
1172
- """
1173
- return _sys_version ()[6 ]
1092
+ return tuple (python_version ().split ('.' ))
1174
1093
1175
1094
### The Opus Magnum of platform strings :-)
1176
1095
0 commit comments