merge with other default head
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 23 Apr 2013 18:15:10 +0200
changeset 8907 ddeb02b02222
parent 8906 ed35d984ff28 (current diff)
parent 8892 80783605d270 (diff)
child 8911 2dd134a86996
merge with other default head
entity.py
--- a/entity.py	Tue Apr 23 16:07:02 2013 +0200
+++ b/entity.py	Tue Apr 23 18:15:10 2013 +0200
@@ -554,7 +554,10 @@
         return '<Entity %s %s %s at %s>' % (
             self.e_schema, self.eid, list(self.cw_attr_cache), id(self))
 
-    def __cmp__(self, other):
+    def __lt__(self, other):
+        raise NotImplementedError('comparison not implemented for %s' % self.__class__)
+
+    def __eq__(self, other):
         raise NotImplementedError('comparison not implemented for %s' % self.__class__)
 
     def _cw_update_attr_cache(self, attrcache):
--- a/schema.py	Tue Apr 23 16:07:02 2013 +0200
+++ b/schema.py	Tue Apr 23 18:15:10 2013 +0200
@@ -700,10 +700,15 @@
     def __repr__(self):
         return '%s(%s)' % (self.__class__.__name__, self.full_rql)
 
-    def __cmp__(self, other):
+    def __lt__(self, other):
         if hasattr(other, 'expression'):
-            return cmp(other.expression, self.expression)
-        return -1
+            return self.expression < other.expression
+        return True
+
+    def __eq__(self, other):
+        if hasattr(other, 'expression'):
+            return self.expression == other.expression
+        return False
 
     def __deepcopy__(self, memo):
         return self.__class__(self.expression, self.mainvars)
--- a/server/edition.py	Tue Apr 23 16:07:02 2013 +0200
+++ b/server/edition.py	Tue Apr 23 18:15:10 2013 +0200
@@ -48,9 +48,12 @@
         # dict|set keyable
         return hash(id(self))
 
-    def __cmp__(self, other):
+    def __lt__(self, other):
         # we don't want comparison by value inherited from dict
-        return cmp(id(self), id(other))
+        return id(self) < id(other)
+
+    def __eq__(self, other):
+        return id(self) == id(other)
 
     def __setitem__(self, attr, value):
         assert attr != 'eid'
--- a/server/sources/__init__.py	Tue Apr 23 16:07:02 2013 +0200
+++ b/server/sources/__init__.py	Tue Apr 23 18:15:10 2013 +0200
@@ -140,17 +140,20 @@
         return '<%s %s source %s @%#x>' % (self.uri, self.__class__.__name__,
                                            self.eid, id(self))
 
-    def __cmp__(self, other):
+    def __lt__(self, other):
         """simple comparison function to get predictable source order, with the
         system source at last
         """
         if self.uri == other.uri:
-            return 0
+            return False
         if self.uri == 'system':
-            return 1
+            return False
         if other.uri == 'system':
-            return -1
-        return cmp(self.uri, other.uri)
+            return True
+        return self.uri < other.uri
+
+    def __eq__(self, other):
+        return self.uri == other.uri
 
     def backup(self, backupfile, confirm, format='native'):
         """method called to create a backup of source's data"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/skeleton/DISTNAME.spec.tmpl	Tue Apr 23 18:15:10 2013 +0200
@@ -0,0 +1,46 @@
+# for el5, force use of python2.6
+%%if 0%%{?el5}
+%%define python python26
+%%define __python /usr/bin/python2.6
+%%else
+%%define python python
+%%define __python /usr/bin/python
+%%endif
+%%{!?_python_sitelib: %%define _python_sitelib %%(%%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+Name:           %(distname)s
+Version:        0.1.0
+Release:        logilab.1%%{?dist}
+Summary:        %(shortdesc)s
+Group:          Applications/Internet
+License:        %(license)s
+Source0:        %(distname)s-%%{version}.tar.gz
+
+BuildArch:      noarch
+BuildRoot:      %%{_tmppath}/%%{name}-%%{version}-%%{release}-buildroot
+
+BuildRequires:  %%{python} %%{python}-setuptools
+Requires:       cubicweb >= %(version)s
+
+%%description
+%(longdesc)s
+
+%%prep
+%%setup -q -n %(distname)s-%%{version}
+%%if 0%%{?el5}
+# change the python version in shebangs
+find . -name '*.py' -type f -print0 |  xargs -0 sed -i '1,3s;^#!.*python.*$;#! /usr/bin/python2.6;'
+%%endif
+
+%%install
+NO_SETUPTOOLS=1 %%{__python} setup.py --quiet install --no-compile --prefix=%%{_prefix} --root="$RPM_BUILD_ROOT"
+# remove generated .egg-info file
+rm -rf $RPM_BUILD_ROOT/usr/lib/python*
+
+
+%%clean
+rm -rf $RPM_BUILD_ROOT
+
+%%files
+%%defattr(-, root, root)
+/*