From a8a4d16c49ce2d93481fc9e89da796c6a26c9a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 12 Jul 2011 00:22:00 +0200 Subject: [PATCH] Remove support of Python2.5 and fix py3 warnings --- CHANGELOG | 2 ++ INSTALL | 2 +- proteus/config.py | 31 ++++++++++++++++++++++++------- setup.py | 7 ++----- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 60b2636df7..59aebf9014 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ * Change license to LGPL-3 +* Drop support of Python 2.5 + Version 2.0.0 - 2011-04-28 * Bug fixes (see mercurial logs for details) * Manage default values of trytond configuration diff --git a/INSTALL b/INSTALL index a87c0a0201..4267630090 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Installing proteus Prerequisites ------------- - * Python 2.5 or later (http://www.python.org/) + * Python 2.6 or later (http://www.python.org/) * trytond (http://www.tryton.org/) Installation diff --git a/proteus/config.py b/proteus/config.py index 5c67219b21..f8bc7b01aa 100644 --- a/proteus/config.py +++ b/proteus/config.py @@ -48,11 +48,6 @@ class Config(object): def get_proxy_methods(self, name): raise NotImplementedError - def __eq__(self, other): - if isinstance(other, Config): - return repr(self) == repr(other) - return NotImplemented - class _TrytondMethod(object): @@ -121,6 +116,7 @@ class TrytondConfig(Config): database_name = 'test_%s' % int(time.time()) self.database_name = database_name self._user = user + self.config_file = config_file register_classes() @@ -151,10 +147,23 @@ class TrytondConfig(Config): __init__.__doc__ = object.__init__.__doc__ def __repr__(self): - return "proteus.config.TrytondConfig('%s', '%s', '%s')" % ( - self.database_name, self._user, self.database_type) + return "proteus.config.TrytondConfig('%s', '%s', '%s', config_file=%s)"\ + % (self.database_name, self._user, self.database_type, + self.config_file) __repr__.__doc__ = object.__repr__.__doc__ + def __eq__(self, other): + if not isinstance(other, TrytondConfig): + raise NotImplemented + return (self.database_name == other.database_name + and self._user == other._user + and self.database_type == other.database_type + and self.config_file == other.config_file) + + def __hash__(self): + return hash((self.database_name, self._user, + self.database_type, self.config_file)) + def get_proxy(self, name, type='model'): 'Return Proxy class' return TrytondProxy(name, self, type=type) @@ -200,6 +209,14 @@ class XmlrpcConfig(Config): return "proteus.config.XmlrpcConfig('%s')" % self.url __repr__.__doc__ = object.__repr__.__doc__ + def __eq__(self, other): + if not isinstance(other, XmlrpcConfig): + raise NotImplemented + return self.url == other.url + + def __hash__(self): + return hash(self.url) + def get_proxy(self, name, type='model'): 'Return Proxy class' return XmlrpcProxy(name, self, type=type) diff --git a/setup.py b/setup.py index 50fbaf710c..fbd82cafc1 100644 --- a/setup.py +++ b/setup.py @@ -10,10 +10,6 @@ major_version, minor_version, _ = proteus.__version__.split('.', 2) major_version = int(major_version) minor_version = int(minor_version) -SIMPLEJSON = [] -if sys.version_info < (2, 6): - SIMPLEJSON = ['simplejson'] - def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() @@ -35,7 +31,8 @@ setup(name='proteus', 'Intended Audience :: Legal Industry', 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'Operating System :: OS Independent', - 'Programming Language :: Python', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', 'Topic :: Office/Business', ], license='LGPL-3',