Skip to content

Commit

Permalink
[bin/oil] Fix the interpreter reported by --version.
Browse files Browse the repository at this point in the history
This broke when we removed _OVM_IS_BUNDLE from the environment.  Instead
we now check for the absence of sys.executable.
  • Loading branch information
Andy Chu committed Jan 30, 2019
1 parent dbb8507 commit 9774f2e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions Python-2.7.13/Python/sysmodule.c
Expand Up @@ -1448,12 +1448,7 @@ _PySys_Init(void)
SET_SYS_FROM_STRING("platform",
PyString_FromString(Py_GetPlatform()));
/* getpath.c was removed */
#ifdef OVM_MAIN
/* 'import platform' uses sys.executable for a default arg to libc_ver().
* Stub it out with a dummy. */
SET_SYS_FROM_STRING("executable",
PyString_FromString("OVM_DUMMY_STRING"));
#else
#ifndef OVM_MAIN
SET_SYS_FROM_STRING("executable",
PyString_FromString(Py_GetProgramFullPath()));
#endif
Expand Down
4 changes: 2 additions & 2 deletions core/util.py
Expand Up @@ -271,8 +271,8 @@ def ShowAppVersion(app_name):
assert py_compiler.endswith(']'), py_compiler
py_compiler = py_compiler[1:-1]

# This environment variable set in C code.
py_impl = 'OVM' if posix.environ.get('_OVM_IS_BUNDLE') else 'CPython'
# We removed sys.executable from sysmodule.c.
py_impl = 'CPython' if hasattr(sys, 'executable') else 'OVM'

# What C functions do these come from?
print('%s version %s' % (app_name, version))
Expand Down

0 comments on commit 9774f2e

Please sign in to comment.