[pypy-svn] r37995 - in pypy/branch/pytrunkmerge/pypy: config doc/config lang/js lang/js/test module/__builtin__ objspace/std objspace/std/test tool/build tool/build/test translator/c/winproj/extension translator/c/winproj/standalone

fijal at codespeak.net fijal at codespeak.net
Tue Feb 6 11:50:23 CET 2007


Author: fijal
Date: Tue Feb  6 11:50:16 2007
New Revision: 37995

Added:
   pypy/branch/pytrunkmerge/pypy/lang/js/driver.py
      - copied unchanged from r37994, pypy/dist/pypy/lang/js/driver.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/listmultiobject.py
      - copied unchanged from r37994, pypy/dist/pypy/objspace/std/listmultiobject.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/test/test_listmultiobject.py
      - copied unchanged from r37994, pypy/dist/pypy/objspace/std/test/test_listmultiobject.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/__init__.py
      - copied unchanged from r37994, pypy/dist/pypy/tool/build/test/__init__.py
Modified:
   pypy/branch/pytrunkmerge/pypy/config/pypyoption.py
   pypy/branch/pytrunkmerge/pypy/doc/config/objspace.opcodes.CALL_LIKELY_BUILTIN.txt
   pypy/branch/pytrunkmerge/pypy/doc/config/objspace.std.withtypeversion.txt
   pypy/branch/pytrunkmerge/pypy/lang/js/interpreter.py
   pypy/branch/pytrunkmerge/pypy/lang/js/jsobj.py
   pypy/branch/pytrunkmerge/pypy/lang/js/jsparser.py
   pypy/branch/pytrunkmerge/pypy/lang/js/test/test_interp.py
   pypy/branch/pytrunkmerge/pypy/module/__builtin__/app_help.py
   pypy/branch/pytrunkmerge/pypy/module/__builtin__/functional.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/listtype.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/model.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/objspace.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/stringobject.py
   pypy/branch/pytrunkmerge/pypy/objspace/std/test/test_listobject.py
   pypy/branch/pytrunkmerge/pypy/tool/build/build.py
   pypy/branch/pytrunkmerge/pypy/tool/build/buildserver.py
   pypy/branch/pytrunkmerge/pypy/tool/build/metaserver.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/fake.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/test_build.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/test_buildserver.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/test_metaserver.py
   pypy/branch/pytrunkmerge/pypy/tool/build/test/test_pypybuilder.py
   pypy/branch/pytrunkmerge/pypy/translator/c/winproj/extension/extension.vcproj
   pypy/branch/pytrunkmerge/pypy/translator/c/winproj/standalone/standalone.vcproj
Log:
svn merge -r 37858:HEAD http://codespeak.net/svn/pypy/dist/pypy .


Modified: pypy/branch/pytrunkmerge/pypy/config/pypyoption.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/config/pypyoption.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/config/pypyoption.py	Tue Feb  6 11:50:16 2007
@@ -170,6 +170,16 @@
         IntOption("methodcachesize",
                   "size of the method cache (should be a power of 2)",
                   default=2048),
+        BoolOption("withmultilist",
+                   "use lists optimized for flexibility",
+                   default=False,
+                   requires=[("objspace.std.withrangelist", False),
+                             ("objspace.name", "std"),
+                             ("objspace.std.withtproxy", False)]),
+        BoolOption("withfastslice",
+                   "make list slicing lazy",
+                   default=False,
+                   requires=[("objspace.std.withmultilist", True)]),
         BoolOption("optimized_int_add",
                    "special case the addition of two integers in BINARY_ADD",
                    default=False),

Modified: pypy/branch/pytrunkmerge/pypy/doc/config/objspace.opcodes.CALL_LIKELY_BUILTIN.txt
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/doc/config/objspace.opcodes.CALL_LIKELY_BUILTIN.txt	(original)
+++ pypy/branch/pytrunkmerge/pypy/doc/config/objspace.opcodes.CALL_LIKELY_BUILTIN.txt	Tue Feb  6 11:50:16 2007
@@ -4,5 +4,5 @@
 then tracked, which builtin name is shadowed in this module. If the
 ``CALL_LIKELY_BUILTIN`` opcode is executed, it is checked whether the builtin is
 shadowed. If not, the corresponding builtin is called. Otherwise the object that
