Author: Alexander Hesse <webmas...@aquanasoft.de>
Branch: split-rpython
Changeset: r60006:1fb77e052760
Date: 2013-01-13 01:37 +0100
http://bitbucket.org/pypy/pypy/changeset/1fb77e052760/

Log:    No more pypy imports. Also I hate mercurial now.

diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -785,7 +785,7 @@
                     return callback_internal(*cargs)
                 except:
                     import sys
-                    #if option.usepdb:
+                    #if conftest.option.usepdb:
                     #    import pdb; pdb.post_mortem(sys.exc_traceback)
                     global _callback_exc_info
                     _callback_exc_info = sys.exc_info()
diff --git a/rpython/rtyper/test/test_llinterp.py 
b/rpython/rtyper/test/test_llinterp.py
--- a/rpython/rtyper/test/test_llinterp.py
+++ b/rpython/rtyper/test/test_llinterp.py
@@ -43,7 +43,7 @@
     a = t.buildannotator(policy=policy)
     timelog("annotating", a.build_types, func, argtypes, main_entry_point=True)
     if viewbefore == 'auto':
-        viewbefore = getattr(option, 'view', False)
+        viewbefore = getattr(conftest.option, 'view', False)
     if viewbefore:
         a.simplify()
         t.view()
@@ -98,7 +98,7 @@
         if len(_lastinterpreted) >= 4: 
             del _tcache[_lastinterpreted.pop(0)]
     if view == 'auto':
-        view = getattr(option, 'view', False)
+        view = getattr(conftest.option, 'view', False)
     if view:
         t.view()
     return interp, graph
diff --git a/rpython/rtyper/test/test_rvirtualizable2.py 
b/rpython/rtyper/test/test_rvirtualizable2.py
--- a/rpython/rtyper/test/test_rvirtualizable2.py
+++ b/rpython/rtyper/test/test_rvirtualizable2.py
@@ -163,7 +163,7 @@
         op_getfield = block.operations[-1]
         assert op_getfield.opname in ('getfield', 'oogetfield')
         funcptr = self.replace_force_virtualizable(rtyper, [graph])
-        if getattr(option, 'view', False):
+        if getattr(conftest.option, 'view', False):
             graph.show()
         op_promote = block.operations[-2]
         op_getfield = block.operations[-1]
diff --git a/rpython/rtyper/tool/rffi_platform.py 
b/rpython/rtyper/tool/rffi_platform.py
--- a/rpython/rtyper/tool/rffi_platform.py
+++ b/rpython/rtyper/tool/rffi_platform.py
@@ -11,7 +11,6 @@
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import CompilationError
 from rpython.tool.udir import udir
-from pypy.conftest import pypydir
 from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, intmask
 
 # ____________________________________________________________
@@ -738,7 +737,10 @@
 
 # ____________________________________________________________
 
