Commits

holger krekel committed 9268676

replacing addgroup/getgroup and py.magic.autopath as advertised

Comments (0)

Files changed (77)

lib-python/conftest.py

 #
 
 def pytest_addoption(parser):
-    group = parser.addgroup("complicance testing options") 
+    group = parser.getgroup("complicance testing options") 
     group.addoption('-T', '--timeout', action="store", type="string", 
        default="1000", dest="timeout", 
        help="fail a test module after the given timeout. "
     pass
 
 from pypy.tool import option
-from py.compat.optparse import make_option
+from optparse import make_option
 from pypy.interpreter import main, interactive, error, gateway
 from pypy.config.config import OptionDescription, BoolOption, StrOption
 from pypy.config.config import Config, to_optparse

pypy/config/config.py

 import py
-from py.compat import optparse
+import optparse
 from pypy.tool.pairtype import extendabletype
 
 SUPPRESS_USAGE = optparse.SUPPRESS_USAGE

pypy/config/makerestdoc.py

 from pypy.config.config import ArbitraryOption, DEFAULT_OPTION_NAME
 from pypy.config.config import _getnegation
 
-configdocdir = py.magic.autopath().dirpath().dirpath().join("doc", "config")
+configdocdir = py.path.local(__file__).dirpath().dirpath().join("doc", "config")
 
 def get_fullpath(opt, path):
     if path:

pypy/config/pypyoption.py

 from pypy.config.config import ChoiceOption, StrOption, to_optparse, Config
 from pypy.config.config import ConflictConfigError
 
-modulepath = py.magic.autopath().dirpath().dirpath().join("module")
+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()]

pypy/config/test/test_pypyoption.py

 from pypy.config.config import Config, ConfigError
 from pypy.config.translationoption import set_opt_level
 
-thisdir = py.magic.autopath().dirpath()
+thisdir = py.path.local(__file__).dirpath()
 
 def test_required():
     conf = get_pypy_config()
 from pypy.tool.udir import udir
 from pypy.tool.autopath import pypydir
 
-rootdir = py.magic.autopath().dirpath()
+rootdir = py.path.local(__file__).dirpath()
 
 # pytest settings
 pytest_plugins = "resultlog",
 option = py.test.config.option
 
 def pytest_addoption(parser):
-    group = parser.addgroup("pypy options")
+    group = parser.getgroup("pypy options")
     group.addoption('--view', action="store_true", dest="view", default=False,
            help="view translation tests' flow graphs with Pygame")
     group.addoption('-A', '--runappdirect', action="store_true",

pypy/doc/config/generate.py

 from pypy.config import pypyoption, translationoption, config
 from pypy.doc.config.confrest import all_optiondescrs
 
-thisdir = py.magic.autopath().dirpath()
+thisdir = py.path.local(__file__).dirpath()
 
 for descr in all_optiondescrs:
     prefix = descr._name

pypy/doc/config/makemodules.py

 import py
 from pypy.config import pypyoption, translationoption, config
 
-thisdir = py.magic.autopath().dirpath()
+thisdir = py.path.local(__file__).dirpath()
 
 if __name__ == '__main__':
     c = config.Config(pypyoption.pypy_optiondescription).usemodules

pypy/doc/confrest.py

         
 
 class Project(Project): 
-    mydir = py.magic.autopath().dirpath()
+    mydir = py.path.local(__file__).dirpath()
 
     title = "PyPy" 
     stylesheet = 'style.css'

pypy/doc/confrest_oldpy.py

     
 
 class Project:
-    mydir = py.magic.autopath().dirpath()
+    mydir = py.path.local(__file__).dirpath()
     title = "py lib"
     prefix_title = ""  # we have a logo already containing "py lib"
     encoding = 'latin1' 

pypy/doc/conftest.py

 import py
 
 from pypy.config.makerestdoc import register_config_role 
-docdir = py.magic.autopath().dirpath()
+docdir = py.path.local(__file__).dirpath()
 
 pytest_plugins = "pytest_restdoc"
 
 def pytest_addoption(parser):
-    group = parser.addgroup("pypy-doc options")
+    group = parser.getgroup("pypy-doc options")
     group.addoption('--pypy-doctests', action="store_true",
            dest="pypy_doctests", default=False, 
            help="enable doctests in .txt files")

pypy/doc/statistic/confrest.py

             " ", id="menubar")
 
 class Project(Project): 