-is shadowing it is called instead. If no shadowing is happening, this safes two
+is shadowing it is called instead. If no shadowing is happening, this saves two
 dictionary lookups on calls to builtins.

Modified: pypy/branch/pytrunkmerge/pypy/doc/config/objspace.std.withtypeversion.txt
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/doc/config/objspace.std.withtypeversion.txt	(original)
+++ pypy/branch/pytrunkmerge/pypy/doc/config/objspace.std.withtypeversion.txt	Tue Feb  6 11:50:16 2007
@@ -1,4 +1,4 @@
 This (mostly internal) option enables "type versions": Every type object gets an
 (only internally visible) version that is updated when the type's dict is
-changed. This is e.g. used for invalidating cashes. It does not make sense to
+changed. This is e.g. used for invalidating caches. It does not make sense to
 enable this option alone.

Modified: pypy/branch/pytrunkmerge/pypy/lang/js/interpreter.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/lang/js/interpreter.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/lang/js/interpreter.py	Tue Feb  6 11:50:16 2007
@@ -69,7 +69,6 @@
         self.right = get_obj(t, '1')
     
 class BinaryComparisonOp(BinaryOp):
-    """super class for binary operators"""
     def eval(self, ctx):
         s2 = self.left.eval(ctx).GetValue()
         s4 = self.right.eval(ctx).GetValue()
@@ -81,7 +80,6 @@
         raise NotImplementedError
 
 class BinaryLogicOp(BinaryOp):
-    """super class for binary operators"""
     pass
 
 def writer(x):
@@ -130,6 +128,11 @@
         return W_Boolean(args[0].ToBoolean())
     return W_Boolean(False)
 
+def stringjs(ctx, args, this):
+    if len(args) > 0:
+        return W_String(args[0].ToString())
+    return W_String('')
+
 def numberjs(ctx, args, this):
     if len(args) > 0:
         return W_Number(args[0].ToNumber())
@@ -172,6 +175,7 @@
         w_math.Put('abs', W_Builtin(absjs, Class='function'))
         w_math.Put('floor', W_Builtin(floorjs, Class='function'))
         
+        w_Global.Put('String', W_Builtin(stringjs, Class='String'))
         
         #Global Properties
         w_Global.Put('Object', w_Object)
@@ -179,6 +183,7 @@
         w_Global.Put('Array', W_Array())
         w_Global.Put('version', W_Builtin(versionjs))
         
+        #Number
         w_Number = W_Builtin(numberjs, Class="Number")
         w_Number.Put('NaN', W_Number(NaN))
         w_Number.Put('POSITIVE_INFINITY', W_Number(Infinity))
@@ -217,7 +222,7 @@
         #d = dict(enumerate(self.items))
         array = W_Array()
         for i in range(len(self.list)):
-            array.Put(str(i), self.list[i])
+            array.Put(str(i), self.list[i].eval(ctx).GetValue())
         return array
 
 
@@ -611,6 +616,15 @@
         fright = nright.ToNumber()
         return W_Number(fleft * fright)
 
+class Mod(BinaryNumberOp):
+    opcode = 'MOD'
+    
+    def mathop(self, ctx, nleft, nright):
+        fleft = nleft.ToNumber()
+        fright = nright.ToNumber()
+        return W_Number(fleft % fright)
+
+
 class Div(BinaryNumberOp):
     opcode = 'DIV'
     
@@ -657,6 +671,8 @@
             ctx.variable.Put(var.name, w_Undefined)
         for fun in self.func_decl:
             ctx.variable.Put(fun.name, fun.eval(ctx))
+        
+        node = self
 
         try:
             last = w_Undefined
@@ -843,11 +859,18 @@
         return W_Boolean(not self.expr.eval(ctx).GetValue().ToBoolean())
 
 class UMinus(UnaryOp):
-    opcode = "UNARY_MINUS"
+    opcode = 'UNARY_MINUS'
     
     def eval(self, ctx):
         return W_Number(-self.expr.eval(ctx).GetValue().ToNumber())
 
+class UPlus(UnaryOp):
+    opcode = 'UNARY_PLUS'
+    
+    def eval(self, ctx):
+        return W_Number(+self.expr.eval(ctx).GetValue().ToNumber())
+
+
 astundef = Undefined()
 def get_obj(t, objname):
     item = get_tree_item(t, objname)
@@ -859,7 +882,7 @@
 def get_string(t, string):
         simb = get_tree_item(t, string)
         if isinstance(simb, Symbol):
