Author: Ronny Pfannschmidt <ronny.pfannschm...@gmx.de>
Branch: kill-import_from_lib_pypy
Changeset: r55824:342497b7cc5f
Date: 2012-06-25 23:30 +0200
http://bitbucket.org/pypy/pypy/changeset/342497b7cc5f/

Log:    kill import_from_lib_pypy

        this removes the fragile use of import_from_lib_pypy with actual
        imports to lib_pypy since its actually a package and can be used
        that way

diff --git a/pypy/tool/compat.py b/pypy/tool/compat.py
--- a/pypy/tool/compat.py
+++ b/pypy/tool/compat.py
@@ -8,6 +8,4 @@
     except ImportError:
         # 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
+        from lib_pypy._md5 import new as md5
diff --git a/pypy/tool/lib_pypy.py b/pypy/tool/lib_pypy.py
--- a/pypy/tool/lib_pypy.py
+++ b/pypy/tool/lib_pypy.py
@@ -6,8 +6,3 @@
 LIB_ROOT = py.path.local(pypy.__path__[0]).dirpath()
 LIB_PYPY =  LIB_ROOT.join('lib_pypy')
 LIB_PYTHON = LIB_ROOT.join('lib-python', '%d.%d' % CPYTHON_VERSION[:2])
-
-
-def import_from_lib_pypy(modname):
-    modname = LIB_PYPY.join(modname+'.py')
-    return modname.pyimport()
diff --git a/pypy/tool/test/test_lib_pypy.py b/pypy/tool/test/test_lib_pypy.py
--- a/pypy/tool/test/test_lib_pypy.py
+++ b/pypy/tool/test/test_lib_pypy.py
@@ -7,9 +7,3 @@
 
 def test_lib_python_exists():
     assert lib_pypy.LIB_PYTHON.check(dir=1)
-
-def test_import_from_lib_pypy():
-    _functools = lib_pypy.import_from_lib_pypy('_functools')
-    assert type(_functools) is type(lib_pypy)
-    assert _functools.__name__ == 'lib_pypy._functools'
-    assert hasattr(_functools, 'partial')
diff --git a/pypy/translator/goal/targetpypystandalone.py 
b/pypy/translator/goal/targetpypystandalone.py
--- a/pypy/translator/goal/targetpypystandalone.py
+++ b/pypy/translator/goal/targetpypystandalone.py
@@ -230,9 +230,8 @@
         return PyPyJitPolicy(pypy_hooks)
     
     def get_entry_point(self, config):
-        from pypy.tool.lib_pypy import import_from_lib_pypy
-        rebuild = import_from_lib_pypy('ctypes_config_cache/rebuild')
-        rebuild.try_rebuild()
+        from lib_pypy.ctypes_config_cache.rebuild import try_rebuild
+        try_rebuild()
 
         space = make_objspace(config)
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to