mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Change version to RustPython
This commit is contained in:
1 parent
12f400483d
commit
6f4437c592
2 files changed
+24
-4
No files matched your search
Vendored
+23
-3
@@ -604,9 +604,11 @@ def _syscmd_uname(option, default=''):
|
||||
|
||||
""" Interface to the system's uname command.
|
||||
"""
|
||||
if sys.platform in ('dos', 'win32', 'win16'):
|
||||
# XXX Others too ?
|
||||
return default
|
||||
# TODO: fix RustPython
|
||||
return default
|
||||
# if sys.platform in ('dos', 'win32', 'win16'):
|
||||
# # XXX Others too ?
|
||||
# return default
|
||||
|
||||
import subprocess
|
||||
try:
|
||||
@@ -967,6 +969,14 @@ _pypy_sys_version_parser = re.compile(
|
||||
r'\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
|
||||
r'\[PyPy [^\]]+\]?')
|
||||
|
||||
_rustpython_sys_version_parser = re.compile(
|
||||
r'RustPython '
|
||||
r'([\w.+]+)\s*' # "version<space>"
|
||||
r'\(#?([^,]+)' # "(#buildno"
|
||||
r'(?:,\s*([\w ]*)' # ", builddate"
|
||||
r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)<space>"
|
||||
r'\[([^\]]+)\]?', re.ASCII) # "[compiler]"
|
||||
|
||||
_sys_version_cache = {}
|
||||
|
||||
def _sys_version(sys_version=None):
|
||||
@@ -1039,6 +1049,16 @@ def _sys_version(sys_version=None):
|
||||
version, buildno, builddate, buildtime = match.groups()
|
||||
compiler = ""
|
||||
|
||||
elif "RustPython" in sys_version:
|
||||
# RustPython
|
||||
name = "RustPython"
|
||||
match = _rustpython_sys_version_parser.match(sys_version)
|
||||
if match is None:
|
||||
raise ValueError("failed to parse RustPython sys.version: %s" %
|
||||
repr(sys_version))
|
||||
version, buildno, builddate, buildtime, compiler = \
|
||||
match.groups()
|
||||
|
||||
else:
|
||||
# CPython
|
||||
match = _sys_version_parser.match(sys_version)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ use std::time::{Duration, UNIX_EPOCH};
|
||||
|
||||
pub fn get_version() -> String {
|
||||
format!(
|
||||
"{:.80} ({:.80}) {:.80}",
|
||||
"RustPython {:.80} ({:.80}) {:.80}",
|
||||
get_version_number(),
|
||||
get_build_info(),
|
||||
get_compiler()
|
||||
|
||||
Reference in new issue
Block a user