-            return simb.additional_info
+            return str(simb.additional_info)
         else:
             return ''
 
@@ -877,7 +900,7 @@
             if x.children[0].additional_info == name:
                 return x.children[1]
     return None
-
+    
 opcodedict = {}
 for i in locals().values():
     if isinstance(i, type(Node)) and issubclass(i, Node):

Modified: pypy/branch/pytrunkmerge/pypy/lang/js/jsobj.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/lang/js/jsobj.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/lang/js/jsobj.py	Tue Feb  6 11:50:16 2007
@@ -1,6 +1,6 @@
 # encoding: utf-8
 
-DEBUG = True
+DEBUG = False
 
 class SeePage(NotImplementedError):
     pass
@@ -129,7 +129,7 @@
         if callfunc is not None:
             self.Scope = ctx.scope[:] 
         else:
-            self.Scope = []
+            self.Scope = None
         self.Value = Value
 
     def Call(self, ctx, args=[], this=None):
@@ -229,15 +229,15 @@
         else:
             return 'object'
     
-    def str_builtin(self, ctx, args, this):
-        return W_String(self.ToString())
+def str_builtin(ctx, args, this):
+    return W_String(this.ToString())
 
 class W_Object(W_PrimitiveObject):
     def __init__(self, ctx=None, Prototype=None, Class='Object',
                  Value=w_Undefined, callfunc=None):
         W_PrimitiveObject.__init__(self, ctx, Prototype,
                                    Class, Value, callfunc)
-        self.propdict['toString'] = Property('toString', W_Builtin(self.str_builtin))
+        self.propdict['toString'] = Property('toString', W_Builtin(str_builtin))
 
 
 class W_Builtin(W_PrimitiveObject):
@@ -280,8 +280,7 @@
     def __init__(self, ctx=None, Prototype=None, Class='Array',
                  Value=w_Undefined, callfunc=None):
         W_PrimitiveObject.__init__(self, ctx, Prototype, Class, Value, callfunc)
-        toString = W_Builtin()
-        toString.set_builtin_call(self.str_builtin)
+        toString = W_Builtin(array_str_builtin)
         self.Put('toString', toString)
         self.Put('length', W_Number(0))
         self.array = []
@@ -317,12 +316,13 @@
         except ValueError:
             return W_PrimitiveObject.Get(self, P)
     
-    def str_builtin(self, ctx, args, this):
-        return W_String(ToString())
-
     def ToString(self):
         return ','.join(self.array)
 
+def array_str_builtin(ctx, args, this):
+    return W_String(this.ToString())
+
+
 
 class W_Boolean(W_Primitive):
     def __init__(self, boolval):

Modified: pypy/branch/pytrunkmerge/pypy/lang/js/jsparser.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/lang/js/jsparser.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/lang/js/jsparser.py	Tue Feb  6 11:50:16 2007
@@ -28,12 +28,9 @@
     jsdir = py.path.local(__file__).dirpath().join("js")
     jsdefs = jsdir.join("jsdefs.js").read()
     jsparse = jsdir.join("jsparse.js").read()
-    f = open('/tmp/jstobeparsed.js','w')
-    f.write(jsdefs)
-    f.write(jsparse)
-    f.write("print(parse('%s'));\n" % stripped_code)
-    f.close()
-    pipe = os.popen("js -f /tmp/jstobeparsed.js", 'r')
+    f = py.test.ensuretemp("jsinterp").join("tobeparsed.js")
+    f.write(jsdefs+jsparse+"print(parse('%s'));\n" % stripped_code)
+    pipe = os.popen("js -f "+str(f), 'r')
     retval = pipe.read()
     if not retval.startswith("{"):
         raise JsSyntaxError(retval)
@@ -42,8 +39,7 @@
 def unquote(t):
     if isinstance(t, Symbol):
         if t.symbol == "QUOTED_STRING":
-            t.additional_info = t.additional_info.strip("'")
-            t.additional_info = re.sub(r"\\'", r"'", t.additional_info)
+            t.additional_info = t.additional_info.strip("'").replace("\\'", "'")
     else:
         for i in t.children:
             unquote(i)

Modified: pypy/branch/pytrunkmerge/pypy/lang/js/test/test_interp.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/lang/js/test/test_interp.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/lang/js/test/test_interp.py	Tue Feb  6 11:50:16 2007
@@ -447,4 +447,10 @@
         var testcases = new Array();
         var tc = testcases.length;
         print('tc'+tc) 