-PYPY_EXTERNAL_DIR = py.path.local(pypydir).join('..', '..')
+from os.path import dirname
+import rpython
+
+PYPY_EXTERNAL_DIR = py.path.local(dirname(rpython.__file__)).join('..', '..')
 # XXX make this configurable
 if sys.platform == 'win32':
     for libdir in [
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -401,7 +401,7 @@
                 ('profopt', '', [
                 '$(MAKENOPROF)',
                 '$(MAKE) CFLAGS="-fprofile-generate $(CFLAGS)" 
LDFLAGS="-fprofile-generate $(LDFLAGS)" $(TARGET)',
-                'cd $(PYPYDIR)/translator/goal && $(ABS_TARGET) $(PROFOPT)',
+                'cd $(RPYDIR)/translator/goal && $(ABS_TARGET) $(PROFOPT)',
                 '$(MAKE) clean_noprof',
                 '$(MAKE) CFLAGS="-fprofile-use $(CFLAGS)" 
LDFLAGS="-fprofile-use $(LDFLAGS)" $(TARGET)']))
         for rule in rules:
@@ -452,22 +452,22 @@
                         'cmd /c $(MASM) /nologo /Cx /Cp /Zm /coff /Fo$@ /c $< 
$(INCLUDEDIRS)')
                 mk.rule('.c.gcmap', '',
                         ['$(CC) /nologo $(ASM_CFLAGS) /c /FAs /Fa$*.s $< 
$(INCLUDEDIRS)',
-                         'cmd /c $(PYTHON) 
$(PYPYDIR)/translator/c/gcc/trackgcroot.py -fmsvc -t $*.s > $@']
+                         'cmd /c $(PYTHON) 
$(RPYDIR)/translator/c/gcc/trackgcroot.py -fmsvc -t $*.s > $@']
                         )
                 mk.rule('gcmaptable.c', '$(GCMAPFILES)',
-                        'cmd /c $(PYTHON) 
$(PYPYDIR)/translator/c/gcc/trackgcroot.py -fmsvc $(GCMAPFILES) > $@')
+                        'cmd /c $(PYTHON) 
$(RPYDIR)/translator/c/gcc/trackgcroot.py -fmsvc $(GCMAPFILES) > $@')
 
             else:
                 mk.definition('OBJECTS', '$(ASMLBLFILES) gcmaptable.s')
                 mk.rule('%.s', '%.c', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) 
-frandom-seed=$< -o $@ -S $< $(INCLUDEDIRS)')
                 mk.rule('%.lbl.s %.gcmap', '%.s',
                         [
-                             '$(PYTHON) 
$(PYPYDIR)/translator/c/gcc/trackgcroot.py '
+                             '$(PYTHON) 
$(RPYDIR)/translator/c/gcc/trackgcroot.py '
                              '-t $< > $*.gctmp',
                          'mv $*.gctmp $*.gcmap'])
                 mk.rule('gcmaptable.s', '$(GCMAPFILES)',
                         [
-                             '$(PYTHON) 
$(PYPYDIR)/translator/c/gcc/trackgcroot.py '
+                             '$(PYTHON) 
$(RPYDIR)/translator/c/gcc/trackgcroot.py '
                              '$(GCMAPFILES) > $@.tmp',
                          'mv $@.tmp $@'])
                 mk.rule('.PRECIOUS', '%.s', "# don't remove .s files if 
Ctrl-C'ed")
diff --git a/rpython/translator/c/test/test_newgc.py 
b/rpython/translator/c/test/test_newgc.py
--- a/rpython/translator/c/test/test_newgc.py
+++ b/rpython/translator/c/test/test_newgc.py
@@ -68,7 +68,7 @@
         for fullname in dir(cls):
             if not fullname.startswith('define'):
                 continue
-            keyword = option.keyword
+            keyword = conftest.option.keyword
             if keyword.startswith('test_'):
                 keyword = keyword[len('test_'):]
                 if keyword not in fullname:
diff --git a/rpython/translator/platform/posix.py 
b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -2,9 +2,11 @@
 
 import py, os, sys
 
-from pypy.conftest import pypydir
 from rpython.translator.platform import Platform, log, _run_subprocess
 
+import rpython
+rpydir = os.path.dirname(rpython.__file__)
+
 class BasePosix(Platform):
     exe_ext = ''
     make_cmd = 'make'
@@ -88,7 +90,7 @@
         if path is None:
             path = cfiles[0].dirpath()
 
-        pypypath = py.path.local(pypydir)
+        rpypath = py.path.local(rpydir)
 
         if exe_name is None:
             exe_name = cfiles[0].new(ext=self.exe_ext)
@@ -116,11 +118,11 @@
         m.exe_name = exe_name
         m.eci = eci
 
-        def pypyrel(fpath):
+        def rpyrel(fpath):
             lpath = py.path.local(fpath)
-            rel = lpath.relto(pypypath)
+            rel = lpath.relto(rpypath)
             if rel:
-                return os.path.join('$(PYPYDIR)', rel)
+                return os.path.join('$(RPYDIR)', rel)
             m_dir = m.makefile_dir
             if m_dir == lpath:
                 return '.'
@@ -132,14 +134,14 @@
         rel_ofiles = [rel_cfile[:rel_cfile.rfind('.')]+'.o' for rel_cfile in 
rel_cfiles]
         m.cfiles = rel_cfiles
 
-        rel_includedirs = [pypyrel(incldir) for incldir in
+        rel_includedirs = [rpyrel(incldir) for incldir in
                            self.preprocess_include_dirs(eci.include_dirs)]
-        rel_libdirs = [pypyrel(libdir) for libdir in
+        rel_libdirs = [rpyrel(libdir) for libdir in
                        self.preprocess_library_dirs(eci.library_dirs)]
 
         m.comment('automatically generated makefile')
         definitions = [
-            ('PYPYDIR', '"%s"' % pypydir),
+            ('RPYDIR', '"%s"' % rpydir),
             ('TARGET', target_name),
             ('DEFAULT_TARGET', exe_name.basename),
             ('SOURCES', rel_cfiles),
diff --git a/rpython/translator/platform/windows.py 
b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -7,6 +7,9 @@
 from rpython.translator.platform import log, _run_subprocess
 from rpython.translator.platform import Platform, posix
 
+import rpython
+rpydir = os.path.dirname(rpython.__file__)
+
 def _get_compiler_type(cc, x64_flag):
     import subprocess
     if not cc:
@@ -252,7 +255,7 @@
         if path is None:
             path = cfiles[0].dirpath()
 
-        pypypath = py.path.local(pypydir)
+        rpypath = py.path.local(rpydir)
 
         if exe_name is None:
             exe_name = cfiles[0].new(ext=self.exe_ext)
@@ -279,10 +282,10 @@
         else:
             target_name = exe_name.basename
 
-        def pypyrel(fpath):
-            rel = py.path.local(fpath).relto(pypypath)
+        def rpyrel(fpath):
+            rel = py.path.local(fpath).relto(rpypath)
             if rel:
-                return os.path.join('$(PYPYDIR)', rel)
+                return os.path.join('$(RPYDIR)', rel)
             else:
                 return fpath
 
@@ -290,11 +293,11 @@
         rel_ofiles = [rel_cfile[:rel_cfile.rfind('.')]+'.obj' for rel_cfile in 
rel_cfiles]
         m.cfiles = rel_cfiles
 
-        rel_includedirs = [pypyrel(incldir) for incldir in eci.include_dirs]
+        rel_includedirs = [rpyrel(incldir) for incldir in eci.include_dirs]
 
         m.comment('automatically generated makefile')
         definitions = [
-            ('PYPYDIR', pypydir),
+            ('RPYDIR', rpydir),
             ('TARGET', target_name),
             ('DEFAULT_TARGET', exe_name.basename),
             ('SOURCES', rel_cfiles),
diff --git a/lib_pypy/_marshal.py b/rpython/translator/sandbox/_marshal.py
copy from lib_pypy/_marshal.py
copy to rpython/translator/sandbox/_marshal.py
--- a/lib_pypy/_marshal.py
+++ b/rpython/translator/sandbox/_marshal.py
@@ -1,3 +1,4 @@
+# Copy of lib_pypy/_marshal.py needed by sandlib
 """Internal Python object serialization
 
 This module contains functions that can read and write Python values in a 
binary format. The format is specific to Python, but independent of machine 
architecture issues (e.g., you can write a Python value to a file on a PC, 
transport the file to a Sun, and read it back there). Details of the format may 
change between Python versions.
diff --git a/rpython/translator/sandbox/sandlib.py 
b/rpython/translator/sandbox/sandlib.py
--- a/rpython/translator/sandbox/sandlib.py
+++ b/rpython/translator/sandbox/sandlib.py
@@ -34,9 +34,7 @@
 # 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.
-import pypy
-marshal = py.path.local(pypy.__file__).join('..', '..', 'lib_pypy',
-                                            'marshal.py').pyimport()
+from rpython.translator.sandbox import _marshal as marshal
 
 # Non-marshal result types
 RESULTTYPE_STATRESULT = object()
diff --git a/rpython/translator/translator.py b/rpython/translator/translator.py
--- a/rpython/translator/translator.py
+++ b/rpython/translator/translator.py
@@ -11,7 +11,6 @@
 from rpython.flowspace.objspace import FlowObjSpace
 from rpython.tool.ansi_print import ansi_log
 from rpython.tool.sourcetools import nice_repr_for_func
-from pypy.config.pypyoption import pypy_optiondescription
 from rpython.config.translationoption import get_combined_translation_config
 from rpython.config.translationoption import get_platform
 import py
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to