Commits

Alexander Hesse committed dfa35f5

Changed autopath.py in rpython to search for rpython directory

  • Participants
  • Parent commits 5e96a47
  • Branches split-rpython

Comments (0)

Files changed (37)

rpython/annotator/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/backend/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/backend/x86/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/backend/x86/tool/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/tl/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/tl/spli/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/jit/tool/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/rlib/_rffi_stacklet.py

 import py
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rtyper.tool import rffi_platform
 import sys
 
 
-cdir = py.path.local(pypydir) / 'translator' / 'c'
+cdir = py.path.local(rpythondir) / 'translator' / 'c'
 
 eci = ExternalCompilationInfo(
     include_dirs = [cdir],

rpython/rlib/clibffi.py

 from rpython.rlib.rdynload import DLOpenError, DLLHANDLE
 from rpython.rlib import jit
 from rpython.rlib.objectmodel import specialize
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform
 import py
          ])
 else:
     USE_C_LIBFFI_MSVC = True
-    libffidir = py.path.local(pypydir).join('translator', 'c', 'src', 'libffi_msvc')
+    libffidir = py.path.local(rpythondir).join('translator', 'c', 'src', 'libffi_msvc')
     if not _WIN64:
         asm_ifc = 'win32.c'
     else:

rpython/rlib/parsing/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/rlib/rdtoa.py

 from __future__ import with_statement
 from rpython.rlib import rfloat
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rlib import jit
 from rpython.rlib.rstring import StringBuilder
 import py, sys
 
-cdir = py.path.local(pypydir) / 'translator' / 'c'
+cdir = py.path.local(rpythondir) / 'translator' / 'c'
 include_dirs = [cdir]
 
 # set the word endianness based on the host's endianness

rpython/rlib/rstack.py

 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rtyper.controllerentry import Controller, SomeControlledInstance
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
 # ____________________________________________________________
 
-srcdir = py.path.local(pypydir) / 'translator' / 'c' / 'src'
+srcdir = py.path.local(rpythondir) / 'translator' / 'c' / 'src'
 compilation_info = ExternalCompilationInfo(
         includes=['src/stack.h'],
         separate_module_files=[srcdir / 'stack.c', srcdir / 'threadlocal.c'])

rpython/rlib/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/rtyper/lltypesystem/module/ll_math.py

 
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.tool.sourcetools import func_with_new_name
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.rlib import jit, rposix
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import platform
     else:
         eci = ExternalCompilationInfo()
     # Some math functions are C99 and not defined by the Microsoft compiler