-    mydir = py.magic.autopath().dirpath()
+    mydir = py.path.local(__file__).dirpath()
     title = "PyPy" 
     stylesheet = 'style.css'
     encoding = 'latin1' 

pypy/doc/test_redirections.py

 
 import py 
-redir = py.magic.autopath().dirpath('redirections') 
+redir = py.path.local(__file__).dirpath('redirections') 
 
 def checkexist(path):
     print "checking", path

pypy/doc/tool/makeref.py

 
 import py
-py.magic.autopath()
+py.path.local(__file__)
 import pypy
 pypydir = py.path.local(pypy.__file__).dirpath()
 distdir = pypydir.dirpath() 

pypy/doc/tool/mydot.py

 
 
 if __name__ == '__main__':
-    from py.compat import optparse
+    import optparse
     parser = optparse.OptionParser()
     parser.add_option("-T", dest="format",
                       help="output format")

pypy/jit/backend/test/conftest.py

 option = py.test.config.option
 
 def pytest_addoption(parser):
-    group = parser.addgroup('random test options')
+    group = parser.getgroup('random test options')
     group.addoption('--random-seed', action="store", type="int",
                     default=random.randrange(0, 10000),
                     dest="randomseed",

pypy/jit/conftest.py

 option = py.test.config.option
 
 def pytest_addoption(parser):
-    group = parser.addgroup("JIT options")
+    group = parser.getgroup("JIT options")
     group.addoption('--slow', action="store_true",
            default=False, dest="run_slow_tests",
            help="run all the compiled tests (instead of just a few)")

pypy/jit/tl/conftest.py

 def pytest_addoption(parser):
-    group = parser.addgroup("pypyjit.py options")
+    group = parser.getgroup("pypyjit.py options")
     group.addoption('--ootype', action="store_true", dest="ootype",
                     default=False,
                     help="use ootype")

pypy/jit/tl/targettlc.py

 import time
 import py
-py.magic.autopath()
+py.path.local(__file__)
 from pypy.jit.tl.tlc import interp, interp_nonjit, ConstantPool
 from pypy.jit.metainterp.policy import JitPolicy
 from pypy.jit.backend.hlinfo import highleveljitinfo

pypy/jit/tl/targettlr.py

 import py
-py.magic.autopath()
+py.path.local(__file__)
 from pypy.jit.tl.tlr import interpret
 from pypy.jit.backend.hlinfo import highleveljitinfo
 

pypy/jit/tl/tla/targettla.py

 import py
-py.magic.autopath()
+py.path.local(__file__)
 from pypy.jit.tl.tla import tla
 
 

pypy/jit/tl/tla/tla_assembler.py

 
 import sys
 import py
-py.magic.autopath()
+py.path.local(__file__)
 from pypy.jit.tl.tla.test_tla import assemble
 
 def usage():

pypy/lang/gameboy/debug/gameboy_debug_entry_point.py

 
 # ------------------------------------------------------------------------------
 
-ROM_PATH    = str(py.magic.autopath().dirpath().dirpath())+"/rom"
+ROM_PATH    = str(py.path.local(__file__).dirpath().dirpath())+"/rom"
 # filename    = ROM_PATH + "/rom9/rom9.gb"
 filename = "/home/tverwaes/roms/SuperMarioLand.gb"
 SOCKET_PORT = 55682
 
 # ------------------------------------------------------------------------------ 
     
-MARIO_DIR =  str(py.magic.autopath().dirpath().dirpath()\
+MARIO_DIR =  str(py.path.local(__file__).dirpath().dirpath()\
                         .dirpath().dirpath()\
                         .dirpath().dirpath()) + "/mario"
 

pypy/lang/gameboy/profiling/evaluation/gameboy_evaluation_target.py

 
 
 debug.DEBUG_PRINT_LOGS = False
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath().dirpath())+"/rom"
 
 filename = ""
 if len(sys.argv) > 1:

pypy/lang/gameboy/profiling/gameboyTest.py

 
 
 debug.DEBUG_PRINT_LOGS = False
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath())+"/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath())+"/rom"
 
 filename = ""
 if len(sys.argv) > 1:

