[Python-apps-commits] r327 - in packages/cython/trunk/debian (6 files)

certik-guest at users.alioth.debian.org certik-guest at users.alioth.debian.org
Fri Nov 30 15:06:56 UTC 2007


    Date: Friday, November 30, 2007 @ 15:06:56
  Author: certik-guest
Revision: 327

classmethod patch added

Added:
  packages/cython/trunk/debian/patches/
  packages/cython/trunk/debian/patches/classmethod.patch
  packages/cython/trunk/debian/patches/series
Modified:
  packages/cython/trunk/debian/changelog
  packages/cython/trunk/debian/control
  packages/cython/trunk/debian/rules

Modified: packages/cython/trunk/debian/changelog
===================================================================
--- packages/cython/trunk/debian/changelog	2007-11-30 15:04:14 UTC (rev 326)
+++ packages/cython/trunk/debian/changelog	2007-11-30 15:06:56 UTC (rev 327)
@@ -1,10 +1,11 @@
-cython (0.9.6.8.ds-1~oc3) UNRELEASED; urgency=low
+cython (0.9.6.8.ds-1~oc4) UNRELEASED; urgency=low
 
   [ Ondrej Certik ]
   * Initial Debian upload
+  * Added a patch for handling the @classmethod decorators
 
   [ Sandro Tosi ]
   * debian/watch
     - added missing file
 
- -- Sandro Tosi <matrixhasu at gmail.com>  Sun, 25 Nov 2007 20:01:19 +0100
+ -- Ondrej Certik <ondrej at certik.cz>  Fri, 30 Nov 2007 13:00:44 +0100

Modified: packages/cython/trunk/debian/control
===================================================================
--- packages/cython/trunk/debian/control	2007-11-30 15:04:14 UTC (rev 326)
+++ packages/cython/trunk/debian/control	2007-11-30 15:06:56 UTC (rev 327)
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Python Applications Packaging Team <python-apps-team at lists.alioth.debian.org>
 Uploaders: Ondrej Certik <ondrej at certik.cz>
-Build-Depends: cdbs (>=0.4.41), debhelper (>= 5), python-all-dev (>=2.3.5-11)
+Build-Depends: cdbs (>=0.4.41), debhelper (>= 5), python-all-dev (>=2.3.5-11), quilt (>=0.46-4)
 Build-Depends-Indep: python-central (>= 0.5)
 Standards-Version: 3.7.2
 Homepage: http://cython.org/