-    cdir = py.path.local(pypydir).join('translator', 'c')
+    cdir = py.path.local(rpythondir).join('translator', 'c')
     math_eci = ExternalCompilationInfo(
         include_dirs = [cdir],
         includes = ['src/ll_math.h'],

rpython/rtyper/module/ll_strtod.py

 from rpython.rtyper.extfunc import BaseLazyRegistering, extdef, registering
 from rpython.rlib import rfloat
 from rpython.rtyper.lltypesystem import lltype, rffi
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.rtyper.ootypesystem import ootype
 from rpython.rlib import rposix
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.annotator.model import SomeString
 
 class CConfig:
     _compilation_info_ = ExternalCompilationInfo(
         includes = ['src/ll_strtod.h'],
-        include_dirs = [str(py.path.local(pypydir).join('translator', 'c'))],
+        include_dirs = [str(py.path.local(rpythondir).join('translator', 'c'))],
         separate_module_sources = ['#include <src/ll_strtod.c>'],
         export_symbols = ['LL_strtod_formatd', 'LL_strtod_parts_to_float'],
     )

rpython/rtyper/tool/rffi_platform.py

 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.translator.platform import CompilationError
 from rpython.tool.udir import udir
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, intmask
 
 # ____________________________________________________________
 
 # ____________________________________________________________
 
-PYPY_EXTERNAL_DIR = py.path.local(pypydir).join('..', '..')
+PYPY_EXTERNAL_DIR = py.path.local(rpythondir).join('..', '..')
 # XXX make this configurable
 if sys.platform == 'win32':
     for libdir in [

rpython/tool/algo/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('pypy')
+rpythondir, this_dir = __dirinfo('pypy')
 
 if __name__ == '__main__':
     __clone()

rpython/tool/autopath.py

+"""
+self cloning, automatic path configuration 
+
+copy this into any subdirectory of pypy from which scripts need 
+to be run, typically all of the test subdirs. 
+The idea is that any such script simply issues
+
+    import autopath
+
+and this will make sure that the parent directory containing "pypy"
+is in sys.path. 
+
+If you modify the master "autopath.py" version (in pypy/tool/autopath.py) 
+you can directly run it which will copy itself on all autopath.py files
+it finds under the pypy root directory. 
+
+This module always provides these attributes:
+
+    rpythondir    rpython root directory path 
+    this_dir   directory where this autopath.py resides 
+
+"""
+
+def __dirinfo(part):
+    """ return (partdir, this_dir) and insert parent of partdir
+    into sys.path.  If the parent directories don't have the part
+    an EnvironmentError is raised."""
+
+    import sys, os
+    try:
+        head = this_dir = os.path.realpath(os.path.dirname(__file__))
+    except NameError:
+        head = this_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
+
+    error = None
+    while head:
+        partdir = head
+        head, tail = os.path.split(head)
+        if tail == part:
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
+            if not os.path.exists(checkfile):
+                error = "Cannot find %r" % (os.path.normpath(checkfile),)
+            break
+    else:
+        error = "Cannot find the parent directory %r of the path %r" % (
+            partdir, this_dir)
+    if not error:
+        # check for bogus end-of-line style (e.g. files checked out on
+        # Windows and moved to Unix)
+        f = open(__file__.replace('.pyc', '.py'), 'r')
+        data = f.read()
+        f.close()
+        if data.endswith('\r\n') or data.endswith('\r'):
+            error = ("Bad end-of-line style in the .py files. Typically "
+                     "caused by a zip file or a checkout done on Windows and "
+                     "moved to Unix or vice-versa.")
+    if error:
+        raise EnvironmentError("Invalid source tree - bogus checkout! " +
+                               error)
+    
+    pypy_root = os.path.join(head, '')
+    try:
+        sys.path.remove(head)
+    except ValueError:
+        pass
+    sys.path.insert(0, head)
+
+    munged = {}
+    for name, mod in sys.modules.items():
+        if '.' in name:
+            continue
+        fn = getattr(mod, '__file__', None)
+        if not isinstance(fn, str):
+            continue
+        newname = os.path.splitext(os.path.basename(fn))[0]
+        if not newname.startswith(part + '.'):
+            continue
+        path = os.path.join(os.path.dirname(os.path.realpath(fn)), '')
+        if path.startswith(pypy_root) and newname != part:
+            modpaths = os.path.normpath(path[len(pypy_root):]).split(os.sep)
+            if newname != '__init__':
+                modpaths.append(newname)
+            modpath = '.'.join(modpaths)
+            if modpath not in sys.modules:
+                munged[modpath] = mod
+
+    for name, mod in munged.iteritems():
+        if name not in sys.modules:
+            sys.modules[name] = mod
+        if '.' in name:
+            prename = name[:name.rfind('.')]
+            postname = name[len(prename)+1:]
+            if prename not in sys.modules:
+                __import__(prename)
+                if not hasattr(sys.modules[prename], postname):
+                    setattr(sys.modules[prename], postname, mod)
+
+    return partdir, this_dir
+
+def __clone():
+    """ clone master version of autopath.py into all subdirs """
+    from os.path import join, walk
+    if not this_dir.endswith(join('pypy','tool')):
+        raise EnvironmentError("can only clone master version "
+                               "'%s'" % join(rpythondir, 'tool',_myname))
+
+
+    def sync_walker(arg, dirname, fnames):
+        if _myname in fnames:
+            fn = join(dirname, _myname)
+            f = open(fn, 'rwb+')
+            try:
+                if f.read() == arg:
+                    print "checkok", fn
+                else:
+                    print "syncing", fn
+                    f = open(fn, 'w')
+                    f.write(arg)
+            finally:
+                f.close()
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
+
+_myname = 'autopath.py'
+
+# set guaranteed attributes
+
+rpythondir, this_dir = __dirinfo('pypy')
+
+if __name__ == '__main__':
+    __clone()

rpython/translator/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/c/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/c/gcc/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/c/genc.py

         self.secondary_entrypoints = secondary_entrypoints
 
     def get_eci(self):
-        pypy_include_dir = py.path.local(autopath.pypydir).join('translator', 'c')
+        pypy_include_dir = py.path.local(autopath.rpythondir).join('translator', 'c')
         include_dirs = [pypy_include_dir]
         return ExternalCompilationInfo(include_dirs=include_dirs)
 
     defines['PYPY_LONGLONG_BIT'] = LONGLONG_BIT
 
 def add_extra_files(eci):
-    srcdir = py.path.local(autopath.pypydir).join('translator', 'c', 'src')
+    srcdir = py.path.local(autopath.rpythondir).join('translator', 'c', 'src')
     files = [
         srcdir / 'entrypoint.c',       # ifdef PYPY_STANDALONE
         srcdir / 'allocator.c',        # ifdef PYPY_STANDALONE

rpython/translator/c/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/c/test/test_standalone.py

 from rpython.translator.c.genc import CStandaloneBuilder, ExternalCompilationInfo
 from rpython.annotator.listdef import s_list_of_strings
 from rpython.tool.udir import udir
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from pypy.conftest import option
 
 
 
     def test_separate_files(self):
         # One file in translator/c/src
-        fname = py.path.local(pypydir).join(
+        fname = py.path.local(rpythondir).join(
             'translator', 'c', 'src', 'll_strtod.c')
 
         # One file in (another) subdir of the temp directory

rpython/translator/cli/gencli.py

         if timeout and not sys.platform.startswith('win'):
             import os
             from pypy.tool import autopath
-            watchdog = os.path.join(autopath.pypydir, 'tool', 'watchdog.py')
+            watchdog = os.path.join(autopath.rpythondir, 'tool', 'watchdog.py')
             args[:0] = [sys.executable, watchdog, str(float(timeout))]
         proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         stdout, stderr = proc.communicate()

rpython/translator/cli/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/goal/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/goal/test2/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/goal/test2/test_app_main.py

             assert line.rstrip() == 'Not at all. They could be carried.'
             print 'A five ounce bird could not carry a one pound coconut.'
             """)
-        py_py = os.path.join(autopath.pypydir, 'bin', 'py.py')
+        py_py = os.path.join(autopath.rpythondir, 'bin', 'py.py')
         child = self._spawn(sys.executable, [py_py, '-S', path])
         child.expect('Are you suggesting coconuts migrate?', timeout=120)
         child.sendline('Not at all. They could be carried.')
         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))
+        self.w_trunkdir = self.space.wrap(os.path.dirname(autopath.rpythondir))
         #
         foo_py = prefix.join('foo.py').write("pass")
         self.w_foo_py = self.space.wrap(str(foo_py))

rpython/translator/goal/translate.py

 import py
 # clean up early pypy/_cache
 try:
-    py.path.local(autopath.pypydir).join('_cache').remove()
+    py.path.local(autopath.rpythondir).join('_cache').remove()
 except Exception:
     pass
 

rpython/translator/platform/posix.py

         if path is None:
             path = cfiles[0].dirpath()
 
-        pypypath = py.path.local(autopath.pypydir)
+        pypypath = py.path.local(autopath.rpythondir)
 
         if exe_name is None:
             exe_name = cfiles[0].new(ext=self.exe_ext)
 
         m.comment('automatically generated makefile')
         definitions = [
-            ('PYPYDIR', '"%s"' % autopath.pypydir),
+            ('PYPYDIR', '"%s"' % autopath.rpythondir),
             ('TARGET', target_name),
             ('DEFAULT_TARGET', exe_name.basename),
             ('SOURCES', rel_cfiles),

rpython/translator/platform/windows.py

         if path is None:
             path = cfiles[0].dirpath()
 
-        pypypath = py.path.local(autopath.pypydir)
+        pypypath = py.path.local(autopath.rpythondir)
 
         if exe_name is None:
             exe_name = cfiles[0].new(ext=self.exe_ext)
 
         m.comment('automatically generated makefile')
         definitions = [
-            ('PYPYDIR', autopath.pypydir),
+            ('PYPYDIR', autopath.rpythondir),
             ('TARGET', target_name),
             ('DEFAULT_TARGET', exe_name.basename),
             ('SOURCES', rel_cfiles),

rpython/translator/sandbox/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/sandbox/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/test/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/tool/autopath.py

 
 This module always provides these attributes:
 
-    pypydir    pypy root directory path 
+    rpythondir    rpython root directory path 
     this_dir   directory where this autopath.py resides 
 
 """
         partdir = head
         head, tail = os.path.split(head)
         if tail == part:
-            checkfile = os.path.join(partdir, os.pardir, 'pypy', '__init__.py')
+            checkfile = os.path.join(partdir, os.pardir, 'rpython', '__init__.py')
             if not os.path.exists(checkfile):
                 error = "Cannot find %r" % (os.path.normpath(checkfile),)
             break
     from os.path import join, walk
     if not this_dir.endswith(join('pypy','tool')):
         raise EnvironmentError("can only clone master version "
-                               "'%s'" % join(pypydir, 'tool',_myname))
+                               "'%s'" % join(rpythondir, 'tool',_myname))
 
 
     def sync_walker(arg, dirname, fnames):
                     f.write(arg)
             finally:
                 f.close()
-    s = open(join(pypydir, 'tool', _myname), 'rb').read()
-    walk(pypydir, sync_walker, s)
+    s = open(join(rpythondir, 'tool', _myname), 'rb').read()
+    walk(rpythondir, sync_walker, s)
 
 _myname = 'autopath.py'
 
 # set guaranteed attributes
 
-pypydir, this_dir = __dirinfo('rpython')
+rpythondir, this_dir = __dirinfo('rpython')
 
 if __name__ == '__main__':
     __clone()

rpython/translator/tool/cbuild.py

 import py
 import sys
 
-from pypy.tool.autopath import pypydir
+from rpython.tool.autopath import rpythondir
 from rpython.translator.platform import host
 from rpython.tool.udir import udir