[pypy-svn] r75556 - in pypy/trunk: lib-python lib-python/modified-2.5.2 lib-python/modified-2.5.2/distutils lib-python/modified-2.5.2/distutils/command lib-python/modified-2.5.2/test lib_pypy lib_pypy/_ctypes lib_pypy/ctypes_config_cache lib_pypy/ctypes_config_cache/test lib_pypy/distributed lib_pypy/distributed/demo lib_pypy/pypy_test lib_pypy/xml lib_pypy/xml/dom lib_pypy/xml/etree lib_pypy/xml/parsers lib_pypy/xml/sax pypy pypy/annotation pypy/annotation/test pypy/bin pypy/config pypy/doc pypy/doc/config pypy/interpreter pypy/interpreter/test pypy/jit/backend pypy/jit/backend/x86 pypy/jit/backend/x86/tool pypy/jit/tl pypy/jit/tl/spli pypy/jit/tool pypy/module pypy/module/__builtin__/test pypy/module/_codecs/test pypy/module/_sre/test pypy/module/cpyext/test pypy/module/sys pypy/module/sys/test pypy/module/test_lib_pypy pypy/module/test_lib_pypy/ctypes_tests pypy/module/test_lib_pypy/test_distributed pypy/objspace/flow pypy/rlib pypy/rlib/parsing/test pypy/rlib/rsdl/test pypy/rpython/lltypesystem pypy/rpython/lltypesystem/test pypy/rpython/memory pypy/rpython/microbench pypy/rpython/ootypesystem pypy/tool pypy/tool/algo pypy/tool/algo/test pypy/tool/pytest pypy/tool/release pypy/tool/release/test pypy/tool/test pypy/translator pypy/translator/benchmark pypy/translator/c pypy/translator/c/gcc pypy/translator/c/test pypy/translator/cli/test pypy/translator/goal pypy/translator/goal/test2 pypy/translator/microbench/pybench pypy/translator/oosupport pypy/translator/sandbox pypy/translator/sandbox/test pypy/translator/test pypy/translator/tool site-packages
antocuni at codespeak.net
antocuni at codespeak.net
Thu Jun 24 12:44:27 CEST 2010
Author: antocuni
Date: Thu Jun 24 12:44:22 2010
New Revision: 75556
Added:
pypy/trunk/lib_pypy/ (props changed)
- copied from r75555, pypy/branch/sys-prefix/lib_pypy/
pypy/trunk/pypy/module/conftest.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/module/conftest.py
pypy/trunk/pypy/module/sys/test/test_initialpath.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/module/sys/test/test_initialpath.py
pypy/trunk/pypy/module/test_lib_pypy/ (props changed)
- copied from r75555, pypy/branch/sys-prefix/pypy/module/test_lib_pypy/
pypy/trunk/pypy/tool/identity_dict.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/tool/identity_dict.py
pypy/trunk/pypy/tool/lib_pypy.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/tool/lib_pypy.py
pypy/trunk/pypy/tool/test/test_identitydict.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/tool/test/test_identitydict.py
pypy/trunk/pypy/tool/test/test_lib_pypy.py
- copied unchanged from r75555, pypy/branch/sys-prefix/pypy/tool/test/test_lib_pypy.py
pypy/trunk/site-packages/
- copied from r75555, pypy/branch/sys-prefix/site-packages/
Removed:
pypy/trunk/pypy/jit/tl/run_all_tests.py
Modified:
pypy/trunk/lib-python/ (props changed)
pypy/trunk/lib-python/conftest.py
pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py
pypy/trunk/lib-python/modified-2.5.2/distutils/command/build_ext.py
pypy/trunk/lib-python/modified-2.5.2/distutils/command/install.py
pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig.py
pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
pypy/trunk/lib-python/modified-2.5.2/site.py
pypy/trunk/lib-python/modified-2.5.2/test/regrtest.py
pypy/trunk/lib-python/modified-2.5.2/test/test_doctest.py
pypy/trunk/lib-python/modified-2.5.2/test/test_sys.py
pypy/trunk/lib_pypy/_ctypes/ (props changed)
pypy/trunk/lib_pypy/ctypes_config_cache/ (props changed)
pypy/trunk/lib_pypy/ctypes_config_cache/test/ (props changed)
pypy/trunk/lib_pypy/distributed/ (props changed)
pypy/trunk/lib_pypy/distributed/demo/ (props changed)
pypy/trunk/lib_pypy/pypy_test/ (props changed)
pypy/trunk/lib_pypy/xml/ (props changed)
pypy/trunk/lib_pypy/xml/dom/ (props changed)
pypy/trunk/lib_pypy/xml/etree/ (props changed)
pypy/trunk/lib_pypy/xml/parsers/ (props changed)
pypy/trunk/lib_pypy/xml/sax/ (props changed)
pypy/trunk/pypy/annotation/bookkeeper.py
pypy/trunk/pypy/annotation/test/autopath.py
pypy/trunk/pypy/bin/autopath.py
pypy/trunk/pypy/bin/py.py
pypy/trunk/pypy/config/autopath.py
pypy/trunk/pypy/config/pypyoption.py
pypy/trunk/pypy/conftest.py
pypy/trunk/pypy/doc/_ref.txt
pypy/trunk/pypy/doc/coding-guide.txt
pypy/trunk/pypy/doc/config/autopath.py
pypy/trunk/pypy/doc/config/objspace.usemodules.md5.txt
pypy/trunk/pypy/doc/config/objspace.usemodules.sha.txt
pypy/trunk/pypy/doc/config/objspace.usemodules.struct.txt
pypy/trunk/pypy/doc/cpython_differences.txt
pypy/trunk/pypy/doc/ctypes-implementation.txt
pypy/trunk/pypy/doc/docindex.txt
pypy/trunk/pypy/doc/getting-started-python.txt
pypy/trunk/pypy/doc/maemo.txt
pypy/trunk/pypy/doc/objspace-proxies.txt
pypy/trunk/pypy/doc/sandbox.txt
pypy/trunk/pypy/doc/stackless.txt
pypy/trunk/pypy/interpreter/baseobjspace.py
pypy/trunk/pypy/interpreter/test/test_module.py
pypy/trunk/pypy/interpreter/test/test_objspace.py
pypy/trunk/pypy/jit/backend/autopath.py
pypy/trunk/pypy/jit/backend/x86/autopath.py
pypy/trunk/pypy/jit/backend/x86/tool/autopath.py
pypy/trunk/pypy/jit/tl/autopath.py
pypy/trunk/pypy/jit/tl/spli/autopath.py
pypy/trunk/pypy/jit/tool/autopath.py
pypy/trunk/pypy/module/__builtin__/test/autopath.py
pypy/trunk/pypy/module/_codecs/test/autopath.py
pypy/trunk/pypy/module/_sre/test/autopath.py
pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
pypy/trunk/pypy/module/sys/__init__.py
pypy/trunk/pypy/module/sys/state.py
pypy/trunk/pypy/module/sys/test/autopath.py
pypy/trunk/pypy/module/sys/version.py
pypy/trunk/pypy/module/test_lib_pypy/ctypes_tests/ (props changed)
pypy/trunk/pypy/module/test_lib_pypy/test_distributed/ (props changed)
pypy/trunk/pypy/objspace/flow/model.py
pypy/trunk/pypy/pytest-A.cfg
pypy/trunk/pypy/rlib/parsing/test/autopath.py
pypy/trunk/pypy/rlib/rmd5.py
pypy/trunk/pypy/rlib/rsdl/test/autopath.py
pypy/trunk/pypy/rlib/rsha.py
pypy/trunk/pypy/rlib/rzipfile.py
pypy/trunk/pypy/rpython/lltypesystem/lltype.py
pypy/trunk/pypy/rpython/lltypesystem/rclass.py
pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py
pypy/trunk/pypy/rpython/memory/gctypelayout.py
pypy/trunk/pypy/rpython/microbench/autopath.py
pypy/trunk/pypy/rpython/ootypesystem/rclass.py
pypy/trunk/pypy/tool/algo/graphlib.py
pypy/trunk/pypy/tool/algo/test/autopath.py
pypy/trunk/pypy/tool/autopath.py
pypy/trunk/pypy/tool/compat.py
pypy/trunk/pypy/tool/pytest/autopath.py
pypy/trunk/pypy/tool/pytest/confpath.py
pypy/trunk/pypy/tool/release/package.py
pypy/trunk/pypy/tool/release/test/test_package.py
pypy/trunk/pypy/tool/stdlib___future__.py
pypy/trunk/pypy/tool/stdlib_opcode.py
pypy/trunk/pypy/tool/test/autopath.py
pypy/trunk/pypy/translator/autopath.py
pypy/trunk/pypy/translator/benchmark/autopath.py
pypy/trunk/pypy/translator/c/autopath.py
pypy/trunk/pypy/translator/c/database.py
pypy/trunk/pypy/translator/c/funcgen.py
pypy/trunk/pypy/translator/c/gcc/autopath.py
pypy/trunk/pypy/translator/c/test/autopath.py
pypy/trunk/pypy/translator/cli/test/autopath.py
pypy/trunk/pypy/translator/geninterplevel.py
pypy/trunk/pypy/translator/goal/app_main.py
pypy/trunk/pypy/translator/goal/autopath.py
pypy/trunk/pypy/translator/goal/targetpypystandalone.py
pypy/trunk/pypy/translator/goal/test2/autopath.py
pypy/trunk/pypy/translator/goal/test2/test_app_main.py
pypy/trunk/pypy/translator/microbench/pybench/autopath.py
pypy/trunk/pypy/translator/oosupport/function.py
pypy/trunk/pypy/translator/sandbox/autopath.py
pypy/trunk/pypy/translator/sandbox/pypy_interact.py
pypy/trunk/pypy/translator/sandbox/sandlib.py
pypy/trunk/pypy/translator/sandbox/test/autopath.py
pypy/trunk/pypy/translator/sandbox/test/test_pypy_interact.py
pypy/trunk/pypy/translator/test/autopath.py
pypy/trunk/pypy/translator/tool/autopath.py
pypy/trunk/pypy/translator/tool/lltracker.py
Log:
merge the sys-prefix branch.
The most important changes are:
1) trunk/pypy/lib has been moved to trunk/lib_pypy: the code there is really
pure python and should not depend on pypy. However, some of the tests existed
as AppLevel tests: since they need to be run inside the pypy/ package, they
have been moved to pypy/module/test_lib_pypy. Also, a custom conftest makes
py.test module/test_lib_pypy also run the tests in ../lib_pypy
2) sys.pypy_prefix has been removed. Instead, sys.prefix and sys.exec_prefix
(which are always the same) are added. The prefix is searched at runtime,
starting from the directory where the pypy executable resides and walking up
until it finds the expected directoris (lib-python and lib_pypy)
The layout of the svn checkout has been designed in a way that it will be
possibile to run virtualenv -p translator/goal/pypy-c, without needing to
install pypy system-wide
Modified: pypy/trunk/lib-python/conftest.py
==============================================================================
--- pypy/trunk/lib-python/conftest.py (original)
+++ pypy/trunk/lib-python/conftest.py Thu Jun 24 12:44:22 2010
@@ -20,8 +20,8 @@
regrtestdir, modregrtestdir, testresultdir
pytest_plugins = "resultlog",
-rsyncdirs = ['.', '../pypy']
-
+rsyncdirs = ['.', '../pypy/']
+
#
# Interfacing/Integrating with py.test's collection process
#
Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/cmd.py Thu Jun 24 12:44:22 2010
@@ -18,7 +18,8 @@
# return a list of 'site' dirs for easy_install
from pkg_resources import normalize_path
sitedirs = filter(None,os.environ.get('PYTHONPATH','').split(os.pathsep))
- sitedirs.append(os.path.join(sys.pypy_prefix, 'site-packages'))
+ pypylib = 'pypy%d.%d' % sys.pypy_version_info[:2]
+ sitedirs.append(os.path.join(sys.prefix, 'lib', pypylib, 'site-packages'))
sitedirs = map(normalize_path, sitedirs)
return sitedirs
Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/command/build_ext.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/command/build_ext.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/command/build_ext.py Thu Jun 24 12:44:22 2010
@@ -167,7 +167,7 @@
# for Release and Debug builds.
# also Python's library directory must be appended to library_dirs
if os.name == 'nt':
- self.library_dirs.append(os.path.join(sys.pypy_prefix, 'pypy', '_interfaces'))
+ self.library_dirs.append(os.path.join(sys.prefix, 'pypy', '_interfaces'))
if self.debug:
self.build_temp = os.path.join(self.build_temp, "Debug")
else:
Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/command/install.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/command/install.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/command/install.py Thu Jun 24 12:44:22 2010
@@ -67,8 +67,8 @@
'data' : '$base',
},
'pypy': {
- 'purelib': '$base/site-packages',
- 'platlib': '$base/site-packages',
+ 'purelib': '$base/lib/pypy$pypy_version_short/site-packages',
+ 'platlib': '$base/lib/pypy$pypy_version_short/site-packages',
'headers': '$base/include',
'scripts': '$base/bin',
'data' : '$base',
@@ -283,6 +283,7 @@
'dist_fullname': self.distribution.get_fullname(),
'py_version': py_version,
'py_version_short': py_version[0:3],
+ 'pypy_version_short': '%d.%d' % sys.pypy_version_info[:2],
'sys_prefix': prefix,
'prefix': prefix,
'sys_exec_prefix': exec_prefix,
@@ -391,13 +392,9 @@
if self.exec_prefix is not None:
raise DistutilsOptionError, \
"must not supply exec-prefix without prefix"
-
- if hasattr(sys, 'pypy_prefix'):
- self.prefix = os.path.normpath(sys.pypy_prefix)
- self.exec_prefix = self.prefix
- else:
- self.prefix = os.path.normpath(sys.prefix)
- self.exec_prefix = os.path.normpath(sys.exec_prefix)
+
+ self.prefix = os.path.normpath(sys.prefix)
+ self.exec_prefix = os.path.normpath(sys.exec_prefix)
else:
if self.exec_prefix is None:
@@ -417,10 +414,7 @@
self.select_scheme("unix_home")
else:
if self.prefix is None:
- if hasattr(sys, 'pypy_prefix'):
- self.prefix = os.path.normpath(sys.pypy_prefix)
- else:
- self.prefix = os.path.normpath(sys.prefix)
+ self.prefix = os.path.normpath(sys.prefix)
self.install_base = self.install_platbase = self.prefix
try:
@@ -434,7 +428,7 @@
def select_scheme (self, name):
# it's the caller's problem if they supply a bad name!
- if hasattr(sys, 'pypy_prefix'):
+ if hasattr(sys, 'pypy_version_info'):
name = 'pypy'
scheme = INSTALL_SCHEMES[name]
for key in SCHEME_KEYS:
Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig.py Thu Jun 24 12:44:22 2010
@@ -19,5 +19,7 @@
if '__pypy__' in sys.builtin_module_names:
from distutils.sysconfig_pypy import *
+ from distutils.sysconfig_pypy import _config_vars # needed by setuptools
else:
from distutils.sysconfig_cpython import *
+ from distutils.sysconfig_pypy import _config_vars # needed by setuptools
Modified: pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/distutils/sysconfig_pypy.py Thu Jun 24 12:44:22 2010
@@ -7,7 +7,7 @@
from distutils.errors import DistutilsPlatformError
-PYPY_PREFIX = os.path.normpath(sys.pypy_prefix)
+PREFIX = os.path.normpath(sys.prefix)
python_build = False
@@ -17,8 +17,8 @@
if os.path.exists(cand):
return cand
if plat_specific:
- return j(sys.pypy_prefix, "pypy", "_interfaces")
- return j(sys.pypy_prefix, 'pypy', 'module', 'cpyext', 'include')
+ return j(sys.prefix, "pypy", "_interfaces")
+ return j(sys.prefix, 'pypy', 'module', 'cpyext', 'include')
def get_python_version():
"""Return a string containing the major and minor Python version,
@@ -46,8 +46,9 @@
raise DistutilsPlatformError(
"calls to get_python_lib(standard_lib=1) cannot succeed")
if prefix is None:
- prefix = PYPY_PREFIX
- return os.path.join(prefix, "site-packages")
+ prefix = PREFIX
+ pypylib = 'pypy%d.%d' % sys.pypy_version_info[:2]
+ return os.path.join(prefix, 'lib', pypylib, 'site-packages')
_config_vars = None
Modified: pypy/trunk/lib-python/modified-2.5.2/site.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/site.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/site.py Thu Jun 24 12:44:22 2010
@@ -175,8 +175,9 @@
def addsitepackages(known_paths):
"""Add site-packages to sys.path, in a PyPy-specific way."""
- if hasattr(sys, 'pypy_prefix'):
- sitedir = os.path.join(sys.pypy_prefix, "site-packages")
+ if hasattr(sys, 'pypy_version_info'):
+ pypylib = 'pypy%d.%d' % sys.pypy_version_info[:2]
+ sitedir = os.path.join(sys.prefix, 'lib', pypylib, 'site-packages')
if os.path.isdir(sitedir):
addsitedir(sitedir, known_paths)
return None
Modified: pypy/trunk/lib-python/modified-2.5.2/test/regrtest.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/regrtest.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/regrtest.py Thu Jun 24 12:44:22 2010
@@ -348,11 +348,8 @@
random.shuffle(tests)
if trace:
import trace
- if hasattr(sys, 'prefix'):
- ignoredirs = [sys.prefix, sys.exec_prefix]
- else:
- ignoredirs = [sys.pypy_prefix] # PyPy only
- tracer = trace.Trace(ignoredirs=ignoredirs, trace=False, count=True)
+ tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
+ trace=False, count=True)
test_support.verbose = verbose # Tell tests to be moderately quiet
test_support.use_resources = use_resources
save_modules = sys.modules.keys()
Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_doctest.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_doctest.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_doctest.py Thu Jun 24 12:44:22 2010
@@ -2422,11 +2422,8 @@
import trace, sys, re, StringIO
def test_coverage(coverdir):
- if hasattr(sys, 'prefix'):
- ignoredirs = [sys.prefix, sys.exec_prefix]
- else:
- ignoredirs = [sys.pypy_prefix] # PyPy only
- tracer = trace.Trace(ignoredirs=ignoredirs, trace=0, count=1)
+ tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
+ trace=0, count=1)
tracer.run('reload(doctest); test_main()')
r = tracer.results()
print 'Writing coverage results...'
Modified: pypy/trunk/lib-python/modified-2.5.2/test/test_sys.py
==============================================================================
--- pypy/trunk/lib-python/modified-2.5.2/test/test_sys.py (original)
+++ pypy/trunk/lib-python/modified-2.5.2/test/test_sys.py Thu Jun 24 12:44:22 2010
@@ -334,11 +334,8 @@
if test.test_support.have_unicode:
self.assert_(isinstance(sys.maxunicode, int))
self.assert_(isinstance(sys.platform, basestring))
- if hasattr(sys, 'prefix'):
- self.assert_(isinstance(sys.prefix, basestring))
- self.assert_(isinstance(sys.exec_prefix, basestring))
- else:
- self.assert_(isinstance(sys.pypy_prefix, basestring)) # PyPy only
+ self.assert_(isinstance(sys.prefix, basestring))
+ self.assert_(isinstance(sys.exec_prefix, basestring))
self.assert_(isinstance(sys.version, basestring))
vi = sys.version_info
self.assert_(isinstance(vi, tuple))
Modified: pypy/trunk/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/trunk/pypy/annotation/bookkeeper.py (original)
+++ pypy/trunk/pypy/annotation/bookkeeper.py Thu Jun 24 12:44:22 2010
@@ -22,7 +22,7 @@
from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rpython.ootypesystem import ootype
from pypy.rpython import extregistry
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
class Stats:
Modified: pypy/trunk/pypy/annotation/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/annotation/test/autopath.py (original)
+++ pypy/trunk/pypy/annotation/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/bin/autopath.py
==============================================================================
--- pypy/trunk/pypy/bin/autopath.py (original)
+++ pypy/trunk/pypy/bin/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/bin/py.py
==============================================================================
--- pypy/trunk/pypy/bin/py.py (original)
+++ pypy/trunk/pypy/bin/py.py Thu Jun 24 12:44:22 2010
@@ -11,6 +11,7 @@
except ImportError:
pass
+import pypy
from pypy.tool import option
from optparse import make_option
from pypy.interpreter import main, interactive, error, gateway
@@ -84,6 +85,14 @@
space.setitem(space.sys.w_dict, space.wrap('executable'),
space.wrap(argv[0]))
+ # call pypy_initial_path: the side-effect is that it sets sys.prefix and
+ # sys.exec_prefix
+ srcdir = os.path.dirname(os.path.dirname(pypy.__file__))
+ space.appexec([space.wrap(srcdir)], """(srcdir):
+ import sys
+ sys.pypy_initial_path(srcdir)
+ """)
+
# set warning control options (if any)
warn_arg = interactiveconfig.warn
if warn_arg is not None:
Modified: pypy/trunk/pypy/config/autopath.py
==============================================================================
--- pypy/trunk/pypy/config/autopath.py (original)
+++ pypy/trunk/pypy/config/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/config/pypyoption.py
==============================================================================
--- pypy/trunk/pypy/config/pypyoption.py (original)
+++ pypy/trunk/pypy/config/pypyoption.py Thu Jun 24 12:44:22 2010
@@ -8,7 +8,8 @@
modulepath = py.path.local(__file__).dirpath().dirpath().join("module")
all_modules = [p.basename for p in modulepath.listdir()
if p.check(dir=True, dotfile=False)
- and p.join('__init__.py').check()]
+ and p.join('__init__.py').check()
+ and not p.basename.startswith('test')]
essential_modules = dict.fromkeys(
["exceptions", "_file", "sys", "__builtin__", "posix"]
Modified: pypy/trunk/pypy/conftest.py
==============================================================================
--- pypy/trunk/pypy/conftest.py (original)
+++ pypy/trunk/pypy/conftest.py Thu Jun 24 12:44:22 2010
@@ -10,11 +10,9 @@
# pytest settings
pytest_plugins = "resultlog",
-rsyncdirs = ['.', '../lib-python', '../demo']
+rsyncdirs = ['.', '../lib-python', '../lib_pypy', '../demo']
rsyncignore = ['_cache']
-collect_ignore = ['./lib/py']
-
# PyPy's command line extra options (these are added
# to py.test's standard options)
#
@@ -220,8 +218,10 @@
def accept_regular_test(self):
if option.runappdirect:
- # only collect regular tests if we are in an 'app_test' directory
- return "app_test" in self.listnames()
+ # only collect regular tests if we are in an 'app_test' directory,
+ # or in test_lib_pypy
+ names = self.listnames()
+ return "app_test" in names or "test_lib_pypy" in names
else:
return True
@@ -232,7 +232,7 @@
return True
return False
- def classnamefilter(self, name):
+ def classnamefilter(self, name):
if name.startswith('Test'):
return self.accept_regular_test()
if name.startswith('AppTest'):
Modified: pypy/trunk/pypy/doc/_ref.txt
==============================================================================
--- pypy/trunk/pypy/doc/_ref.txt (original)
+++ pypy/trunk/pypy/doc/_ref.txt Thu Jun 24 12:44:22 2010
@@ -46,11 +46,10 @@
.. _`pypy/interpreter/astcompiler/ast.py`: ../../pypy/interpreter/astcompiler/ast.py
.. _`pypy/interpreter/typedef.py`: ../../pypy/interpreter/typedef.py
.. _`lib/`:
-.. _`pypy/lib/`: ../../pypy/lib
-.. _`lib/app_test/`: ../../pypy/lib/app_test
-.. _`lib/distributed/`: ../../pypy/lib/distributed
-.. _`pypy/lib/stackless.py`: ../../pypy/lib/stackless.py
-.. _`pypy/lib/test2`: ../../pypy/lib/test2
+.. _`lib_pypy/`: ../../lib_pypy
+.. _`lib/distributed/`: ../../lib_pypy/distributed
+.. _`lib_pypy/stackless.py`: ../../lib_pypy/stackless.py
+.. _`lib_pypy/pypy_test/`: ../../lib_pypy/pypy_test
.. _`module/`:
.. _`pypy/module`:
.. _`pypy/module/`: ../../pypy/module
Modified: pypy/trunk/pypy/doc/coding-guide.txt
==============================================================================
--- pypy/trunk/pypy/doc/coding-guide.txt (original)
+++ pypy/trunk/pypy/doc/coding-guide.txt Thu Jun 24 12:44:22 2010
@@ -631,7 +631,7 @@
because they rely on implementation details of CPython.
If we don't just modify an original CPython module but need to rewrite
-it from scratch we put it into `pypy/lib/`_ as a pure application level
+it from scratch we put it into `lib_pypy/`_ as a pure application level
module.
When we need access to interpreter-level objects we put the module into
@@ -653,7 +653,7 @@
>>>> import operator
>>>> operator.__file__
- '/home/hpk/pypy-dist/pypy/lib/operator.py'
+ '/home/hpk/pypy-dist/lib_pypy/operator.py'
>>>> import opcode
>>>> opcode.__file__
@@ -682,7 +682,7 @@
list of directories, specified in the ``PYTHONPATH`` environment
variable.
-*pypy/lib/*
+*lib_pypy/*
contains pure Python reimplementation of modules.
@@ -794,14 +794,14 @@
--withoutmod-mymodule (the later being the default)) for py.py and
translate.py.
-Testing modules in ``pypy/lib``
+Testing modules in ``lib_pypy/``
--------------------------------
-You can go to the `pypy/lib/test2`_ directory and invoke the testing tool
-("py.test" or "python ../../test_all.py") to run tests against the
-pypy/lib hierarchy. Note, that tests in `pypy/lib/test2`_ are allowed
+You can go to the `lib_pypy/pypy_test/`_ directory and invoke the testing tool
+("py.test" or "python ../../pypy/test_all.py") to run tests against the
+lib_pypy hierarchy. Note, that tests in `lib_pypy/pypy_test/`_ are allowed
and encouraged to let their tests run at interpreter level although
-`pypy/lib/`_ modules eventually live at PyPy's application level.
+`lib_pypy/`_ modules eventually live at PyPy's application level.
This allows us to quickly test our python-coded reimplementations
against CPython.
Modified: pypy/trunk/pypy/doc/config/autopath.py
==============================================================================
--- pypy/trunk/pypy/doc/config/autopath.py (original)
+++ pypy/trunk/pypy/doc/config/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/doc/config/objspace.usemodules.md5.txt
==============================================================================
--- pypy/trunk/pypy/doc/config/objspace.usemodules.md5.txt (original)
+++ pypy/trunk/pypy/doc/config/objspace.usemodules.md5.txt Thu Jun 24 12:44:22 2010
@@ -1,5 +1,5 @@
Use the built-in 'md5' module.
This module is expected to be working and is included by default.
-There is also a pure Python version in pypy/lib which is used
+There is also a pure Python version in lib_pypy which is used
if the built-in is disabled, but it is several orders of magnitude
slower.
Modified: pypy/trunk/pypy/doc/config/objspace.usemodules.sha.txt
==============================================================================
--- pypy/trunk/pypy/doc/config/objspace.usemodules.sha.txt (original)
+++ pypy/trunk/pypy/doc/config/objspace.usemodules.sha.txt Thu Jun 24 12:44:22 2010
@@ -1,5 +1,5 @@
Use the built-in 'sha' module.
This module is expected to be working and is included by default.
-There is also a pure Python version in pypy/lib which is used
+There is also a pure Python version in lib_pypy which is used
if the built-in is disabled, but it is several orders of magnitude
slower.
Modified: pypy/trunk/pypy/doc/config/objspace.usemodules.struct.txt
==============================================================================
--- pypy/trunk/pypy/doc/config/objspace.usemodules.struct.txt (original)
+++ pypy/trunk/pypy/doc/config/objspace.usemodules.struct.txt Thu Jun 24 12:44:22 2010
@@ -1,5 +1,5 @@
Use the built-in 'struct' module.
This module is expected to be working and is included by default.
-There is also a pure Python version in pypy/lib which is used
+There is also a pure Python version in lib_pypy which is used
if the built-in is disabled, but it is several orders of magnitude
slower.
Modified: pypy/trunk/pypy/doc/cpython_differences.txt
==============================================================================
--- pypy/trunk/pypy/doc/cpython_differences.txt (original)
+++ pypy/trunk/pypy/doc/cpython_differences.txt Thu Jun 24 12:44:22 2010
@@ -71,7 +71,7 @@
_stackless
* Supported by being rewritten in pure Python (possibly using ``ctypes``):
- see the `pypy/lib/`_ directory. Examples of modules that we
+ see the `lib_pypy/`_ directory. Examples of modules that we
support this way: ``ctypes``, ``array``, ``cPickle``,
``cStringIO``, ``cmath``, ``dbm`` (?), ``datetime``, ``binascii``...
Note that some modules are both in there and in the list above;
@@ -79,7 +79,7 @@
at translation time).
The extension modules (i.e. modules written in C, in the standard CPython)
-that are neither mentioned above nor in `pypy/lib/`_ are not available in PyPy.
+that are neither mentioned above nor in `lib_pypy/`_ are not available in PyPy.
.. the nonstandard modules are listed below...
.. _`__pypy__`: __pypy__-module.html
Modified: pypy/trunk/pypy/doc/ctypes-implementation.txt
==============================================================================
--- pypy/trunk/pypy/doc/ctypes-implementation.txt (original)
+++ pypy/trunk/pypy/doc/ctypes-implementation.txt Thu Jun 24 12:44:22 2010
@@ -48,9 +48,9 @@
High-level parts
=================
-The reused ``ctypes`` package lives in ``pypy/lib/ctypes``. ``_ctypes``
+The reused ``ctypes`` package lives in ``lib_pypy/ctypes``. ``_ctypes``
implementing the same interface as ``_ctypes`` in CPython is in
-``pypy/lib/_ctypes``.
+``lib_pypy/_ctypes``.
Discussion and limitations
=============================
@@ -123,8 +123,8 @@
To run the tests then::
- $ cd ../.. # back to pypy/
- $ ./translator/goal/pypy-c test_all.py lib/app_test/ctypes_tests
+ $ cd ../../.. # back to pypy-trunk
+ $ ./pypy/translator/goal/pypy-c pypy/test_all.py lib/pypy1.2/lib_pypy/pypy_test/ctypes_tests
There should be 36 skipped tests and all other tests should pass.
Modified: pypy/trunk/pypy/doc/docindex.txt
==============================================================================
--- pypy/trunk/pypy/doc/docindex.txt (original)
+++ pypy/trunk/pypy/doc/docindex.txt Thu Jun 24 12:44:22 2010
@@ -207,13 +207,6 @@
`interpreter/astcompiler/`_ interpreter-level bytecode compiler, via an AST
representation
-`lib/`_ PyPy's wholesale reimplementations of CPython modules_
- and experimental new application-level modules
-
-`lib/app_test/`_ tests for the reimplementations, running on top of CPython
-
-`lib/distributed/`_ distributed execution prototype, based on `transparent proxies`_
-
`module/`_ contains `mixed modules`_ implementing core modules with
both application and interpreter level code.
Not all are finished and working. Use the ``--withmod-xxx``
Modified: pypy/trunk/pypy/doc/getting-started-python.txt
==============================================================================
--- pypy/trunk/pypy/doc/getting-started-python.txt (original)
+++ pypy/trunk/pypy/doc/getting-started-python.txt Thu Jun 24 12:44:22 2010
@@ -207,18 +207,18 @@
For installation purposes, note that the executable needs to be able to
find its version of the Python standard library in the following three
directories: ``lib-python/2.5.2``, ``lib-python/modified-2.5.2`` and
-``pypy/lib``. They are located by "looking around" starting from the
+``lib_pypy``. They are located by "looking around" starting from the
directory in which the executable resides. The current logic is to try
to find a ``PREFIX`` from which the directories
``PREFIX/lib-python/2.5.2`` and ``PREFIX/lib-python/modified.2.5.2`` and
-``PREFIX/pypy/lib`` can all be found. The prefixes that are tried are::
+``PREFIX/lib_pypy`` can all be found. The prefixes that are tried are::
.
- ./share/pypy-1.2
+ ./lib/pypy1.2
..
- ../share/pypy-1.2
+ ../lib/pypy1.2
../..
- ../../share/pypy-1.2
+ ../../lib/pypy-1.2
../../..
etc.
Modified: pypy/trunk/pypy/doc/maemo.txt
==============================================================================
--- pypy/trunk/pypy/doc/maemo.txt (original)
+++ pypy/trunk/pypy/doc/maemo.txt Thu Jun 24 12:44:22 2010
@@ -157,11 +157,11 @@
You can just copy your whole pypy-trunk directory over to your mobile
device - however, only these should be needed::
- pypy/lib
- lib-python
+ lib/pypy1.2/lib_pypy
+ lib/pypy1.2/lib-python
pypy/translator/goal/pypy-c
-It is neccessary that the ``pypy-c`` can find a "lib-python" and "pypy/lib" directory
+It is neccessary that the ``pypy-c`` can find a "lib-python" and "lib_pypy" directory
if you want to successfully startup the interpreter on the device.
Start ``pypy-c`` on the device. If you see an error like "setupterm: could not find terminal"
Modified: pypy/trunk/pypy/doc/objspace-proxies.txt
==============================================================================
--- pypy/trunk/pypy/doc/objspace-proxies.txt (original)
+++ pypy/trunk/pypy/doc/objspace-proxies.txt Thu Jun 24 12:44:22 2010
@@ -610,7 +610,7 @@
.. _`proxy_helpers.py`: ../../pypy/objspace/std/proxy_helpers.py
.. _`proxyobject.py`: ../../pypy/objspace/std/proxyobject.py
.. _`transparent.py`: ../../pypy/objspace/std/transparent.py
-.. _`tputil.py`: ../../pypy/lib/tputil.py
+.. _`tputil.py`: ../../lib_pypy/tputil.py
.. [D12.1] `High-Level Backends and Interpreter Feature Prototypes`, PyPy
EU-Report, 2007, http://codespeak.net/pypy/extradoc/eu-report/D12.1_H-L-Backends_and_Feature_Prototypes-2007-03-22.pdf
Modified: pypy/trunk/pypy/doc/sandbox.txt
==============================================================================
--- pypy/trunk/pypy/doc/sandbox.txt (original)
+++ pypy/trunk/pypy/doc/sandbox.txt Thu Jun 24 12:44:22 2010
@@ -72,7 +72,8 @@
should do. I've successfully tried it on the JS interpreter. The
controller is only called "pypy_interact" because it emulates a file
hierarchy that makes pypy-c-sandbox happy - it contains (read-only)
-virtual directories like /bin/lib-python and /bin/pypy/lib and it
+virtual directories like /bin/lib/pypy1.2/lib-python and
+/bin/lib/pypy1.2/lib_pypy and it
pretends that the executable is /bin/pypy-c.
Howto
Modified: pypy/trunk/pypy/doc/stackless.txt
==============================================================================
--- pypy/trunk/pypy/doc/stackless.txt (original)
+++ pypy/trunk/pypy/doc/stackless.txt Thu Jun 24 12:44:22 2010
@@ -181,7 +181,7 @@
website.
Note that Tasklets and Channels are implemented at application-level in
-`pypy/lib/stackless.py`_ on top of coroutines_. You can refer to this
+`lib_pypy/stackless.py`_ on top of coroutines_. You can refer to this
module for more details and API documentation.
The stackless.py code tries to resemble the stackless C code as much
Modified: pypy/trunk/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/trunk/pypy/interpreter/baseobjspace.py (original)
+++ pypy/trunk/pypy/interpreter/baseobjspace.py Thu Jun 24 12:44:22 2010
@@ -385,6 +385,7 @@
def get_builtinmodule_to_install(self):
"""NOT_RPYTHON"""
+ from pypy.tool.lib_pypy import LIB_PYPY
try:
return self._builtinmodule_list
except AttributeError:
@@ -404,9 +405,7 @@
if not self.config.objspace.nofaking:
for modname in self.ALL_BUILTIN_MODULES:
- if not (os.path.exists(
- os.path.join(os.path.dirname(pypy.__file__),
- 'lib', modname+'.py'))):
+ if not LIB_PYPY.join(modname+'.py').check(file=True):
modules.append('faked+'+modname)
self._builtinmodule_list = modules
Modified: pypy/trunk/pypy/interpreter/test/test_module.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_module.py (original)
+++ pypy/trunk/pypy/interpreter/test/test_module.py Thu Jun 24 12:44:22 2010
@@ -54,11 +54,11 @@
r = repr(sys)
assert r == "<module 'sys' (built-in)>"
- import _pypy_interact # known to be in pypy/lib
+ import _pypy_interact # known to be in lib_pypy
r = repr(_pypy_interact)
assert (r.startswith("<module '_pypy_interact' from ") and
- ('pypy/lib/_pypy_interact.py' in r or
- r'pypy\\lib\\_pypy_interact.py' in r.lower()) and
+ ('lib_pypy/_pypy_interact.py' in r or
+ r'lib_pypy\\_interact.py' in r.lower()) and
r.endswith('>'))
nofile = type(_pypy_interact)('nofile', 'foo')
assert repr(nofile) == "<module 'nofile' from ?>"
Modified: pypy/trunk/pypy/interpreter/test/test_objspace.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_objspace.py (original)
+++ pypy/trunk/pypy/interpreter/test/test_objspace.py Thu Jun 24 12:44:22 2010
@@ -259,3 +259,23 @@
def test_sys_import(self):
from pypy.interpreter.main import run_string
run_string('import sys', space=self.space)
+
+ def test_get_builtinmodule_to_install(self):
+ space = self.space
+ try:
+ # force rebuilding with this fake builtin
+ space.ALL_BUILTIN_MODULES.append('this_doesnt_exist')
+ del space._builtinmodule_list
+ mods = space.get_builtinmodule_to_install()
+
+ assert '__pypy__' in mods # real builtin
+ assert 'array' not in mods # in lib_pypy
+ assert 'faked+array' not in mods # in lib_pypy
+ assert 'this_doesnt_exist' not in mods # not in lib_pypy
+ assert 'faked+this_doesnt_exist' in mods # not in lib_pypy, but in
+ # ALL_BUILTIN_MODULES
+ finally:
+ # rebuild the original list
+ space.ALL_BUILTIN_MODULES.pop()
+ del space._builtinmodule_list
+ mods = space.get_builtinmodule_to_install()
Modified: pypy/trunk/pypy/jit/backend/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/autopath.py (original)
+++ pypy/trunk/pypy/jit/backend/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/jit/backend/x86/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/autopath.py (original)
+++ pypy/trunk/pypy/jit/backend/x86/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/jit/backend/x86/tool/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/tool/autopath.py (original)
+++ pypy/trunk/pypy/jit/backend/x86/tool/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/jit/tl/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/tl/autopath.py (original)
+++ pypy/trunk/pypy/jit/tl/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/jit/tl/spli/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/tl/spli/autopath.py (original)
+++ pypy/trunk/pypy/jit/tl/spli/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/jit/tool/autopath.py
==============================================================================
--- pypy/trunk/pypy/jit/tool/autopath.py (original)
+++ pypy/trunk/pypy/jit/tool/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/module/__builtin__/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/module/__builtin__/test/autopath.py (original)
+++ pypy/trunk/pypy/module/__builtin__/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/module/_codecs/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/test/autopath.py (original)
+++ pypy/trunk/pypy/module/_codecs/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/module/_sre/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/module/_sre/test/autopath.py (original)
+++ pypy/trunk/pypy/module/_sre/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/module/cpyext/test/test_cpyext.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/test/test_cpyext.py (original)
+++ pypy/trunk/pypy/module/cpyext/test/test_cpyext.py Thu Jun 24 12:44:22 2010
@@ -15,7 +15,7 @@
from pypy.module.cpyext.pyobject import RefcountState
from pypy.module.cpyext.pyobject import Py_DecRef, InvalidPointerException
from pypy.translator.goal import autopath
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
@api.cpython_api([], api.PyObject)
def PyPy_Crash1(space):
Modified: pypy/trunk/pypy/module/sys/__init__.py
==============================================================================
--- pypy/trunk/pypy/module/sys/__init__.py (original)
+++ pypy/trunk/pypy/module/sys/__init__.py Thu Jun 24 12:44:22 2010
@@ -30,9 +30,8 @@
'stderr' : 'state.getio(space).w_stderr',
'__stderr__' : 'state.getio(space).w_stderr',
'pypy_objspaceclass' : 'space.wrap(repr(space))',
- #'pypy_prefix': added by pypy_initial_path() when it succeeds, pointing
- # to the trunk of a checkout or to the dir /usr/share/pypy-1.1 .
-
+ #'prefix' : # added by pypy_initial_path() when it
+ #'exec_prefix' : # succeeds, pointing to trunk or /usr
'path' : 'state.get(space).w_path',
'modules' : 'state.get(space).w_modules',
'argv' : 'state.get(space).w_argv',
Modified: pypy/trunk/pypy/module/sys/state.py
==============================================================================
--- pypy/trunk/pypy/module/sys/state.py (original)
+++ pypy/trunk/pypy/module/sys/state.py Thu Jun 24 12:44:22 2010
@@ -32,26 +32,34 @@
if not stat.S_ISDIR(st[0]):
raise OSError(errno.ENOTDIR, path)
-def getinitialpath(srcdir):
- # build the initial path from the srcdir, which is the path of
- # the "dist" directory of a PyPy checkout.
- from pypy.module.sys.version import CPYTHON_VERSION
+def getinitialpath(prefix):
+ from pypy.module.sys.version import PYPY_VERSION
+ libdir = os.path.join(prefix, 'lib')
+ pypyxy_dir = os.path.join(libdir, 'pypy%d.%d' % PYPY_VERSION[:2])
+ # search for the stdlib both in $PREFIX/lib/pypy1.2 and $PREFIX
+ for lib_prefix in [pypyxy_dir, prefix]:
+ try:
+ return get_importlist(lib_prefix)
+ except OSError:
+ pass
+ raise OSError # stdlib not foud
+def get_importlist(lib_prefix):
+ from pypy.module.sys.version import CPYTHON_VERSION
dirname = '%d.%d.%d' % (CPYTHON_VERSION[0],
CPYTHON_VERSION[1],
CPYTHON_VERSION[2])
- lib_python = os.path.join(srcdir, 'lib-python')
-
+ lib_python = os.path.join(lib_prefix, 'lib-python')
python_std_lib = os.path.join(lib_python, dirname)
checkdir(python_std_lib)
python_std_lib_modified = os.path.join(lib_python, 'modified-' + dirname)
checkdir(python_std_lib_modified)
- pypydir = os.path.join(srcdir, 'pypy')
- pypy_lib = os.path.join(pypydir, 'lib')
- checkdir(pypy_lib)
+
+ lib_pypy = os.path.join(lib_prefix, 'lib_pypy')
+ checkdir(lib_pypy)
importlist = []
- importlist.append(pypy_lib)
+ importlist.append(lib_pypy)
importlist.append(python_std_lib_modified)
importlist.append(python_std_lib)
return importlist
@@ -62,7 +70,9 @@
except OSError:
return space.w_None
else:
- space.setitem(space.sys.w_dict, space.wrap('pypy_prefix'),
+ space.setitem(space.sys.w_dict, space.wrap('prefix'),
+ space.wrap(srcdir))
+ space.setitem(space.sys.w_dict, space.wrap('exec_prefix'),
space.wrap(srcdir))
return space.newlist([space.wrap(p) for p in path])
Modified: pypy/trunk/pypy/module/sys/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/module/sys/test/autopath.py (original)
+++ pypy/trunk/pypy/module/sys/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/module/sys/version.py
==============================================================================
--- pypy/trunk/pypy/module/sys/version.py (original)
+++ pypy/trunk/pypy/module/sys/version.py Thu Jun 24 12:44:22 2010
@@ -7,6 +7,7 @@
CPYTHON_VERSION = (2, 5, 2, "beta", 42)
CPYTHON_API_VERSION = 1012
+# when changing the pypy version, remind to also change the name of trunk/lib/pypyX.Y
PYPY_VERSION = (1, 2, 0, "beta", '?')
# the last item is replaced by the svn revision ^^^
Modified: pypy/trunk/pypy/objspace/flow/model.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/model.py (original)
+++ pypy/trunk/pypy/objspace/flow/model.py Thu Jun 24 12:44:22 2010
@@ -7,7 +7,7 @@
from pypy.tool.uid import uid, Hashable
from pypy.tool.descriptor import roproperty
from pypy.tool.sourcetools import PY_IDENTIFIER, nice_repr_for_func
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
"""
memory size before and after introduction of __slots__
Modified: pypy/trunk/pypy/pytest-A.cfg
==============================================================================
--- pypy/trunk/pypy/pytest-A.cfg (original)
+++ pypy/trunk/pypy/pytest-A.cfg Thu Jun 24 12:44:22 2010
@@ -1,4 +1,4 @@
-cherrypick = ['interpreter', 'objspace/test', 'objspace/std', 'module', 'lib']
+cherrypick = ['interpreter', 'objspace/test', 'objspace/std', 'module']
interp = ['translator/goal/pypy-c']
test_driver = ['test_all.py', '-A']
Modified: pypy/trunk/pypy/rlib/parsing/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/rlib/parsing/test/autopath.py (original)
+++ pypy/trunk/pypy/rlib/parsing/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/rlib/rmd5.py
==============================================================================
--- pypy/trunk/pypy/rlib/rmd5.py (original)
+++ pypy/trunk/pypy/rlib/rmd5.py Thu Jun 24 12:44:22 2010
@@ -2,7 +2,7 @@
"""
RPython implementation of MD5 checksums.
-See also the pure Python implementation in pypy/lib/md5.py, which might
+See also the pure Python implementation in lib_pypy/md5.py, which might
or might not be faster than this one on top of CPython.
This is an implementation of the MD5 hash function,
Modified: pypy/trunk/pypy/rlib/rsdl/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsdl/test/autopath.py (original)
+++ pypy/trunk/pypy/rlib/rsdl/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/rlib/rsha.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsha.py (original)
+++ pypy/trunk/pypy/rlib/rsha.py Thu Jun 24 12:44:22 2010
@@ -2,7 +2,7 @@
"""A sample implementation of SHA-1 in RPython.
- See also the pure Python implementation in pypy/lib/sha.py, which might
+ See also the pure Python implementation in lib_pypy/sha.py, which might
or might not be faster than this one on top of CPython.
Framework adapted from Dinu Gherman's MD5 implementation by
Modified: pypy/trunk/pypy/rlib/rzipfile.py
==============================================================================
--- pypy/trunk/pypy/rlib/rzipfile.py (original)
+++ pypy/trunk/pypy/rlib/rzipfile.py Thu Jun 24 12:44:22 2010
@@ -12,7 +12,8 @@
rzlib = None
# XXX hack to get crc32 to work
-from pypy.lib.binascii import crc_32_tab
+from pypy.tool.lib_pypy import import_from_lib_pypy
+crc_32_tab = import_from_lib_pypy('binascii').crc_32_tab
rcrc_32_tab = [r_uint(i) for i in crc_32_tab]
Modified: pypy/trunk/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/lltype.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/lltype.py Thu Jun 24 12:44:22 2010
@@ -9,7 +9,7 @@
from pypy.rlib.objectmodel import Symbolic
from pypy.tool.uid import Hashable
from pypy.tool.tls import tlsobject
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
from types import NoneType
from sys import maxint
import weakref
Modified: pypy/trunk/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rclass.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rclass.py Thu Jun 24 12:44:22 2010
@@ -21,7 +21,7 @@
from pypy.annotation import model as annmodel
from pypy.rlib.rarithmetic import intmask
from pypy.rlib import objectmodel
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
from pypy.rpython.lltypesystem.lloperation import llop
#
Modified: pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/test/test_lltype.py Thu Jun 24 12:44:22 2010
@@ -1,7 +1,7 @@
import py
from pypy.rpython.lltypesystem.lltype import *
from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
def isweak(p, T):
try:
Modified: pypy/trunk/pypy/rpython/memory/gctypelayout.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gctypelayout.py (original)
+++ pypy/trunk/pypy/rpython/memory/gctypelayout.py Thu Jun 24 12:44:22 2010
@@ -3,7 +3,7 @@
from pypy.rpython.lltypesystem.lloperation import llop
from pypy.rlib.objectmodel import we_are_translated
from pypy.rlib.debug import ll_assert
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
class GCData(object):
Modified: pypy/trunk/pypy/rpython/microbench/autopath.py
==============================================================================
--- pypy/trunk/pypy/rpython/microbench/autopath.py (original)
+++ pypy/trunk/pypy/rpython/microbench/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/rpython/ootypesystem/rclass.py
==============================================================================
--- pypy/trunk/pypy/rpython/ootypesystem/rclass.py (original)
+++ pypy/trunk/pypy/rpython/ootypesystem/rclass.py Thu Jun 24 12:44:22 2010
@@ -10,7 +10,7 @@
from pypy.rpython.exceptiondata import standardexceptions
from pypy.tool.pairtype import pairtype
from pypy.tool.sourcetools import func_with_new_name
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
OBJECT = ootype.ROOT
META = ootype.Instance("Meta", ootype.ROOT,
Modified: pypy/trunk/pypy/tool/algo/graphlib.py
==============================================================================
--- pypy/trunk/pypy/tool/algo/graphlib.py (original)
+++ pypy/trunk/pypy/tool/algo/graphlib.py Thu Jun 24 12:44:22 2010
@@ -6,7 +6,7 @@
'edges' is a dict mapping vertices to a list of edges with its source.
Note that we can usually use 'edges' as the set of 'vertices' too.
"""
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
class Edge:
Modified: pypy/trunk/pypy/tool/algo/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/tool/algo/test/autopath.py (original)
+++ pypy/trunk/pypy/tool/algo/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/tool/autopath.py
==============================================================================
--- pypy/trunk/pypy/tool/autopath.py (original)
+++ pypy/trunk/pypy/tool/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/tool/compat.py
==============================================================================
--- pypy/trunk/pypy/tool/compat.py (original)
+++ pypy/trunk/pypy/tool/compat.py Thu Jun 24 12:44:22 2010
@@ -6,5 +6,8 @@
try:
from md5 import md5
except ImportError:
- # no _md5 module on this platform
- from pypy.lib.md5 import md5
+ # no _md5 module on this platform. Try hard to find a pure-python one
+ # by fishing it from lib_pypy
+ from pypy.tool.lib_pypy import import_from_lib_pypy
+ md5 = import_from_lib_pypy('md5')
+ del import_from_lib_pypy
Modified: pypy/trunk/pypy/tool/pytest/autopath.py
==============================================================================
--- pypy/trunk/pypy/tool/pytest/autopath.py (original)
+++ pypy/trunk/pypy/tool/pytest/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/tool/pytest/confpath.py
==============================================================================
--- pypy/trunk/pypy/tool/pytest/confpath.py (original)
+++ pypy/trunk/pypy/tool/pytest/confpath.py Thu Jun 24 12:44:22 2010
@@ -1,11 +1,12 @@
import autopath
import py
import pypy
+from pypy.tool import lib_pypy
pypydir = py.path.local(pypy.__file__).dirpath()
distdir = pypydir.dirpath()
testresultdir = distdir.join('testresult')
assert pypydir.check(dir=1)
-libpythondir = distdir.join('lib-python')
-regrtestdir = libpythondir.join('2.5.2', 'test')
-modregrtestdir = libpythondir.join('modified-2.5.2', 'test')
+libpythondir = lib_pypy.LIB_PYTHON
+regrtestdir = lib_pypy.LIB_PYTHON_VANILLA.join('test')
+modregrtestdir = lib_pypy.LIB_PYTHON_MODIFIED.join('test')
Modified: pypy/trunk/pypy/tool/release/package.py
==============================================================================
--- pypy/trunk/pypy/tool/release/package.py (original)
+++ pypy/trunk/pypy/tool/release/package.py Thu Jun 24 12:44:22 2010
@@ -46,14 +46,13 @@
raise PyPyCNotFound('Please compile pypy first, using translate.py')
builddir = udir.ensure("build", dir=True)
pypydir = builddir.ensure(name, dir=True)
+ # Careful: to copy lib_pypy, copying just the svn-tracked files
+ # would not be enough: there are also ctypes_config_cache/_*_cache.py.
shutil.copytree(str(basedir.join('lib-python')),
str(pypydir.join('lib-python')),
- ignore=ignore_patterns('.svn', '*.pyc', '*~'))
- # Careful: to copy pypy/lib, copying just the svn-tracked files
- # would not be enough: there are also ctypes_config_cache/_*_cache.py.
- pypydir.ensure('pypy', dir=True)
- shutil.copytree(str(basedir.join('pypy', 'lib')),
- str(pypydir.join('pypy', 'lib')),
+ ignore=ignore_patterns('.svn', 'py', '*.pyc', '*~'))
+ shutil.copytree(str(basedir.join('lib_pypy')),
+ str(pypydir.join('lib_pypy')),
ignore=ignore_patterns('.svn', 'py', '*.pyc', '*~'))
for file in ['LICENSE', 'README']:
shutil.copy(str(basedir.join(file)), str(pypydir))
Modified: pypy/trunk/pypy/tool/release/test/test_package.py
==============================================================================
--- pypy/trunk/pypy/tool/release/test/test_package.py (original)
+++ pypy/trunk/pypy/tool/release/test/test_package.py Thu Jun 24 12:44:22 2010
@@ -2,6 +2,7 @@
import py
from pypy.tool.autopath import pypydir
from pypy.tool.release.package import package
+from pypy.module.sys.version import CPYTHON_VERSION
import tarfile, os
def test_dir_structure():
@@ -14,15 +15,17 @@
fake_pypy_c = False
try:
builddir = package(py.path.local(pypydir).dirpath(), 'test')
- assert builddir.join('test', 'lib-python', '2.5.2', 'test').check()
- assert builddir.join('test', 'bin', 'pypy-c').check()
- assert builddir.join('test', 'pypy', 'lib', 'syslog.py').check()
- assert not builddir.join('test', 'pypy', 'lib', 'py').check()
- assert not builddir.join('test', 'pypy', 'lib', 'ctypes_configure').check()
- assert builddir.join('test', 'LICENSE').check()
- assert builddir.join('test', 'README').check()
+ prefix = builddir.join('test')
+ cpyver = '%d.%d.%d' % CPYTHON_VERSION[:3]
+ assert prefix.join('lib-python', cpyver, 'test').check()
+ assert prefix.join('bin', 'pypy-c').check()
+ assert prefix.join('lib_pypy', 'syslog.py').check()
+ assert not prefix.join('lib_pypy', 'py').check()
+ assert not prefix.join('lib_pypy', 'ctypes_configure').check()
+ assert prefix.join('LICENSE').check()
+ assert prefix.join('README').check()
th = tarfile.open(str(builddir.join('test.tar.bz2')))
- assert th.getmember('test/pypy/lib/syslog.py')
+ assert th.getmember('test/lib_pypy/syslog.py')
finally:
if fake_pypy_c:
pypy_c.remove()
Modified: pypy/trunk/pypy/tool/stdlib___future__.py
==============================================================================
--- pypy/trunk/pypy/tool/stdlib___future__.py (original)
+++ pypy/trunk/pypy/tool/stdlib___future__.py Thu Jun 24 12:44:22 2010
@@ -1,8 +1,8 @@
# load __future__.py constants
def load_module():
- import py
- module_path = py.path.local(__file__).dirpath().dirpath().dirpath('lib-python/2.5.2/__future__.py')
+ from pypy.tool.lib_pypy import LIB_PYTHON_VANILLA
+ module_path = LIB_PYTHON_VANILLA.join('__future__.py')
execfile(str(module_path), globals())
load_module()
Modified: pypy/trunk/pypy/tool/stdlib_opcode.py
==============================================================================
--- pypy/trunk/pypy/tool/stdlib_opcode.py (original)
+++ pypy/trunk/pypy/tool/stdlib_opcode.py Thu Jun 24 12:44:22 2010
@@ -106,8 +106,8 @@
opmap as host_opmap, HAVE_ARGUMENT as host_HAVE_ARGUMENT)
def load_pypy_opcode():
- import py
- opcode_path = py.path.local(__file__).dirpath().dirpath().dirpath('lib-python/modified-2.5.2/opcode.py')
+ from pypy.tool.lib_pypy import LIB_PYTHON_MODIFIED
+ opcode_path = LIB_PYTHON_MODIFIED.join('opcode.py')
d = {}
execfile(str(opcode_path), d)
for name in __all__:
Modified: pypy/trunk/pypy/tool/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/tool/test/autopath.py (original)
+++ pypy/trunk/pypy/tool/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/autopath.py (original)
+++ pypy/trunk/pypy/translator/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/benchmark/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/benchmark/autopath.py (original)
+++ pypy/trunk/pypy/translator/benchmark/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/c/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/c/autopath.py (original)
+++ pypy/trunk/pypy/translator/c/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/c/database.py
==============================================================================
--- pypy/trunk/pypy/translator/c/database.py (original)
+++ pypy/trunk/pypy/translator/c/database.py Thu Jun 24 12:44:22 2010
@@ -16,7 +16,7 @@
from pypy.translator.c.extfunc import do_the_getting
from pypy import conftest
from pypy.translator.c import gc
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
class NoCorrespondingNode(Exception):
Modified: pypy/trunk/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/trunk/pypy/translator/c/funcgen.py (original)
+++ pypy/trunk/pypy/translator/c/funcgen.py Thu Jun 24 12:44:22 2010
@@ -13,7 +13,7 @@
from pypy.rpython.lltypesystem.llmemory import Address
from pypy.translator.backendopt.ssa import SSI_to_SSA
from pypy.translator.backendopt.innerloop import find_inner_loops
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
PyObjPtr = Ptr(PyObject)
Modified: pypy/trunk/pypy/translator/c/gcc/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/c/gcc/autopath.py (original)
+++ pypy/trunk/pypy/translator/c/gcc/autopath.py Thu Jun 24 12:44:22 2010
@@ -37,8 +37,7 @@
partdir = head
head, tail = os.path.split(head)
if tail == part:
- # check if "../py/__init__.py" exists
- checkfile = os.path.join(partdir, os.pardir, 'py', '__init__.py')
+ checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
if not os.path.exists(checkfile):
error = "Cannot find %r" % (os.path.normpath(checkfile),)
break
@@ -127,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/c/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/c/test/autopath.py (original)
+++ pypy/trunk/pypy/translator/c/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/cli/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/cli/test/autopath.py (original)
+++ pypy/trunk/pypy/translator/cli/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/geninterplevel.py
==============================================================================
--- pypy/trunk/pypy/translator/geninterplevel.py (original)
+++ pypy/trunk/pypy/translator/geninterplevel.py Thu Jun 24 12:44:22 2010
@@ -62,7 +62,7 @@
from pypy.translator.gensupp import ordered_blocks, UniqueList, builtin_base, \
uniquemodulename, C_IDENTIFIER, NameManager
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
import pypy # __path__
import py.path
@@ -496,21 +496,22 @@
need_extra_path = True
name = self.uniquename('mod_%s' % value.__name__)
if need_extra_path:
- self.initcode.append1('import pypy')
- self.initcode.append1('import sys')
- self.initcode.append1('import os')
- self.initcode.append1('for pkgdir in pypy.__path__:\n'
- ' libdir = os.path.join(pkgdir, "lib")\n'
- ' if os.path.isdir(libdir):\n'
- ' break\n'
- 'else:\n'
- ' raise Exception, "cannot find pypy/lib directory"\n'
- 'sys.path.insert(0, libdir)\n')
- self.initcode.append1('try:\n'
- ' import %s as _tmp\n'
- 'finally:\n'
- ' if libdir in sys.path:\n'
- ' sys.path.remove(libdir)\n' % value.__name__)
+ assert False
+ ## self.initcode.append1('import pypy')
+ ## self.initcode.append1('import sys')
+ ## self.initcode.append1('import os')
+ ## self.initcode.append1('for pkgdir in pypy.__path__:\n'
+ ## ' libdir = os.path.join(pkgdir, "lib")\n'
+ ## ' if os.path.isdir(libdir):\n'
+ ## ' break\n'
+ ## 'else:\n'
+ ## ' raise Exception, "cannot find pypy/lib directory"\n'
+ ## 'sys.path.insert(0, libdir)\n')
+ ## self.initcode.append1('try:\n'
+ ## ' import %s as _tmp\n'
+ ## 'finally:\n'
+ ## ' if libdir in sys.path:\n'
+ ## ' sys.path.remove(libdir)\n' % value.__name__)
else:
self.initcode.append1('import %s as _tmp' % value.__name__)
self.initcode.append1('%s = space.wrap(_tmp)' % (name))
@@ -1473,6 +1474,7 @@
dic = initfunc(space)
# and now use the members of the dict
"""
+ from pypy.tool.lib_pypy import LIB_PYPY
# create something like a module
if type(sourcetext) is str:
code = py.code.Source(sourcetext).compile()
@@ -1484,12 +1486,7 @@
dic['__file__'] = filename
# XXX allow the app-level code to contain e.g. "import _formatting"
- for pkgdir in pypy.__path__:
- libdir = os.path.join(pkgdir, "lib")
- if os.path.isdir(libdir):
- break
- else:
- raise Exception, "cannot find pypy/lib directory"
+ libdir = str(LIB_PYPY)
sys.path.insert(0, libdir)
try:
if faked_set:
Modified: pypy/trunk/pypy/translator/goal/app_main.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/app_main.py (original)
+++ pypy/trunk/pypy/translator/goal/app_main.py Thu Jun 24 12:44:22 2010
@@ -182,12 +182,27 @@
option)
return argv[i], i
+def get_library_path(executable):
+ search = executable
+ while 1:
+ dirname = resolvedirof(search)
+ if dirname == search:
+ # not found! let's hope that the compiled-in path is ok
+ print >> sys.stderr, ('debug: WARNING: library path not found, '
+ 'using compiled-in sys.path')
+ newpath = sys.path[:]
+ break
+ newpath = sys.pypy_initial_path(dirname)
+ if newpath is None:
+ search = dirname # walk to the parent directory
+ continue
+ break # found!
+ return newpath
def setup_initial_paths(executable, nanos):
# a substituted os if we are translated
global os
os = nanos
- AUTOSUBPATH = 'share' + os.sep + 'pypy-%d.%d'
# find the full path to the executable, assuming that if there is no '/'
# in the provided one then we must look along the $PATH
if we_are_translated() and IS_WINDOWS and not executable.lower().endswith('.exe'):
@@ -204,24 +219,7 @@
break
sys.executable = os.path.abspath(executable)
- # set up a sys.path that depends on the local machine
- autosubpath = AUTOSUBPATH % sys.pypy_version_info[:2]
- search = executable
- while 1:
- dirname = resolvedirof(search)
- if dirname == search:
- # not found! let's hope that the compiled-in path is ok
- print >> sys.stderr, ('debug: WARNING: library path not found, '
- 'using compiled-in sys.path')
- newpath = sys.path[:]
- break
- newpath = sys.pypy_initial_path(dirname)
- if newpath is None:
- newpath = sys.pypy_initial_path(os.path.join(dirname, autosubpath))
- if newpath is None:
- search = dirname # walk to the parent directory
- continue
- break # found!
+ newpath = get_library_path(executable)
path = os.getenv('PYTHONPATH')
if path:
newpath = path.split(os.pathsep) + newpath
Modified: pypy/trunk/pypy/translator/goal/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/autopath.py (original)
+++ pypy/trunk/pypy/translator/goal/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/goal/targetpypystandalone.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/targetpypystandalone.py (original)
+++ pypy/trunk/pypy/translator/goal/targetpypystandalone.py Thu Jun 24 12:44:22 2010
@@ -225,7 +225,8 @@
return PyPyJitPolicy()
def get_entry_point(self, config):
- from pypy.lib.ctypes_config_cache import rebuild
+ from pypy.tool.lib_pypy import import_from_lib_pypy
+ rebuild = import_from_lib_pypy('ctypes_config_cache/rebuild')
rebuild.try_rebuild()
space = make_objspace(config)
Modified: pypy/trunk/pypy/translator/goal/test2/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/test2/autopath.py (original)
+++ pypy/trunk/pypy/translator/goal/test2/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/goal/test2/test_app_main.py
==============================================================================
--- pypy/trunk/pypy/translator/goal/test2/test_app_main.py (original)
+++ pypy/trunk/pypy/translator/goal/test2/test_app_main.py Thu Jun 24 12:44:22 2010
@@ -460,3 +460,59 @@
data = child_out_err.read(11)
assert data == '\x00(STDOUT)\n\x00' # from stdout
child_out_err.close()
+
+
+class AppTestAppMain:
+
+ def setup_class(self):
+ # ------------------------------------
+ # setup code for test_get_library_path
+ # ------------------------------------
+ from pypy.module.sys.version import CPYTHON_VERSION, PYPY_VERSION
+ libroot = 'lib/pypy%d.%d' % PYPY_VERSION[:2]
+ cpy_ver = '%d.%d.%d' % CPYTHON_VERSION[:3]
+
+ goal_dir = os.path.dirname(app_main)
+ # build a directory hierarchy like which contains both bin/pypy-c and
+ # lib/pypy1.2/*
+ prefix = udir.join('pathtest')
+ fake_exe = prefix.join('bin/pypy-c').ensure(file=1)
+ pypyxy = prefix.join(libroot).ensure(dir=1)
+ expected_path = [str(pypyxy.join(subdir).ensure(dir=1))
+ for subdir in ('lib_pypy',
+ 'lib-python/modified-%s' % cpy_ver,
+ 'lib-python/%s' % cpy_ver)]
+
+ self.w_goal_dir = self.space.wrap(goal_dir)
+ self.w_fake_exe = self.space.wrap(str(fake_exe))
+ self.w_expected_path = self.space.wrap(expected_path)
+ self.w_trunkdir = self.space.wrap(os.path.dirname(autopath.pypydir))
+
+ def test_get_library_path(self):
+ import sys
+ import os
+ sys.path.append(self.goal_dir)
+ try:
+ import app_main
+ app_main.os = os
+ newpath = app_main.get_library_path('/tmp/pypy-c') # stdlib not found
+ assert newpath == sys.path
+ newpath = app_main.get_library_path(self.fake_exe)
+ assert newpath == self.expected_path
+ finally:
+ sys.path.pop()
+
+ def test_trunk_can_be_prefix(self):
+ import sys
+ import os
+ sys.path.append(self.goal_dir)
+ try:
+ import app_main
+ app_main.os = os
+ pypy_c = os.path.join(self.trunkdir, 'pypy', 'translator', 'goal', 'pypy-c')
+ newpath = app_main.get_library_path(pypy_c)
+ assert len(newpath) == 3
+ for p in newpath:
+ assert p.startswith(self.trunkdir)
+ finally:
+ sys.path.pop()
Modified: pypy/trunk/pypy/translator/microbench/pybench/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/microbench/pybench/autopath.py (original)
+++ pypy/trunk/pypy/translator/microbench/pybench/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/oosupport/function.py
==============================================================================
--- pypy/trunk/pypy/translator/oosupport/function.py (original)
+++ pypy/trunk/pypy/translator/oosupport/function.py Thu Jun 24 12:44:22 2010
@@ -7,7 +7,7 @@
from pypy.rpython.ootypesystem import ootype
from pypy.translator.oosupport.treebuilder import SubOperation
from pypy.translator.oosupport.metavm import InstructionList, StoreResult
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
def render_sub_op(sub_op, db, generator):
Modified: pypy/trunk/pypy/translator/sandbox/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/sandbox/autopath.py (original)
+++ pypy/trunk/pypy/translator/sandbox/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/sandbox/pypy_interact.py
==============================================================================
--- pypy/trunk/pypy/translator/sandbox/pypy_interact.py (original)
+++ pypy/trunk/pypy/translator/sandbox/pypy_interact.py Thu Jun 24 12:44:22 2010
@@ -26,6 +26,7 @@
from pypy.translator.sandbox.sandlib import SimpleIOSandboxedProc
from pypy.translator.sandbox.sandlib import VirtualizedSandboxedProc
from pypy.translator.sandbox.vfs import Dir, RealDir, RealFile
+from pypy.tool.lib_pypy import LIB_ROOT
class PyPySandboxedProc(VirtualizedSandboxedProc, SimpleIOSandboxedProc):
debug = True
@@ -50,17 +51,15 @@
tmpdirnode = Dir({})
else:
tmpdirnode = RealDir(self.tmpdir, exclude=exclude)
- pypydist = os.path.dirname(os.path.abspath(autopath.pypydir))
+ libroot = str(LIB_ROOT)
return Dir({
'bin': Dir({
'pypy-c': RealFile(self.executable),
- 'lib-python': RealDir(os.path.join(pypydist, 'lib-python'),
+ 'lib-python': RealDir(os.path.join(libroot, 'lib-python'),
+ exclude=exclude),
+ 'lib_pypy': RealDir(os.path.join(libroot, 'lib_pypy'),
exclude=exclude),
- 'pypy': Dir({
- 'lib': RealDir(os.path.join(pypydist, 'pypy', 'lib'),
- exclude=exclude),
- }),
}),
'tmp': tmpdirnode,
})
Modified: pypy/trunk/pypy/translator/sandbox/sandlib.py
==============================================================================
--- pypy/trunk/pypy/translator/sandbox/sandlib.py (original)
+++ pypy/trunk/pypy/translator/sandbox/sandlib.py Thu Jun 24 12:44:22 2010
@@ -6,7 +6,6 @@
import py
import sys, os, posixpath, errno, stat, time
-from pypy.lib import marshal # see below
from pypy.rpython.module.ll_os_stat import s_StatResult
from pypy.tool.ansi_print import AnsiLog
from pypy.rlib.rarithmetic import r_longlong
@@ -26,12 +25,14 @@
py.log.setconsumer("sandlib", MyAnsiLog())
-# Note: we use pypy.lib.marshal instead of the built-in marshal
+# Note: we use lib_pypy/marshal.py instead of the built-in marshal
# for two reasons. The built-in module could be made to segfault
# or be attackable in other ways by sending malicious input to
# load(). Also, marshal.load(f) blocks with the GIL held when
# f is a pipe with no data immediately avaialble, preventing the
# _waiting_thread to run.
+from pypy.tool.lib_pypy import import_from_lib_pypy
+marshal = import_from_lib_pypy('marshal')
def read_message(f, timeout=None):
# warning: 'timeout' is not really reliable and should only be used
Modified: pypy/trunk/pypy/translator/sandbox/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/sandbox/test/autopath.py (original)
+++ pypy/trunk/pypy/translator/sandbox/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/sandbox/test/test_pypy_interact.py
==============================================================================
--- pypy/trunk/pypy/translator/sandbox/test/test_pypy_interact.py (original)
+++ pypy/trunk/pypy/translator/sandbox/test/test_pypy_interact.py Thu Jun 24 12:44:22 2010
@@ -24,7 +24,7 @@
assert_(argv[0] == '/bin/pypy-c', "bad argv[0]")
st = os.lstat('/bin/pypy-c')
assert_(stat.S_ISREG(st.st_mode), "bad st_mode for /bin/pypy-c")
- for dirname in ['/bin/lib-python/2.5.2', '/bin/pypy/lib']:
+ for dirname in ['/bin/lib-python/2.5.2', '/bin/lib_pypy']:
st = os.stat(dirname)
assert_(stat.S_ISDIR(st.st_mode), "bad st_mode for " + dirname)
assert_(os.environ.get('PYTHONPATH') is None, "unexpected $PYTHONPATH")
@@ -70,7 +70,7 @@
def setup_module(mod):
t = Translation(mini_pypy_like_entry_point, backend='c',
- standalone=True, sandbox=True)
+ standalone=True, sandbox=True)
mod.executable = str(t.compile())
Modified: pypy/trunk/pypy/translator/test/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/test/autopath.py (original)
+++ pypy/trunk/pypy/translator/test/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/tool/autopath.py
==============================================================================
--- pypy/trunk/pypy/translator/tool/autopath.py (original)
+++ pypy/trunk/pypy/translator/tool/autopath.py Thu Jun 24 12:44:22 2010
@@ -126,7 +126,7 @@
# set guaranteed attributes
pypydir, this_dir = __dirinfo('pypy')
-import py
+import py # note: py is imported only AFTER the path has been set
libpythondir = str(py.path.local(pypydir).dirpath().join('lib-python', '2.5.2'))
libpythonmodifieddir = str(py.path.local(libpythondir).dirpath().join('modified-2.5.2'))
Modified: pypy/trunk/pypy/translator/tool/lltracker.py
==============================================================================
--- pypy/trunk/pypy/translator/tool/lltracker.py (original)
+++ pypy/trunk/pypy/translator/tool/lltracker.py Thu Jun 24 12:44:22 2010
@@ -8,7 +8,7 @@
from pypy.rpython.memory.gcheader import header2obj
from pypy.translator.tool.reftracker import BaseRefTrackerPage, MARKER
from pypy.tool.uid import uid
-from pypy.lib.identity_dict import identity_dict
+from pypy.tool.identity_dict import identity_dict
class LLRefTrackerPage(BaseRefTrackerPage):
More information about the Pypy-commit
mailing list