pypy/lang/gameboy/test/test_cartridge.py

 def mapToByte(value):
         return ord(value) & 0xFF
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath())+"/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath())+"/rom"
 CONTENT = "abcdefghijklmnopqrstuvwxyz1234567890"
 
 MAPPED_CONTENT = map_to_byte(CONTENT)

pypy/lang/gameboy/test/test_rom.py

 from pypy.lang.gameboy.gameboy import *
 
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath())+"/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath())+"/rom"
 EMULATION_CYCLES = 64
 
 # ------------------------------------------------------------------------------

pypy/lang/js/jsparser.py

 from pypy.rlib.parsing.parsing import ParseError, Rule
 import py
 
-GFILE = py.magic.autopath().dirpath().join("jsgrammar.txt")
+GFILE = py.path.local(__file__).dirpath().join("jsgrammar.txt")
 
 try:
     t = GFILE.read(mode='U')

pypy/lang/js/test/ecma/conftest.py

 
 interpreter.TEST = True
 
-rootdir = py.magic.autopath().dirpath()
+rootdir = py.path.local(__file__).dirpath()
 exclusionlist = ['shell.js', 'browser.js']
 
 def pytest_addoption(parser):

pypy/lang/js/test/test_interactive.py

         return child
 
     def spawn(self, argv):
-        return self._spawn(str(py.magic.autopath().dirpath().dirpath().join('js_interactive.py')), argv)
+        return self._spawn(str(py.path.local(__file__).dirpath().dirpath().join('js_interactive.py')), argv)
     
     def prompt_send(self, message):
         self.child.expect('js>')

pypy/lang/js/test/test_parser.py

 from pypy import conftest
 import sys
 
-GFILE = py.magic.autopath().dirpath().dirpath().join("jsgrammar.txt")
+GFILE = py.path.local(__file__).dirpath().dirpath().join("jsgrammar.txt")
 
 try:
     t = GFILE.read(mode='U')

pypy/lang/prolog/interpreter/conftest.py

 import py, sys
 
-rootdir = py.magic.autopath().dirpath()
+rootdir = py.path.local(__file__).dirpath()
 
 Option = py.test.config.Option
 

pypy/lang/prolog/interpreter/interactive.py

 
 import py
 import sys
-#sys.path.append(str(py.magic.autopath().dirpath().dirpath()))
+#sys.path.append(str(py.path.local(__file__).dirpath().dirpath()))
 
 from pypy.rlib.parsing.parsing import ParseError
 from pypy.rlib.parsing.deterministic import LexerError

pypy/lang/prolog/interpreter/parsing.py

 # generated code between this line and its other occurence
  
 if __name__ == '__main__':
-    f = py.magic.autopath()
+    f = py.path.local(__file__)
     oldcontent = f.read()
     s = "# GENERATED CODE BETWEEN THIS LINE AND ITS OTHER OCCURENCE\n".lower()
     pre, gen, after = oldcontent.split(s)

pypy/lang/scheme/execution.py

         except (TypeError, AttributeError):
             pass
 
-de_file = py.magic.autopath().dirpath().join("r5rs_derived_expr.ss")
+de_file = py.path.local(__file__).dirpath().join("r5rs_derived_expr.ss")
 de_code = de_file.read()
 de_expr_lst = parse(de_code)
 

pypy/lang/scheme/test/test_interactive.py

         return child
 
     def spawn(self, argv=[]):
-        path = py.magic.autopath()/".."/".."/"interactive.py"
+        path = py.path.local(__file__)/".."/".."/"interactive.py"
         return self._spawn(str(path), argv)
 
     def test_interactive(self):