Added: packages/cython/trunk/debian/patches/classmethod.patch
===================================================================
--- packages/cython/trunk/debian/patches/classmethod.patch	                        (rev 0)
+++ packages/cython/trunk/debian/patches/classmethod.patch	2007-11-30 15:06:56 UTC (rev 327)
@@ -0,0 +1,82 @@
+Index: cython-0.9.6.8.ds/Cython/Compiler/Parsing.py
+===================================================================
+--- cython-0.9.6.8.ds.orig/Cython/Compiler/Parsing.py	2007-11-30 13:20:05.229118749 +0100
++++ cython-0.9.6.8.ds/Cython/Compiler/Parsing.py	2007-11-30 13:21:21.733478483 +0100
+@@ -1343,7 +1343,7 @@
+             elif s.sy == 'pass' and level <> 'property':
+                 return p_pass_statement(s, with_newline = 1)
+             else:
+-                if level in ('c_class', 'c_class_pxd', 'property'):
++                if level in ('c_class_pxd', 'property'):
+                     s.error("Executable statement not allowed here")
+                 if s.sy == 'if':
+                     return p_if_statement(s)
+Index: cython-0.9.6.8.ds/Cython/Compiler/Symtab.py
+===================================================================
+--- cython-0.9.6.8.ds.orig/Cython/Compiler/Symtab.py	2007-11-30 13:19:32.727266573 +0100
++++ cython-0.9.6.8.ds/Cython/Compiler/Symtab.py	2007-11-30 13:21:21.733478483 +0100
+@@ -1070,6 +1070,21 @@
+     def add_string_const(self, value):
+         return self.outer_scope.add_string_const(value)
+ 
++    def lookup(self, name):
++        if name == "classmethod":
++            # We don't want to use the builtin classmethod here 'cause it won't do the 
++            # right thing in this scope (as the class memebers aren't still functions). 
++            # Don't want to add a cfunction to this scope 'cause that would mess with 
++            # the type definition, so we just return the right entry. 
++            self.use_utility_code(classmethod_utility_code)
++            entry = Entry("classmethod", 
++                          "__Pyx_Method_ClassMethod", 
++                          CFuncType(py_object_type, [CFuncTypeArg("", py_object_type, None)], 0, 0))
++            entry.is_cfunction = 1
++            return entry
++        else:
++            return Scope.lookup(self, name)
++    
+ 
+ class PyClassScope(ClassScope):
+     #  Namespace of a Python class.
+@@ -1289,21 +1304,6 @@
+     def release_temp(self, cname):
+         return Scope.release_temp(self.global_scope(), cname)
+         
+-    def lookup(self, name):
+-        if name == "classmethod":
+-            # We don't want to use the builtin classmethod here 'cause it won't do the 
+-            # right thing in this scope (as the class memebers aren't still functions). 
+-            # Don't want to add a cfunction to this scope 'cause that would mess with 
+-            # the type definition, so we just return the right entry. 
+-            self.use_utility_code(classmethod_utility_code)
+-            entry = Entry("classmethod", 
+-                          "__Pyx_Method_ClassMethod", 
+-                          CFuncType(py_object_type, [CFuncTypeArg("", py_object_type, None)], 0, 0))
+-            entry.is_cfunction = 1
+-            return entry
+-        else:
+-            return Scope.lookup(self, name)
+-    
+         
+ class PropertyScope(Scope):
+     #  Scope holding the __get__, __set__ and __del__ methods for
+@@ -1336,12 +1336,15 @@
+ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
+     /* It appears that PyMethodDescr_Type is not anywhere exposed in the Python/C API */
+     /* if (!PyObject_TypeCheck(method, &PyMethodDescr_Type)) { */ 
+-    if (strcmp(method->ob_type->tp_name, "method_descriptor") != 0) {
+-        PyErr_Format(PyExc_TypeError, "Extension type classmethod() can only be called on a method_descriptor.");
+-        return NULL;
++    if (strcmp(method->ob_type->tp_name, "method_descriptor") == 0) { /* cdef classes */
++        PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
++        return PyDescr_NewClassMethod(descr->d_type, descr->d_method);
++    }
++    else if (PyMethod_Check(method)) {                                /* python classes */
++        return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
+     }
+-    PyMethodDescrObject *descr = (PyMethodDescrObject *)method;
+-    return PyDescr_NewClassMethod(descr->d_type, descr->d_method);
++    PyErr_Format(PyExc_TypeError, "Class-level classmethod() can only be called on a method_descriptor or instance method.");
++    return NULL;
+ }
+ """
+ ]

Added: packages/cython/trunk/debian/patches/series
===================================================================
--- packages/cython/trunk/debian/patches/series	                        (rev 0)
+++ packages/cython/trunk/debian/patches/series	2007-11-30 15:06:56 UTC (rev 327)
@@ -0,0 +1 @@
+classmethod.patch

Modified: packages/cython/trunk/debian/rules
===================================================================
--- packages/cython/trunk/debian/rules	2007-11-30 15:04:14 UTC (rev 326)
+++ packages/cython/trunk/debian/rules	2007-11-30 15:06:56 UTC (rev 327)
@@ -6,6 +6,12 @@
 include /usr/share/cdbs/1/rules/debhelper.mk
 include /usr/share/cdbs/1/class/python-distutils.mk
 
+configure/cython::
+	QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
+
+clean::
+	QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2
+
 get-orig-tarball:
 	wget http://www.cython.org/cython-0.9.6.8.zip
 	unzip cython-0.9.6.8.zip




More information about the Python-apps-commits mailing list