-        """, ['tc0'])
\ No newline at end of file
+        """, ['tc0'])
+    
+    def test_mod_op(self):
+        self.assert_prints("print(2%2)", ['0'])
+    
+    def test_unary_plus(self):
+        self.assert_prints("print(+1)", ['1'])

Modified: pypy/branch/pytrunkmerge/pypy/module/__builtin__/app_help.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/module/__builtin__/app_help.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/module/__builtin__/app_help.py	Tue Feb  6 11:50:16 2007
@@ -10,12 +10,12 @@
     exit = "Use Ctrl-D (i.e. EOF) to exit."
 
 def copyright():
-    print 'Copyright 2003-2004 Pypy development team.\nAll rights reserved.\nFor further information see http://www.codespeak.net/pypy.\nSome materials may have a different copyright.\nIn these cases, this is explicitly noted in the source code file.'
+    print 'Copyright 2003-2007 PyPy development team.\nAll rights reserved.\nFor further information see http://www.codespeak.net/pypy.\nSome materials may have a different copyright.\nIn these cases, this is explicitly noted in the source code file.'
 
 def license():
     print \
 """
-Copyright (c) <2003-2005> <Pypy development team>
+Copyright (c) <2003-2007> <PyPy development team>
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 

Modified: pypy/branch/pytrunkmerge/pypy/module/__builtin__/functional.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/module/__builtin__/functional.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/module/__builtin__/functional.py	Tue Feb  6 11:50:16 2007
@@ -69,8 +69,9 @@
 get a list in decending order."""
 
     if (space.config.objspace.name == "std" and
-        space.config.objspace.std.withrangelist):
-        return range_withrangelist(space, w_x, w_y, w_step)
+        (space.config.objspace.std.withmultilist or
+         space.config.objspace.std.withrangelist)):
+        return range_withspecialized_implementation(space, w_x, w_y, w_step)
     try:
         # save duplication by redirecting every error to applevel
         x = space.int_w(w_x)
@@ -96,11 +97,9 @@
 range_fallback = applevel(getsource(app_range), getfile(app_range)
                           ).interphook('range')
 
-def range_withrangelist(space, w_x, w_y, w_step):
+def range_withspecialized_implementation(space, w_x, w_y, w_step):
     # XXX object space dependant
-    from pypy.objspace.std.rangeobject import W_RangeListObject
     try:
-        # save duplication by redirecting every error to applevel
         x = space.int_w(w_x)
         if space.is_w(w_y, space.w_None):
             start, stop = 0, x
@@ -110,5 +109,12 @@
         howmany = get_len_of_range(start, stop, step)
     except (OperationError, ValueError, OverflowError):
         return range_fallback(space, w_x, w_y, w_step)
-    return W_RangeListObject(start, step, howmany)
+    if space.config.objspace.std.withrangelist:
+        from pypy.objspace.std.rangeobject import W_RangeListObject
+        return W_RangeListObject(start, step, howmany)
+    if space.config.objspace.std.withmultilist:
+        from pypy.objspace.std.listmultiobject import W_ListMultiObject
+        from pypy.objspace.std.listmultiobject import RangeImplementation
+        impl = RangeImplementation(space, start, step, howmany)
+        return W_ListMultiObject(space, impl)
 

Modified: pypy/branch/pytrunkmerge/pypy/objspace/std/listtype.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/objspace/std/listtype.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/objspace/std/listtype.py	Tue Feb  6 11:50:16 2007
@@ -40,9 +40,14 @@
 # ____________________________________________________________
 
 def descr__new__(space, w_listtype, __args__):
-    from pypy.objspace.std.listobject import W_ListObject
-    w_obj = space.allocate_instance(W_ListObject, w_listtype)
-    W_ListObject.__init__(w_obj, [])
+    if space.config.objspace.std.withmultilist:
+        from pypy.objspace.std.listmultiobject import W_ListMultiObject
+        w_obj = space.allocate_instance(W_ListMultiObject, w_listtype)
+        W_ListMultiObject.__init__(w_obj, space)
+    else:
+        from pypy.objspace.std.listobject import W_ListObject
+        w_obj = space.allocate_instance(W_ListObject, w_listtype)
+        W_ListObject.__init__(w_obj, [])
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/branch/pytrunkmerge/pypy/objspace/std/model.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/objspace/std/model.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/objspace/std/model.py	Tue Feb  6 11:50:16 2007
@@ -16,6 +16,7 @@
                         "dictstrobject.W_DictStrIterObject"],
     "withmultidict"  : ["dictmultiobject.W_DictMultiObject",
                         "dictmultiobject.W_DictMultiIterObject"],