pypy/lang/smalltalk/test/test_miniimage.py

 
 def setup_module(module, filename='mini.image'):
     space = objspace.ObjSpace()
-    module.mini_image = py.magic.autopath().dirpath().dirpath().join(filename)
+    module.mini_image = py.path.local(__file__).dirpath().dirpath().join(filename)
     module.reader = open_miniimage(space)
     reader.initialize()
     module.image = squeakimage.SqueakImage()

pypy/lang/smalltalk/tool/analyseimage.py

 from pypy.lang.smalltalk import interpreter 
 import sys
 
-mini_image = py.magic.autopath().dirpath().dirpath().join('mini.image')
+mini_image = py.path.local(__file__).dirpath().dirpath().join('mini.image')
 
 def get_miniimage(space):
     return squeakimage.ImageReader(space, squeakimage.Stream(mini_image.open()))

pypy/lib/app_test/ctypes_tests/conftest.py

     from pypy.translator.platform import platform
     from pypy.translator.tool.cbuild import ExternalCompilationInfo
     udir = py.test.ensuretemp('_ctypes_test')
-    cfile = py.magic.autopath().dirpath().join("_ctypes_test.c")
+    cfile = py.path.local(__file__).dirpath().join("_ctypes_test.c")
 
     if sys.platform == 'win32':
         libraries = ['oleaut32']

pypy/module/bz2/test/test_bz2_compdecomp.py

 
     mod.TEXT = 'root:x:0:0:root:/root:/bin/bash\nbin:x:1:1:bin:/bin:\ndaemon:x:2:2:daemon:/sbin:\nadm:x:3:4:adm:/var/adm:\nlp:x:4:7:lp:/var/spool/lpd:\nsync:x:5:0:sync:/sbin:/bin/sync\nshutdown:x:6:0:shutdown:/sbin:/sbin/shutdown\nhalt:x:7:0:halt:/sbin:/sbin/halt\nmail:x:8:12:mail:/var/spool/mail:\nnews:x:9:13:news:/var/spool/news:\nuucp:x:10:14:uucp:/var/spool/uucp:\noperator:x:11:0:operator:/root:\ngames:x:12:100:games:/usr/games:\ngopher:x:13:30:gopher:/usr/lib/gopher-data:\nftp:x:14:50:FTP User:/var/ftp:/bin/bash\nnobody:x:65534:65534:Nobody:/home:\npostfix:x:100:101:postfix:/var/spool/postfix:\nniemeyer:x:500:500::/home/niemeyer:/bin/bash\npostgres:x:101:102:PostgreSQL Server:/var/lib/pgsql:/bin/bash\nmysql:x:102:103:MySQL server:/var/lib/mysql:/bin/bash\nwww:x:103:104::/var/www:/bin/false\n'
     mod.DATA = DATA
-    mod.BUGGY_DATA = py.magic.autopath().dirpath().join('data.bz2').read()
+    mod.BUGGY_DATA = py.path.local(__file__).dirpath().join('data.bz2').read()
     mod.decompress = decompress
 
 class AppTestBZ2Compressor(CheckAllocation):

pypy/module/pypyjit/test/conftest.py

 def pytest_addoption(parser):
-    group = parser.addgroup("pypyjit options")
+    group = parser.getgroup("pypyjit options")
     group.addoption("--pypy", action="store", default=None, dest="pypy_c",
                     help="the location of the JIT enabled pypy-c")
 

pypy/objspace/std/test/test_complexobject.py

                 sys.path.append(%r)
                 import helper
                 return helper
-        """ % (str(py.magic.autopath().dirpath())))
+        """ % (str(py.path.local(__file__).dirpath())))
 
     def test_div(self):
         h = self.helper

pypy/rlib/parsing/ebnfparse.py

 # generated code between this line and its other occurence
 
 if __name__ == '__main__':
