[pypy-commit] pypy py3.5: Set up sys.*prefix attributes for applevel tests

rlamy pypy.commits at gmail.com
Tue Oct 11 13:05:30 EDT 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r87715:dd35ec57b9ef
Date: 2016-10-11 18:04 +0100
http://bitbucket.org/pypy/pypy/changeset/dd35ec57b9ef/

Log:	Set up sys.*prefix attributes for applevel tests

diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -154,6 +154,15 @@
             from pypy.module.sys.interp_encoding import base_encoding
             self.filesystemencoding = base_encoding
 
+            # Set up sys.prefix and friends, like app_main.py would do
+            # We somewhat arbitrarily use the repo's root dir as sys.prefix
+            from pypy import pypydir
+            import os
+            rootdir = os.path.dirname(pypydir)
+            for attr in ['prefix', 'exec_prefix', 'base_prefix', 'base_exec_prefix']:
+                space.setitem(self.w_dict, space.wrap(attr), space.wrap(rootdir))
+
+
     def flush_std_files(self, space):
         w_stdout = space.sys.getdictvalue(space, 'stdout')
         w_stderr = space.sys.getdictvalue(space, 'stderr')


More information about the pypy-commit mailing list