+    "withmultilist"  : ["listmultiobject.W_ListMultiObject"],
     "withrangelist"  : ["rangeobject.W_RangeListObject",
                         "rangeobject.W_RangeIterObject"],
     "withtproxy" : ["proxyobject.W_TransparentList",
@@ -65,6 +66,7 @@
         from pypy.objspace.std import dictobject
         from pypy.objspace.std import dictstrobject
         from pypy.objspace.std import dictmultiobject
+        from pypy.objspace.std import listmultiobject
         from pypy.objspace.std import stringobject
         from pypy.objspace.std import strsliceobject
         from pypy.objspace.std import strjoinobject
@@ -112,6 +114,7 @@
         imported_but_not_registered = {
             dictobject.W_DictObject: True,
             dictobject.W_DictIterObject: True,
+            listobject.W_ListObject: True,
         }
         for option, value in config.objspace.std:
             if option.startswith("with") and option in option_to_typename:
@@ -127,6 +130,9 @@
             del self.typeorder[dictobject.W_DictObject]
             del self.typeorder[dictobject.W_DictIterObject]
 
+        if config.objspace.std.withmultilist:
+            del self.typeorder[listobject.W_ListObject]
+
         #check if we missed implementations
         from pypy.objspace.std.objspace import _registered_implementations
         for implcls in _registered_implementations:

Modified: pypy/branch/pytrunkmerge/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/objspace/std/objspace.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/objspace/std/objspace.py	Tue Feb  6 11:50:16 2007
@@ -348,7 +348,7 @@
             return W_TupleObject(wrappeditems)
         if isinstance(x, list):
             wrappeditems = [self.wrap(item) for item in x]
-            return W_ListObject(wrappeditems)
+            return self.newlist(wrappeditems)
 
         # The following cases are even stranger.
         # Really really only for tests.
@@ -432,7 +432,12 @@
         return W_TupleObject(list_w)
 
     def newlist(self, list_w):
-        return W_ListObject(list_w)
+        if self.config.objspace.std.withmultilist:
+            from pypy.objspace.std.listmultiobject import convert_list_w
+            return convert_list_w(self, list_w)
+        else:
+            from pypy.objspace.std.listobject import W_ListObject
+            return W_ListObject(list_w)
 
     def newdict(self, track_builtin_shadowing=False):
         if self.config.objspace.opcodes.CALL_LIKELY_BUILTIN and track_builtin_shadowing:

Modified: pypy/branch/pytrunkmerge/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/objspace/std/stringobject.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/objspace/std/stringobject.py	Tue Feb  6 11:50:16 2007
@@ -233,7 +233,7 @@
         # continue to look from the character following the space after the word
         i = j + 1
 
-    return W_ListObject(res_w)
+    return space.newlist(res_w)
 
 
 def str_split__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
@@ -256,7 +256,7 @@
 
     res_w.append(sliced(space, value, start, len(value)))
 
-    return W_ListObject(res_w)
+    return space.newlist(res_w)
 
 def str_rsplit__String_None_ANY(space, w_self, w_none, w_maxsplit=-1):
     maxsplit = space.int_w(w_maxsplit)
@@ -291,7 +291,7 @@
         i = j - 1
 
     res_w.reverse()
-    return W_ListObject(res_w)
+    return space.newlist(res_w)
 
 def str_rsplit__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
     maxsplit = space.int_w(w_maxsplit)
@@ -313,7 +313,7 @@
 
     res_w.append(sliced(space, value, 0, end))
     res_w.reverse()
-    return W_ListObject(res_w)
+    return space.newlist(res_w)
 
 def str_join__String_ANY(space, w_self, w_list):
     list_w = space.unpackiterable(w_list)

Modified: pypy/branch/pytrunkmerge/pypy/objspace/std/test/test_listobject.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/objspace/std/test/test_listobject.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/objspace/std/test/test_listobject.py	Tue Feb  6 11:50:16 2007
@@ -429,7 +429,26 @@
         l = ['a', 'C', 'b']
         l.sort(reverse = True, key = lower)
         assert l == ['C', 'b', 'a']
-        
+    
+    def test_getitem(self):
+        l = [1, 2, 3, 4, 5, 6, 9]
+        assert l[0] == 1
+        assert l[-1] == 9
+        assert l[-2] == 6
+        raises(IndexError, "l[len(l)]")
+        raises(IndexError, "l[-len(l)-1]")
+
+    def test_delitem(self):
+        l = [1, 2, 3, 4, 5, 6, 9]
+        del l[0]
+        assert l == [2, 3, 4, 5, 6, 9]
+        del l[-1]
+        assert l == [2, 3, 4, 5, 6]
+        del l[-2]
+        assert l == [2, 3, 4, 6]
+        raises(IndexError, "del l[len(l)]")
+        raises(IndexError, "del l[-len(l)-1]")
+
     def test_extended_slice(self):
         l = range(10)
         del l[::2]

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/build.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/build.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/build.py	Tue Feb  6 11:50:16 2007
@@ -122,7 +122,7 @@
                 self.svnrev, self.revrange)
 
     def serialize(self):