-    f = py.magic.autopath()
+    f = py.path.local(__file__)
     oldcontent = f.read()
     s = "# GENERATED CODE BETWEEN THIS LINE AND ITS OTHER OCCURENCE\n".lower()
     pre, gen, after = oldcontent.split(s)

pypy/rlib/parsing/makepackrat.py

 
 
 def test_generate():
-    f = py.magic.autopath().dirpath().join("pypackrat.py")
+    f = py.path.local(__file__).dirpath().join("pypackrat.py")
     from pypackrat import PyPackratSyntaxParser
     p = PyPackratSyntaxParser(syntax)
     t = p.file()

pypy/rlib/parsing/regexparse.py

 
 
 def test_generate():
-    f = py.magic.autopath()
+    f = py.path.local(__file__)
     oldcontent = f.read()
     s = "# GENERATED CODE BETWEEN THIS LINE AND ITS OTHER OCCURENCE\n".lower()
     pre, gen, after = oldcontent.split(s)

pypy/rlib/parsing/test/test_pythonlexer.py

         assert tokens[i * 3].name == 'String'
 
 def test_self():
-    s = py.magic.autopath().read()
+    s = py.path.local(__file__).read()
     tokens = pythonlexer.tokenize(s)
     print tokens
 
         "op": "operator",
     }
     import tokenize, token
-    s = py.magic.autopath().read()
+    s = py.path.local(__file__).read()
     tokens = pythonlex(s)
     print [t.name for t in tokens][:20]
     tokens2 = list(tokenize.generate_tokens(iter(s.splitlines(True)).next))

pypy/rlib/parsing/test/test_pythonparse.py

 from pypy.rlib.parsing.parsing import PackratParser, Symbol, ParseError, Rule
 from pypy.rlib.parsing.ebnfparse import parse_ebnf, make_parse_function
 
-grammar = py.magic.autopath().dirpath().join("pygrammar.txt").read(mode='rt')
+grammar = py.path.local(__file__).dirpath().join("pygrammar.txt").read(mode='rt')
 
 
 def test_parse_grammar():
         t = self.ToAST.transform(t)
 
     def test_parse_this(self):
-        s = py.magic.autopath().read()
+        s = py.path.local(__file__).read()
         t = self.parse(s)
         t = self.ToAST.transform(t)
 
     def test_parsing(self):
-        s = py.magic.autopath().dirpath().dirpath().join("parsing.py").read()
+        s = py.path.local(__file__).dirpath().dirpath().join("parsing.py").read()
         t = self.parse(s)
         t = self.ToAST.transform(t)
 

pypy/rlib/rsdl/eci.py

             includes = ['SDL.h'],
             include_dirs = ['/Library/Frameworks/SDL.framework/Headers'],
             link_files = [
-                str(py.magic.autopath().dirpath().join('macosx-sdl-main/SDLMain.m')),
+                str(py.path.local(__file__).dirpath().join('macosx-sdl-main/SDLMain.m')),
             ],
             frameworks = ['SDL', 'Cocoa']
         )

pypy/rlib/test/test_listsort.py

         sorttest(lst1)
 
 def test_file():
-    for fn in py.magic.autopath().dirpath().listdir():
+    for fn in py.path.local(__file__).dirpath().listdir():
         if fn.ext == '.py': 
             lines1 = fn.readlines()
             sorttest(lines1)

pypy/rpython/module/test/test_ll_os_path.py

 from pypy.tool.udir import udir
 
 def test_exists():
-    filename = impl.to_rstr(str(py.magic.autopath()))
+    filename = impl.to_rstr(str(py.path.local(__file__)))
     assert impl.ll_os_path_exists(filename) == True
     assert not impl.ll_os_path_exists(impl.to_rstr(
         "strange_filename_that_looks_improbable.sde"))

pypy/rpython/test/test_rbuiltin.py

         def f(fn):
             fn = hlstr(fn)
             return os.path.exists(fn)
