Skip to content

Commit 6f4437c

Browse files
committed
Change version to RustPython
1 parent 12f4004 commit 6f4437c

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Lib/platform.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,11 @@ def _syscmd_uname(option, default=''):
604604

605605
""" Interface to the system's uname command.
606606
"""
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
610612

611613
import subprocess
612614
try:
@@ -967,6 +969,14 @@ def processor():
967969
r'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
968970
r'\[PyPy [^\]]+\]?')
969971

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+
970980
_sys_version_cache = {}
971981

972982
def _sys_version(sys_version=None):
@@ -1039,6 +1049,16 @@ def _sys_version(sys_version=None):
10391049
version, buildno, builddate, buildtime = match.groups()
10401050
compiler = ""
10411051

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+
10421062
else:
10431063
# CPython
10441064
match = _sys_version_parser.match(sys_version)

vm/src/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::time::{Duration, UNIX_EPOCH};
2323

2424
pub fn get_version() -> String {
2525
format!(
26-
"{:.80} ({:.80}) {:.80}",
26+
"RustPython {:.80} ({:.80}) {:.80}",
2727
get_version_number(),
2828
get_build_info(),
2929
get_compiler()

0 commit comments

Comments
 (0)