-        data = {'normalized_rev': self.normalized_rev}
+        data = {'normalized_rev': self.normalized_rev} # it's a property
         data.update(self.__dict__)
         return """\
 email: %(email)s

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/buildserver.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/buildserver.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/buildserver.py	Tue Feb  6 11:50:16 2007
@@ -1,11 +1,12 @@
 import py
 import thread
-from zipfile import ZipFile
+from zipfile import ZipFile, ZIP_DEFLATED
 from cStringIO import StringIO
 from pypy.tool.build import build
 
 class BuildServer(object):
-    def __init__(self, channel, sysinfo, testing_sleeptime=False):
+    def __init__(self, channel, sysinfo, hostname, testing_sleeptime=False):
+        self.hostname = hostname
         self.channel = channel
         self.sysinfo = sysinfo
         self.busy_on = None
@@ -72,7 +73,7 @@
 
     try:
         try:
-            bs = BuildServer(channel, %r, %r)
+            bs = BuildServer(channel, %r, %r, %r)
             bs.sit_and_wait()
         except:
             try:
@@ -97,6 +98,7 @@
     sysinfo = make_dict(sysconfig)
     conference = execnetconference.conference(gw, port, False)
     channel = conference.remote_exec(initcode % (path, sysinfo,
+                                                 py.std.socket.gethostname(),
                                                  testing_sleeptime))
     return channel
 
@@ -124,12 +126,12 @@
         pass
 
 def zip_dir(res_dir, tofile):
-    zip = ZipFile(tofile, 'w')
+    zip = ZipFile(tofile, 'w', ZIP_DEFLATED)
     for fpath in res_dir.visit():
         if fpath.ext in ['.o']:
             continue
         try:
-            zip.writestr(fpath.relto(res_dir), fpath.read())
+            zip.writestr("pypy-compiled/" + fpath.relto(res_dir), fpath.read())
         except (py.error.ENOENT, py.error.EISDIR), exc:
             print exc
             continue

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/metaserver.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/metaserver.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/metaserver.py	Tue Feb  6 11:50:16 2007
@@ -26,7 +26,7 @@
     return True
 
 class MetaServer(object):
-    """ the build server
+    """ the build meta-server
 
         this delegates or queues build requests, and stores results and sends
         out emails when they're done
@@ -88,13 +88,17 @@
                 return (True, path)
         for builder in self._builders:
             if builder.busy_on and request.has_satisfying_data(builder.busy_on):
-                self._channel.send('build for %s currently in progress' %
-                                   (request,))
+                self._channel.send(
+                    "build for %s currently in progress on '%s'" % (
+                        request, builder.hostname))
                 self._waiting.append(request)
-                return (False, 'this build is already in progress')
+                return (False, "this build is already in progress on '%s'" % (
+                    builder.hostname, ))
         # we don't have a build for this yet, find a builder to compile it
-        if self.run(request):
-            return (False, 'found a suitable build server, going to build')
+        hostname = self.run(request)
+        if hostname is not None:
+            return (False, "found a suitable server, going to build on '%s'" % 
+                    (hostname, ))
         self._queuelock.acquire()
         try:
             self._queued.append(request)
@@ -117,13 +121,13 @@
             else:
                 self._channel.send(
                     'going to send compile job for request %s to %s' % (
-                        request, builder
+                        request, builder.hostname
                     )
                 )
                 accepted = builder.compile(request)
                 if accepted:
                     self._channel.send('compile job accepted')
-                    return True
+                    return builder.hostname
                 else:
                     self._channel.send('compile job denied')
         self._channel.send(

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/test/fake.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/test/fake.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/test/fake.py	Tue Feb  6 11:50:16 2007
@@ -16,12 +16,13 @@
     def waitclose(self):
         pass
 
-class FakeClient(object):
+class FakeBuildserver(object):
     def __init__(self, info):
         self.channel = FakeChannel()
         self.sysinfo = info
         self.busy_on = None
         self.refused = []
+        self.hostname = "fake"
 
     def compile(self, request):
         self.channel.send(request.serialize())

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/test/test_build.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/test/test_build.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/test/test_build.py	Tue Feb  6 11:50:16 2007
@@ -1,8 +1,8 @@
 import py
-from pypy.tool.build import build
 from py.__.misc.cache import AgingCache
 from py.__.path.svn import urlcommand
-from repo import create_temp_repo
+from pypy.tool.build import build
+from pypy.tool.build.test.repo import create_temp_repo
 
 def setup_module(mod):
     # remove nasty cache from py.path.svnurl to allow this to work...

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/test/test_buildserver.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/test/test_buildserver.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/test/test_buildserver.py	Tue Feb  6 11:50:16 2007
@@ -1,12 +1,13 @@
-import path
-from pypy.tool.build import buildserver
-from pypy.tool.build import build
 import py
-import time
+import path
 import sys
-from zipfile import ZipFile
 from StringIO import StringIO
-from fake import FakeChannel, FakeMetaServer
+import time
+from zipfile import ZipFile
+
+from pypy.tool.build import buildserver
+from pypy.tool.build import build
+from pypy.tool.build.test.fake import FakeChannel, FakeMetaServer
 
 class BuildServerForTests(buildserver.BuildServer):
     def __init__(self, *args, **kwargs):
@@ -24,11 +25,11 @@
     pypy.tool.build.metaserver_instance = svr
 
     mod.c1c = c1c = FakeChannel()
-    mod.c1 = c1 = BuildServerForTests(c1c, {'foo': 1, 'bar': [1,2]})
+    mod.c1 = c1 = BuildServerForTests(c1c, {'foo': 1, 'bar': [1,2]}, "noname")
     svr.register(c1)
 
     mod.c2c = c2c = FakeChannel()
-    mod.c2 = c2 = BuildServerForTests(c2c, {'foo': 2, 'bar': [2,3]})
+    mod.c2 = c2 = BuildServerForTests(c2c, {'foo': 2, 'bar': [2,3]}, "noname")
     svr.register(c2)
 
 def test_compile():
@@ -93,10 +94,10 @@
 
     zip.seek(0)
     zf = ZipFile(zip)
-    data = zf.read('foo/bar.txt')
+    data = zf.read('pypy-compiled/foo/bar.txt')
     assert data == 'bar'
 
-    py.test.raises(KeyError, 'zf.read("foo/bar.o")')
+    py.test.raises(KeyError, 'zf.read("pypy-compiled/foo/bar.o")')
 
 def test_tempdir():
     parent = py.test.ensuretemp('tempdir')

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/test/test_metaserver.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/test/test_metaserver.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/test/test_metaserver.py	Tue Feb  6 11:50:16 2007
@@ -1,10 +1,11 @@
+import py
 import path
+import time
+
 from pypy.tool.build import metaserver
-import py
-from fake import FakeChannel, FakeClient, Container
+from pypy.tool.build.test.fake import FakeChannel, FakeBuildserver, Container
 from pypy.tool.build import build
-import time
-from repo import create_temp_repo
+from pypy.tool.build.test.repo import create_temp_repo
 
 def setup_module(mod):
     mod.temppath = temppath = py.test.ensuretemp('pypybuilder-server')
@@ -12,10 +13,10 @@
                        mailhost=None)
     mod.svr = metaserver.MetaServer(config, FakeChannel())
     
-    mod.c1 = FakeClient({'foo': 1, 'bar': [1,2]})
+    mod.c1 = FakeBuildserver({'foo': 1, 'bar': [1,2]})
     mod.svr.register(mod.c1)
 
-    mod.c2 = FakeClient({'foo': 2, 'bar': [2,3]})
+    mod.c2 = FakeBuildserver({'foo': 2, 'bar': [2,3]})
     mod.svr.register(mod.c2)
 
 def test_server_issubdict():
@@ -52,7 +53,8 @@
                             str(repodir), 'HEAD', 0)
     ret = svr.compile(br)
     assert not ret[0]
-    assert ret[1].find('found a suitable build server') > -1
+    assert ret[1].find('found a suitable server') > -1
+    assert "fake" in ret[1] # hostname
     ret = svr._channel.receive()
     assert ret.find('going to send compile job') > -1
     acceptedmsg = svr._channel.receive()

Modified: pypy/branch/pytrunkmerge/pypy/tool/build/test/test_pypybuilder.py
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/tool/build/test/test_pypybuilder.py	(original)
+++ pypy/branch/pytrunkmerge/pypy/tool/build/test/test_pypybuilder.py	Tue Feb  6 11:50:16 2007
@@ -11,8 +11,8 @@
 from pypy.tool.build.conftest import option
 from pypy.config import config as pypyconfig
 
-from repo import create_temp_repo
-from fake import Container
+from pypy.tool.build.test.repo import create_temp_repo
+from pypy.tool.build.test.fake import Container
 
 # XXX this one is a bit messy, it's a quick functional test for the whole
 # system, but for instance contains time.sleep()s to make sure all threads

Modified: pypy/branch/pytrunkmerge/pypy/translator/c/winproj/extension/extension.vcproj
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/translator/c/winproj/extension/extension.vcproj	(original)
+++ pypy/branch/pytrunkmerge/pypy/translator/c/winproj/extension/extension.vcproj	Tue Feb  6 11:50:16 2007
@@ -208,7 +208,7 @@
 			</File>
 		</Filter>
 		<File
-			RelativePath="F:\tmp\usession-502\testing_1\testing_1.c">
+			RelativePath="F:\tmp\usession-886\testing_1\testing_1.c">
 		</File>
 	</Files>
 	<Globals>

Modified: pypy/branch/pytrunkmerge/pypy/translator/c/winproj/standalone/standalone.vcproj
==============================================================================
--- pypy/branch/pytrunkmerge/pypy/translator/c/winproj/standalone/standalone.vcproj	(original)
+++ pypy/branch/pytrunkmerge/pypy/translator/c/winproj/standalone/standalone.vcproj	Tue Feb  6 11:50:16 2007
@@ -126,6 +126,9 @@
 				RelativePath="..\..\src\char.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\common_header.h">
+			</File>
+			<File
 				RelativePath="..\..\src\debuginfo.h">
 			</File>
 			<File
@@ -135,12 +138,63 @@
 				RelativePath="..\..\src\float.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\forwarddecl.h">
+			</File>
+			<File
 				RelativePath="..\..\src\g_include.h">
 			</File>
 			<File
 				RelativePath="..\..\src\g_prerequisite.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_1.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_10.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_11.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_12.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_13.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_14.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_15.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_2.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_3.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_4.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_5.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_6.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_7.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_8.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\implement_9.c">
+			</File>
+			<File
 				RelativePath="..\..\src\int.h">
 			</File>
 			<File
@@ -177,6 +231,30 @@
 				RelativePath="..\..\src\module.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_1.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_2.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_3.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_4.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_5.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_6.c">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\nonfuncnodes_7.c">
+			</File>
+			<File
 				RelativePath="..\..\src\pyobj.h">
 			</File>
 			<File
@@ -189,9 +267,18 @@
 				RelativePath="..\..\src\standalone.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\structdef.h">
+			</File>
+			<File
+				RelativePath="F:\tmp\usession-827\testing_1\structimpl.c">
+			</File>
+			<File
 				RelativePath="..\..\src\support.h">
 			</File>
 			<File
+				RelativePath="F:\tmp\usession-827\testing_1\testing_1.c">
+			</File>
+			<File
 				RelativePath="..\..\src\thread.h">
 			</File>
 			<File
@@ -207,9 +294,6 @@
 				RelativePath="..\..\src\unichar.h">
 			</File>
 		</Filter>
-		<File
-			RelativePath="..\..\..\..\..\..\..\Documents and Settings\ctismer\Local Settings\Temp\usession-257\testing_1\testing_1.c">
-		</File>
 	</Files>
 	<Globals>
 	</Globals>



More information about the Pypy-commit mailing list