-        filename = self.string_to_ll(str(py.magic.autopath()))
+        filename = self.string_to_ll(str(py.path.local(__file__)))
         assert self.interpret(f, [filename]) == True
         #assert self.interpret(f, [
         #    self.string_to_ll("strange_filename_that_looks_improbable.sde")]) == False
             fn = hlstr(fn)
             return os.path.isdir(fn)
         assert self.interpret(f, [self.string_to_ll("/")]) == True
-        assert self.interpret(f, [self.string_to_ll(str(py.magic.autopath()))]) == False
+        assert self.interpret(f, [self.string_to_ll(str(py.path.local(__file__)))]) == False
         assert self.interpret(f, [self.string_to_ll("another/unlikely/directory/name")]) == False
 
     def test_pbc_isTrue(self):

pypy/tool/bench/pypyresult.py

             
 
 if __name__ == "__main__":
-    x = py.magic.autopath().dirpath("bench-unix.benchmark_result")
+    x = py.path.local(__file__).dirpath("bench-unix.benchmark_result")
     db = ResultDB()
     db.parsepickle(x)
     

pypy/tool/option.py

 import os
 from pypy.config.pypyoption import get_pypy_config
 from pypy.config.config import Config, OptionDescription, to_optparse
-from py.compat import optparse
+import optparse
 
 extra_useage = """For detailed descriptions of all the options see
 http://codespeak.net/pypy/dist/pypy/doc/config/commandline.html"""

pypy/tool/pytest/genreportdata.py

 import py
 import sys
         
-mydir = py.magic.autopath().dirpath().realpath()
+mydir = py.path.local(__file__).dirpath().realpath()
 from pypy.tool.pytest import htmlreport 
 from pypy.tool.pytest import confpath 
 

pypy/tool/pytest/htmlreport.py

         t = self.rep.render_latest_table(self.rep.results)
         assert unicode(t)
 
-mydir = py.magic.autopath().dirpath()
+mydir = py.path.local(__file__).dirpath()
 
 def getpicklepath(): 
     return mydir.join('.htmlreport.pickle')

pypy/tool/pytest/test/test_new_count.py

 import py
 #from pypy.tool.pytest.confpath import testresultdir
 from pypy.tool.pytest.result import ResultFromMime
-testpath = py.magic.autopath().dirpath('data')
+testpath = py.path.local(__file__).dirpath('data')
 
 class TestResultCache:
 

pypy/tool/test/test_conftest1.py

 
 import py
 
-innertest = py.magic.autopath().dirpath('conftest1_innertest.py')
+innertest = py.path.local(__file__).dirpath('conftest1_innertest.py')
 pytest_plugins = "pytest_pytester"
 
 class TestPyPyTests:

pypy/tool/udir.py

         dir = local(dir)
     if basename is None:
         try:
-            p = py.magic.autopath().dirpath()
+            p = py.path.local(__file__).dirpath()
             basename = svn_info(py.path.svnwc(p).info().url)
         except:
             basename = ''

pypy/translator/benchmark/benchmarks.py

 
 def external_dependency(dirname, svnurl, revision):
     """Check out (if necessary) a given fixed revision of a svn url."""
-    dirpath = py.magic.autopath().dirpath().join(dirname)
+    dirpath = py.path.local(__file__).dirpath().join(dirname)
     revtag = dirpath.join('-svn-rev-')
     if dirpath.check():
         if not revtag.check() or int(revtag.read()) != revision:
     return get_result(txt, PYSTONE_PATTERN)
 
 def run_richards(executable='/usr/local/bin/python', n=5):
-    richards = py.magic.autopath().dirpath().dirpath().join('goal').join('richards.py')
+    richards = py.path.local(__file__).dirpath().dirpath().join('goal').join('richards.py')
     txt = run_cmd('"%s" %s %s' % (executable, richards, n))
     return get_result(txt, RICHARDS_PATTERN)
 
 def run_translate(executable='/usr/local/bin/python'):
-    translate = py.magic.autopath().dirpath().dirpath().join('goal').join('translate.py')
-    target = py.magic.autopath().dirpath().dirpath().join('goal').join('targetrpystonedalone.py')
+    translate = py.path.local(__file__).dirpath().dirpath().join('goal').join('translate.py')
+    target = py.path.local(__file__).dirpath().dirpath().join('goal').join('targetrpystonedalone.py')
     argstr = '%s %s --batch --backendopt --no-compile %s > /dev/null 2> /dev/null'
     T = time.time()
     status = os.system(argstr%(executable, translate, target))
 
 def run_docutils(executable='/usr/local/bin/python'):
     docutilssvnpath = 'docutils'    # subdir of the local dir
-    translatetxt = py.magic.autopath().dirpath().dirpath().dirpath().join('doc').join('translation.txt')
+    translatetxt = py.path.local(__file__).dirpath().dirpath().dirpath().join('doc').join('translation.txt')
     command = """import sys
 sys.modules['unicodedata'] = sys # docutils need 'import unicodedata' to work, but no more...
 sys.path[0:0] = ['%s', '%s/extras']
         templess is some simple templating language, to check out use
         'svn co -r100 http://johnnydebris.net/templess/trunk templess'
     """
-    here = py.magic.autopath().dirpath()
+    here = py.path.local(__file__).dirpath()
     pypath = os.path.dirname(os.path.dirname(py.__file__))
     templessdir = here.join('templess')
     testscript = templessdir.join('test/oneshot.py')
 
 def run_gadfly(executable='/usr/local/bin/python'):
     """ run some tests in the gadfly pure Python database """
-    here = py.magic.autopath().dirpath()
+    here = py.path.local(__file__).dirpath()
     gadfly = here.join('gadfly')
     testscript = gadfly.join('test', 'testsubset.py')
     command = 'PYTHONPATH="%s" "%s" "%s"' % (gadfly, executable, testscript)
 
 def run_mako(executable='/usr/local/bin/python'):
     """ run some tests in the mako templating system """
-    here = py.magic.autopath().dirpath()
+    here = py.path.local(__file__).dirpath()
     mako = here.join('mako')
     testscript = mako.join('examples', 'bench', 'basic.py')
     command = 'PYTHONPATH="%s" "%s" "%s" mako' % (mako.join('lib'),

pypy/translator/benchmark/jitbench.py

     response.read()
 
 def run_richards(executable='python'):
-    richards = str(py.magic.autopath().dirpath().dirpath().join('goal').join('richards.py'))
+    richards = str(py.path.local(__file__).dirpath().dirpath().join('goal').join('richards.py'))
     pipe = subprocess.Popen([executable, richards], stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
     return pipe.communicate()

pypy/translator/c/test/test_extfunc.py

     os.unlink(filename)
 
 def test_os_access():
-    filename = str(py.magic.autopath())
+    filename = str(py.path.local(__file__))
     def call_access(path, mode):
         return os.access(path, mode)
     f = compile(call_access, [str, int])
 
 
 def test_os_stat():
-    filename = str(py.magic.autopath())
+    filename = str(py.path.local(__file__))
     has_blksize = hasattr(os.stat_result, 'st_blksize')
     has_blocks = hasattr(os.stat_result, 'st_blocks')
     def call_stat():
 def test_os_fstat():
     if os.environ.get('PYPY_CC', '').startswith('tcc'):
         py.test.skip("segfault with tcc :-(")
-    filename = str(py.magic.autopath())
+    filename = str(py.path.local(__file__))
     def call_fstat():
         fd = os.open(filename, os.O_RDONLY, 0777)
         st = os.fstat(fd)

pypy/translator/cli/conftest.py

 def pytest_addoption(parser):
-    group = parser.addgroup("pypy-cli options")
+    group = parser.getgroup("pypy-cli options")
     group.addoption('--source', action="store_true", dest="source", default=False,
             help="only generate IL source, don't compile")
     group.addoption('--wd', action="store_true", dest="wd", default=False,

pypy/translator/driver.py

 from pypy.annotation import model as annmodel
 from pypy.annotation.listdef import s_list_of_strings
 from pypy.annotation import policy as annpolicy
-from py.compat import optparse
+import optparse
 from pypy.tool.udir import udir
 from pypy.rlib.jit import DEBUG_OFF, DEBUG_DETAILED, DEBUG_PROFILE, DEBUG_STEPS
 

pypy/translator/goal/targetgbfullprofiling.py

 from pypy.lang.gameboy.profiling.gameboy_profiling_implementation import GameBoyProfiler
 
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
 
 def entry_point(argv=None):
     if argv is not None and len(argv) > 1:

pypy/translator/goal/targetgbimplementation.py

 from pypy.lang.gameboy.gameboy_implementation import GameBoyImplementation
 
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
 
 print ROM_PATH
 

pypy/translator/goal/targetgbrom4.py

 from pypy.lang.gameboy.gameboy import GameBoy
 
 
-ROM_PATH = str(py.magic.autopath().dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
+ROM_PATH = str(py.path.local(__file__).dirpath().dirpath().dirpath())+"/lang/gameboy/rom"
 EMULATION_CYCLES = 1<<24
 
 

pypy/translator/goal/targetpreimportedpypy.py

     "random",
 ]
 
-thisdir = py.magic.autopath().dirpath()
+thisdir = py.path.local(__file__).dirpath()
 
 try:
     this_dir = os.path.dirname(__file__)

pypy/translator/goal/targetpypystandalone.py

 from pypy.tool.option import make_objspace
 from pypy.translator.goal.nanos import setup_nanos
 
-thisdir = py.magic.autopath().dirpath()
+thisdir = py.path.local(__file__).dirpath()
 
 try:
     this_dir = os.path.dirname(__file__)

pypy/translator/goal/translate.py

 
 import py
 # we want 2.4 expand_default functionality
-optparse = py.compat.optparse
+import optparse
 from pypy.tool.ansi_print import ansi_log
 log = py.log.Producer("translation")
 py.log.setconsumer("translation", ansi_log)

pypy/translator/interactive.py

-from py.compat import optparse
+import optparse
 
 import autopath
 from pypy.translator.translator import TranslationContext

pypy/translator/jvm/conftest.py

 
 def pytest_addoption(parser):
-    group = parser.addgroup("pypy-jvm options")
+    group = parser.getgroup("pypy-jvm options")
     group.addoption('--java', action='store', dest='java', default='java',
             help='Define the java executable to use')
     group.addoption('--javac', action='store', dest='javac',

pypy/translator/jvm/genjvm.py

         self.jasmin_files = None
         
         # Determine various paths:
-        self.thisdir = py.magic.autopath().dirpath()
+        self.thisdir = py.path.local(__file__).dirpath()
         self.rootdir = self.thisdir.join('src')
         self.srcdir = self.rootdir.join('pypy')
         self.jnajar = self.rootdir.join('jna.jar')

pypy/translator/platform/test/test_darwin.py

             return 0;
         }
         ''')
-        includedir = py.magic.autopath().dirpath().join('include')
+        includedir = py.path.local(__file__).dirpath().join('include')
         eci = ExternalCompilationInfo(frameworks=('Cocoa',),
                                       include_dirs=(includedir,))
         executable = self.platform.compile([objcfile], eci)

pypy/translator/platform/test/test_maemo.py

             return 0;
         }
         ''')
-        includedir = py.magic.autopath().dirpath().join('include')
+        includedir = py.path.local(__file__).dirpath().join('include')
         eci = ExternalCompilationInfo(include_dirs=(includedir,))
         executable = self.platform.compile([cfile], eci)
         res = self.platform.execute(executable)

pypy/translator/test/test_driver.py

 import py
 
 from pypy.translator.driver import TranslationDriver
-from py.compat import optparse
+import optparse
 
 def test_ctr():
     td = TranslationDriver()

pytest_resultlog.py

 import py
 
 def pytest_addoption(parser):
-    group = parser.addgroup("resultlog", "resultlog plugin options")
+    group = parser.getgroup("resultlog", "resultlog plugin options")
     group.addoption('--resultlog', action="store", dest="resultlog", metavar="path", default=None,
            help="path for machine-readable result log.")