commit python-logilab-common for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package python-logilab-common for openSUSE:Factory checked in at Tue Nov 2 14:06:06 CET 2010. -------- --- python-logilab-common/python-logilab-common.changes 2010-09-29 10:12:43.000000000 +0200 +++ /mounts/work_src_done/STABLE/python-logilab-common/python-logilab-common.changes 2010-10-17 23:24:46.000000000 +0200 @@ -1,0 +2,10 @@ +Sun Oct 17 23:20:37 CEST 2010 - dmueller@suse.de + +- update to 0.52.1: + * configuration: fix pb with option names as unicode string w/ + python 2.5. Makes OptionError available through the module + * textutils: text_to_dict skip comments (# lines) + * compat: dropped some 2.2 compat + * modutils: Consider arch-specific installation for STD_LIB_DIR definition + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- logilab-common-0.52.0.tar.bz2 New: ---- logilab-common-0.52.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-logilab-common.spec ++++++ --- /var/tmp/diff_new_pack.jNuF5j/_old 2010-11-02 14:05:42.000000000 +0100 +++ /var/tmp/diff_new_pack.jNuF5j/_new 2010-11-02 14:05:42.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package python-logilab-common (Version 0.52.0) +# spec file for package python-logilab-common (Version 0.52.1) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -20,7 +20,7 @@ Name: python-logilab-common Summary: Python lowlevel functionality shared by logilab projects -Version: 0.52.0 +Version: 0.52.1 Release: 1 BuildRequires: python-devel Source: logilab-common-%{version}.tar.bz2 ++++++ logilab-common-0.52.0.tar.bz2 -> logilab-common-0.52.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/ChangeLog new/logilab-common-0.52.1/ChangeLog --- old/logilab-common-0.52.0/ChangeLog 2010-09-28 14:23:30.000000000 +0200 +++ new/logilab-common-0.52.1/ChangeLog 2010-10-13 19:12:12.000000000 +0200 @@ -1,6 +1,18 @@ ChangeLog for logilab.common ============================ +2010-10-11 -- 0.52.1 + * configuration: fix pb with option names as unicode string w/ + python 2.5. Makes OptionError available through the module + + * textutils: text_to_dict skip comments (# lines) + + * compat: dropped some 2.2 compat + + * modutils: Consider arch-specific installation for STD_LIB_DIR definition + + + 2010-09-28 -- 0.52.0 * testlib is now based on unittest2, to prepare its own extinction. Warning are printed so you can easily migration step by step. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/cli.py new/logilab-common-0.52.1/cli.py --- old/logilab-common-0.52.0/cli.py 2010-09-28 14:23:30.000000000 +0200 +++ new/logilab-common-0.52.1/cli.py 2010-09-28 18:22:00.000000000 +0200 @@ -44,9 +44,9 @@ __docformat__ = "restructuredtext en" -import __builtin__ -if not hasattr(__builtin__, '_'): - __builtin__._ = str +from logilab.common.compat import raw_input, builtins +if not hasattr(builtins, '_'): + builtins._ = str def init_readline(complete_method, histfile=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/compat.py new/logilab-common-0.52.1/compat.py --- old/logilab-common-0.52.0/compat.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/compat.py 2010-10-13 19:12:12.000000000 +0200 @@ -18,6 +18,12 @@ # with logilab-common. If not, see http://www.gnu.org/licenses/. """Wrappers around some builtins introduced in python 2.3, 2.4 and 2.5, making them available in for earlier versions of python. + +See another compatibility snippets from other projects: + + :mod:`lib2to3.fixes` + :mod:`coverage.backward` + :mod:`unittest2.compatibility` """ from __future__ import generators @@ -28,155 +34,75 @@ import sys from warnings import warn -import __builtin__ +import __builtin__ as builtins # 2to3 will tranform '__builtin__' to 'builtins' +if sys.version_info < (3, 0): + str_to_bytes = str + def str_encode(string, encoding): + if isinstance(string, unicode): + return string.encode(encoding) + return str(string) +else: + def str_to_bytes(string): + return str.encode(string) + # we have to ignore the encoding in py3k to be able to write a string into a + # TextIOWrapper or like object (which expect an unicode string) + def str_encode(string, encoding): + return str(string) + +# XXX shouldn't we remove this and just let 2to3 do his job ? try: - set = set - frozenset = frozenset -except NameError: - try: - from sets import Set as set, ImmutableSet as frozenset - except ImportError: - class _baseset(object): - def __init__(self, values=()): - self._data = {} - warn("This implementation of Set is not complete !", - stacklevel=2) - for v in values: - self._data[v] = 1 - - def __or__(self, other): - result = self.__class__(self._data.keys()) - for val in other: - result.add(val) - return result - __add__ = __or__ - - def __and__(self, other): - result = self.__class__() - for val in other: - if val in self._data: - result.add(val) - return result - - def __sub__(self, other): - result = self.__class__(self._data.keys()) - for val in other: - if val in self._data: - result.remove(val) - return result - - def __cmp__(self, other): - keys = self._data.keys() - okeys = other._data.keys() - keys.sort() - okeys.sort() - return cmp(keys, okeys) - - def __len__(self): - return len(self._data) - - def __repr__(self): - elements = self._data.keys() - return 'lcc.%s(%r)' % (self.__class__.__name__, elements) - __str__ = __repr__ - - def __iter__(self): - return iter(self._data) - - class frozenset(_baseset): - """immutable set (can be set in dictionaries)""" - def __init__(self, values=()): - super(frozenset, self).__init__(values) - self._hashcode = None - - def _compute_hash(self): - """taken from python stdlib (sets.py)""" - # Calculate hash code for a set by xor'ing the hash codes of - # the elements. This ensures that the hash code does not depend - # on the order in which elements are added to the set. This is - # not called __hash__ because a BaseSet should not be hashable; - # only an ImmutableSet is hashable. - result = 0 - for elt in self: - result ^= hash(elt) - return result - - def __hash__(self): - """taken from python stdlib (sets.py)""" - if self._hashcode is None: - self._hashcode = self._compute_hash() - return self._hashcode - - - class set(_baseset): - """mutable set""" - def add(self, value): - self._data[value] = 1 - - def remove(self, element): - """removes <element> from set""" - del self._data[element] - - def pop(self): - """pops an arbitrary element from set""" - return self._data.popitem()[0] - - def __hash__(self): - """mutable set cannot be hashed.""" - raise TypeError("set objects are not hashable") + callable = callable +except NameError:# callable removed from py3k + import collections + def callable(something): + return isinstance(something, collections.Callable) + del collections - del _baseset # don't explicitly provide this class +if sys.version_info < (3, 0): + raw_input = raw_input +else: + raw_input = input + +# Pythons 2 and 3 differ on where to get StringIO +if sys.version_info < (3, 0): + from cStringIO import StringIO + FileIO = file + BytesIO = StringIO +else: + from io import FileIO, BytesIO, StringIO +# Where do pickles come from? try: - from itertools import izip, chain, imap + import cPickle as pickle except ImportError: - # from itertools documentation ### - def izip(*iterables): - iterables = map(iter, iterables) - while iterables: - result = [i.next() for i in iterables] - yield tuple(result) - - def chain(*iterables): - for it in iterables: - for element in it: - yield element - - def imap(function, *iterables): - iterables = map(iter, iterables) - while True: - args = [i.next() for i in iterables] - if function is None: - yield tuple(args) - else: - yield function(*args) + import pickle + try: - sum = sum - enumerate = enumerate -except NameError: - # define the sum and enumerate functions (builtins introduced in py 2.3) - import operator - def sum(seq, start=0): - """Returns the sum of all elements in the sequence""" - return reduce(operator.add, seq, start) - - def enumerate(iterable): - """emulates the python2.3 enumerate() function""" - i = 0 - for val in iterable: - yield i, val - i += 1 - #return zip(range(len(iterable)), iterable) + set = set + frozenset = frozenset +except NameError:# Python 2.3 doesn't have `set` + from sets import Set as set, ImmutableSet as frozenset + +from logilab.common.deprecation import deprecated + +from itertools import izip, chain, imap +izip = deprecated('izip exists in itertools since py2.3')(izip) +imap = deprecated('imap exists in itertools since py2.3')(imap) +chain = deprecated('chain exists in itertools since py2.3')(chain) + +sum = deprecated('sum exists in builtins since py2.3')(sum) +enumerate = deprecated('enumerate exists in builtins since py2.3')(enumerate) + try: sorted = sorted reversed = reversed -except NameError: +except NameError: # py2.3 def sorted(iterable, cmp=None, key=None, reverse=False): original = list(iterable) if key: - l2 = [(key(elt), index) for index, elt in enumerate(original)] + l2 = [(key(elt), index) for index, elt in builtins.enumerate(original)] else: l2 = original l2.sort(cmp) @@ -191,9 +117,9 @@ l2.reverse() return l2 -try: # +try: max = max - max(("ab","cde"),key=len) + max(("ab","cde"),key=len) # does not work in py2.3 except TypeError: def max( *args, **kargs): if len(args) == 0: @@ -201,7 +127,7 @@ key= kargs.pop("key", None) #default implementation if key is None: - return __builtin__.max(*args,**kargs) + return builtins.max(*args,**kargs) for karg in kargs: raise TypeError("unexpected keyword argument %s for function max") % karg @@ -337,4 +263,24 @@ obj = set.__new__(cls, *new_args) obj.__init__(*args, **kwargs) return obj - + +# XXX shouldn't we remove this and just let 2to3 do his job ? +# range or xrange? +try: + range = xrange +except NameError: + range = range + +# ConfigParser was renamed to the more-standard configparser +try: + import configparser +except ImportError: + import ConfigParser as configparser + +try: + import json +except ImportError: + try: + import simplejson as json + except ImportError: + json = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/configuration.py new/logilab-common-0.52.1/configuration.py --- old/logilab-common-0.52.0/configuration.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/configuration.py 2010-10-11 16:05:41.000000000 +0200 @@ -113,10 +113,14 @@ DuplicateSectionError from warnings import warn -from logilab.common.compat import set, reversed +from logilab.common.compat import set, reversed, callable, raw_input +from logilab.common.compat import str_encode as _encode + from logilab.common.textutils import normalize_text, unquote from logilab.common import optik_ext as optparse +OptionError = optparse.OptionError + REQUIRED = [] class UnsupportedAction(Exception): @@ -130,11 +134,6 @@ encoding = locale.getpreferredencoding() return encoding -def _encode(string, encoding): - if isinstance(string, unicode): - return string.encode(encoding) - return str(string) - # validation functions ######################################################## @@ -362,6 +361,10 @@ if doc: print >> stream, _encode(comment(doc), encoding) print >> stream, '[%s]' % section + ini_format(stream, options, encoding) + +def ini_format(stream, options, encoding): + """format options using the INI format""" for optname, optdict, value in options: value = format_option_value(optdict, value) help = optdict.get('help') @@ -479,7 +482,7 @@ args, optdict = self.optik_option(provider, opt, optdict) option = optikcontainer.add_option(*args, **optdict) self._all_options[opt] = provider - self._maxlevel = max(self._maxlevel, option.level) + self._maxlevel = max(self._maxlevel, option.level or 0) def optik_option(self, provider, opt, optdict): """get our personal option definition and return a suitable form for @@ -500,7 +503,7 @@ not optdict['action'] in ('store_true', 'store_false')): optdict['help'] += ' [current: %default]' del optdict['default'] - args = ['--' + opt] + args = ['--' + str(opt)] if 'short' in optdict: self._short_options[optdict['short']] = opt args.append('-' + optdict['short']) @@ -855,7 +858,8 @@ for option in self.options: if option[0] == opt: return option[1] - raise optparse.OptionError('no such option in section %r' % self.name, opt) + raise OptionError('no such option %s in section %r' + % (self.name, opt), opt) def all_options(self): @@ -940,7 +944,7 @@ def get(self, key, default=None): try: return getattr(self.config, self.option_name(key)) - except (optparse.OptionError, AttributeError): + except (OptionError, AttributeError): return default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/fileutils.py new/logilab-common-0.52.1/fileutils.py --- old/logilab-common-0.52.0/fileutils.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/fileutils.py 2010-10-11 16:05:41.000000000 +0200 @@ -28,14 +28,15 @@ import sys import shutil import mimetypes -from os.path import isabs, isdir, islink, split, exists, walk, normpath, join +from os.path import isabs, isdir, islink, split, exists, normpath, join from os.path import abspath -from os import sep, mkdir, remove, listdir, stat, chmod +from os import sep, mkdir, remove, listdir, stat, chmod, walk from stat import ST_MODE, S_IWRITE from cStringIO import StringIO from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS from logilab.common.shellutils import find +from logilab.common.compat import FileIO, any def first_level_directory(path): """Return the first level directory of a path. @@ -123,9 +124,10 @@ chmod(filepath, mode | desired_mode) -class ProtectedFile(file): - """A special file-object class that automatically that automatically - does a 'chmod +w' when needed. +# XXX (syt) unused? kill? +class ProtectedFile(FileIO): + """A special file-object class that automatically does a 'chmod +w' when + needed. XXX: for now, the way it is done allows 'normal file-objects' to be created during the ProtectedFile object lifetime. @@ -150,7 +152,7 @@ if not self.original_mode & S_IWRITE: chmod(filepath, self.original_mode | S_IWRITE) self.mode_changed = True - file.__init__(self, filepath, mode) + FileIO.__init__(self, filepath, mode) def _restore_mode(self): """restores the original mode if needed""" @@ -162,7 +164,7 @@ def close(self): """restore mode before closing""" self._restore_mode() - file.close(self) + FileIO.close(self) def __del__(self): if not self.closed: @@ -356,35 +358,35 @@ flag indicating whether information about exported files should be printed to stderr, default to False """ - def make_mirror(_, directory, fnames): - """walk handler""" + try: + mkdir(to_dir) + except OSError: + pass # FIXME we should use "exists" if the point is about existing dir + # else (permission problems?) shouldn't return / raise ? + for directory, dirnames, filenames in walk(from_dir): for norecurs in blacklist: try: - fnames.remove(norecurs) + dirnames.remove(norecurs) except ValueError: continue - for filename in fnames: + for dirname in dirnames: + src = join(directory, dirname) + dest = to_dir + src[len(from_dir):] + if isdir(src): + if not exists(dest): + mkdir(dest) + for filename in filenames: # don't include binary files - for ext in ignore_ext: - if filename.endswith(ext): - break - else: - src = join(directory, filename) - dest = to_dir + src[len(from_dir):] - if verbose: - print >> sys.stderr, src, '->', dest - if isdir(src): - if not exists(dest): - mkdir(dest) - else: - if exists(dest): - remove(dest) - shutil.copy2(src, dest) - try: - mkdir(to_dir) - except OSError: - pass - walk(from_dir, make_mirror, None) + # endswith does not accept tuple in 2.4 + if any(filename.endswith(ext) for ext in ignore_ext): + continue + src = join(directory, filename) + dest = to_dir + src[len(from_dir):] + if verbose: + print >> sys.stderr, src, '->', dest + if exists(dest): + remove(dest) + shutil.copy2(src, dest) def remove_dead_links(directory, verbose=0): @@ -398,12 +400,11 @@ flag indicating whether information about deleted links should be printed to stderr, default to False """ - def _remove_dead_link(_, directory, fnames): - """walk handler""" - for filename in fnames: - src = join(directory, filename) + for dirpath, dirname, filenames in walk(directory): + for filename in dirnames + filenames: + src = join(dirpath, filename) if islink(src) and not exists(src): if verbose: print 'remove dead link', src remove(src) - walk(directory, _remove_dead_link, None) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/__init__.py new/logilab-common-0.52.1/__init__.py --- old/logilab-common-0.52.0/__init__.py 2010-09-28 14:23:30.000000000 +0200 +++ new/logilab-common-0.52.1/__init__.py 2010-09-28 18:22:00.000000000 +0200 @@ -138,3 +138,18 @@ i += 1 domains.append(new_domain) return domains + + +# private stuff ################################################################ + +def _handle_blacklist(blacklist, dirnames, filenames): + """remove files/directories in the black list + + dirnames/filenames are usually from os.walk + """ + for norecurs in blacklist: + if norecurs in dirnames: + dirnames.remove(norecurs) + elif norecurs in filenames: + filenames.remove(norecurs) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/interface.py new/logilab-common-0.52.1/interface.py --- old/logilab-common-0.52.0/interface.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/interface.py 2010-09-28 18:22:01.000000000 +0200 @@ -26,7 +26,6 @@ """ __docformat__ = "restructuredtext en" -from types import ListType, TupleType class Interface(object): """Base class for interfaces.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/logilab_common.egg-info/PKG-INFO new/logilab-common-0.52.1/logilab_common.egg-info/PKG-INFO --- old/logilab-common-0.52.0/logilab_common.egg-info/PKG-INFO 2010-09-28 18:21:45.000000000 +0200 +++ new/logilab-common-0.52.1/logilab_common.egg-info/PKG-INFO 2010-10-14 00:03:07.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: logilab-common -Version: 0.52.0 +Version: 0.52.1 Summary: collection of low-level Python packages and modules used by Logilab projects Home-page: http://www.logilab.org/project/logilab-common Author: Logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/modutils.py new/logilab-common-0.52.1/modutils.py --- old/logilab-common-0.52.0/modutils.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/modutils.py 2010-10-11 16:05:41.000000000 +0200 @@ -31,8 +31,9 @@ import sys import os -from os.path import walk, splitext, join, abspath, isdir, dirname, exists +from os.path import splitext, join, abspath, isdir, dirname, exists, basename from imp import find_module, load_module, C_BUILTIN, PY_COMPILED, PKG_DIRECTORY +from distutils.sysconfig import get_config_var, get_python_lib, get_python_version try: import zipimport @@ -41,16 +42,23 @@ ZIPFILE = object() -from logilab.common import STD_BLACKLIST +from logilab.common import STD_BLACKLIST, _handle_blacklist +# Notes about STD_LIB_DIR +# Consider arch-specific installation for STD_LIB_DIR definition +# :mod:`distutils.sysconfig` contains to much hardcoded values to rely on +# +# :see: `Problems with /usr/lib64 builds http://bugs.python.org/issue1294959`_ +# :see: `FHS http://www.pathname.com/fhs/pub/fhs-2.3.html#LIBLTQUALGTALTERNATEFORMATESSEN...`_ if sys.platform.startswith('win'): PY_SOURCE_EXTS = ('py', 'pyw') PY_COMPILED_EXTS = ('dll', 'pyd') - STD_LIB_DIR = join(sys.prefix, 'lib') + STD_LIB_DIR = get_python_lib(standard_lib=1) else: PY_SOURCE_EXTS = ('py',) PY_COMPILED_EXTS = ('so',) - STD_LIB_DIR = join(sys.prefix, 'lib', 'python%s' % sys.version[:3]) + # extend lib dir with some arch-dependant paths + STD_LIB_DIR = join(get_config_var("LIBDIR"), "python%s" % get_python_version()) BUILTIN_MODULES = dict(zip(sys.builtin_module_names, [1]*len(sys.builtin_module_names))) @@ -138,7 +146,7 @@ prevmodule = None for part in parts: modpath.append(part) - curname = ".".join(modpath) + curname = '.'.join(modpath) module = None if len(modpath) != len(parts): # even with use_sys=False, should try to get outer packages from sys.modules @@ -148,9 +156,9 @@ module = load_module(curname, mp_file, mp_filename, mp_desc) if prevmodule: setattr(prevmodule, part, module) - _file = getattr(module, "__file__", "") + _file = getattr(module, '__file__', '') if not _file and len(modpath) != len(parts): - raise ImportError("no module in %s" % ".".join(parts[len(modpath):]) ) + raise ImportError('no module in %s' % '.'.join(parts[len(modpath):]) ) path = [dirname( _file )] prevmodule = module return module @@ -341,7 +349,6 @@ return dotted_name - def get_modules(package, src_directory, blacklist=STD_BLACKLIST): """given a package directory return a list of all available python modules in the package and its subpackages @@ -363,31 +370,21 @@ the list of all available python modules in the package and its subpackages """ - def func(modules, directory, fnames): - """walk handler""" - # remove files/directories in the black list - for norecurs in blacklist: - try: - fnames.remove(norecurs) - except ValueError: - continue + modules = [] + for directory, dirnames, filenames in os.walk(src_directory): + _handle_blacklist(blacklist, dirnames, filenames) # check for __init__.py - if not '__init__.py' in fnames: - while fnames: - fnames.pop() - elif directory != src_directory: - #src = join(directory, file) + if not '__init__.py' in filenames: + dirnames[:] = () + continue + if directory != src_directory: dir_package = directory[len(src_directory):].replace(os.sep, '.') modules.append(package + dir_package) - for filename in fnames: - src = join(directory, filename) - if isdir(src): - continue + for filename in filenames: if _is_python_file(filename) and filename != '__init__.py': + src = join(directory, filename) module = package + src[len(src_directory):-3] modules.append(module.replace(os.sep, '.')) - modules = [] - walk(src_directory, func, modules) return modules @@ -410,26 +407,17 @@ the list of all available python module's files in the package and its subpackages """ - def func(files, directory, fnames): - """walk handler""" - # remove files/directories in the black list - for norecurs in blacklist: - try: - fnames.remove(norecurs) - except ValueError: - continue + files = [] + for directory, dirnames, filenames in os.walk(src_directory): + _handle_blacklist(blacklist, dirnames, filenames) # check for __init__.py - if not '__init__.py' in fnames: - while fnames: - fnames.pop() - for filename in fnames: - src = join(directory, filename) - if isdir(src): - continue + if not '__init__.py' in filenames: + dirnames[:] = () + continue + for filename in filenames: if _is_python_file(filename): + src = join(directory, filename) files.append(src) - files = [] - walk(src_directory, func, files) return files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/optik_ext.py new/logilab-common-0.52.1/optik_ext.py --- old/logilab-common-0.52.0/optik_ext.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/optik_ext.py 2010-09-28 18:22:01.000000000 +0200 @@ -274,12 +274,13 @@ def level_options(group, outputlevel): return [option for option in group.option_list - if getattr(option, 'level', 0) <= outputlevel + if (getattr(option, 'level', 0) or 0) <= outputlevel and not option.help is SUPPRESS_HELP] def format_option_help(self, formatter): result = [] - for option in level_options(self, getattr(formatter, 'output_level', 0)): + outputlevel = getattr(formatter, 'output_level', 0) or 0 + for option in level_options(self, outputlevel): result.append(formatter.format_option(option)) return "".join(result) OptionContainer.format_option_help = format_option_help diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/PKG-INFO new/logilab-common-0.52.1/PKG-INFO --- old/logilab-common-0.52.0/PKG-INFO 2010-09-28 18:21:47.000000000 +0200 +++ new/logilab-common-0.52.1/PKG-INFO 2010-10-14 00:03:08.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: logilab-common -Version: 0.52.0 +Version: 0.52.1 Summary: collection of low-level Python packages and modules used by Logilab projects Home-page: http://www.logilab.org/project/logilab-common Author: Logilab diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/__pkginfo__.py new/logilab-common-0.52.1/__pkginfo__.py --- old/logilab-common-0.52.0/__pkginfo__.py 2010-09-28 14:23:30.000000000 +0200 +++ new/logilab-common-0.52.1/__pkginfo__.py 2010-10-11 16:05:40.000000000 +0200 @@ -23,7 +23,7 @@ subpackage_of = 'logilab' subpackage_master = True -numversion = (0, 52, 0) +numversion = (0, 52, 1) version = '.'.join([str(num) for num in numversion]) license = 'LGPL' # 2.1 or later diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/pytest.py new/logilab-common-0.52.1/pytest.py --- old/logilab-common-0.52.0/pytest.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/pytest.py 2010-09-28 18:22:01.000000000 +0200 @@ -123,8 +123,6 @@ import imp -import __builtin__ - try: import django diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/shellutils.py new/logilab-common-0.52.1/shellutils.py --- old/logilab-common-0.52.0/shellutils.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/shellutils.py 2010-09-28 18:22:01.000000000 +0200 @@ -29,9 +29,12 @@ import time import fnmatch import errno -from os.path import exists, isdir, islink, basename, join, walk +from os.path import exists, isdir, islink, basename, join + +from logilab.common import STD_BLACKLIST, _handle_blacklist +from logilab.common.compat import raw_input +from logilab.common.compat import str_to_bytes -from logilab.common import STD_BLACKLIST try: from logilab.common.proc import ProcInfo, NoSuchProcess except ImportError: @@ -168,22 +171,14 @@ if filename.endswith(ext): return True return False - def func(files, directory, fnames): - """walk handler""" - # remove files/directories in the black list - for norecurs in blacklist: - try: - fnames.remove(norecurs) - except ValueError: - continue - for filename in fnames: - src = join(directory, filename) - if isdir(src): - continue - if match(filename, exts): - files.append(src) files = [] - walk(directory, func, files) + for dirpath, dirnames, filenames in os.walk(directory): + _handle_blacklist(blacklist, dirnames, filenames) + # don't append files if the directory is blacklisted + dirname = basename(dirpath) + if dirname in blacklist: + continue + files.extend([join(dirpath, f) for f in filenames if match(f, exts)]) return files @@ -210,11 +205,9 @@ iterator over the list of all matching files """ for curdir, dirnames, filenames in os.walk(directory): + _handle_blacklist(blacklist, dirnames, filenames) for fname in fnmatch.filter(filenames, pattern): yield join(curdir, fname) - for skipped in blacklist: - if skipped in dirnames: - dirnames.remove(skipped) def unzip(archive, destdir): import zipfile @@ -255,7 +248,7 @@ while count: try: fd = os.open(lock_file, os.O_EXCL | os.O_RDWR | os.O_CREAT) - os.write(fd, str(os.getpid())) + os.write(fd, str_to_bytes(str(os.getpid())) ) os.close(fd) return True except OSError, e: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/table.py new/logilab-common-0.52.1/table.py --- old/logilab-common-0.52.0/table.py 2010-08-26 11:34:12.000000000 +0200 +++ new/logilab-common-0.52.1/table.py 2010-10-11 16:05:41.000000000 +0200 @@ -18,7 +18,7 @@ """Table management module.""" __docformat__ = "restructuredtext en" -from logilab.common.compat import enumerate, sum, set +from logilab.common.compat import set class Table(object): """Table defines a data table with column and row names. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/test/unittest_compat.py new/logilab-common-0.52.1/test/unittest_compat.py --- old/logilab-common-0.52.0/test/unittest_compat.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/test/unittest_compat.py 2010-10-11 16:05:41.000000000 +0200 @@ -20,7 +20,7 @@ from logilab.common.testlib import TestCase, unittest_main import sys import types -import __builtin__ +from logilab.common.compat import builtins class CompatTCMixIn: MODNAMES = {} @@ -38,8 +38,8 @@ for modname in self.MODNAMES: del sys.modules[modname] for funcname, func in self.builtins_backup.items(): - setattr(__builtin__, funcname, func) - # delattr(__builtin__, 'builtin_%s' % funcname) + setattr(builtins, funcname, func) + # delattr(builtins, 'builtin_%s' % funcname) for modname, mod in self.modules_backup.items(): sys.modules[modname] = mod try: @@ -49,18 +49,18 @@ def remove_builtins(self): for builtin in self.BUILTINS: - func = getattr(__builtin__, builtin, None) + func = getattr(builtins, builtin, None) if func is not None: self.builtins_backup[builtin] = func - delattr(__builtin__, builtin) - # setattr(__builtin__, 'builtin_%s' % builtin, func) + delattr(builtins, builtin) + # setattr(builtins, 'builtin_%s' % builtin, func) def alter_builtins(self): for builtin, func in self.ALTERED_BUILTINS.iteritems(): - old_func = getattr(__builtin__, builtin, None) + old_func = getattr(builtins, builtin, None) if func is not None: self.builtins_backup[builtin] = old_func - setattr(__builtin__, builtin, func) - # setattr(__builtin__, 'builtin_%s' % builtin, func) + setattr(builtins, builtin, func) + # setattr(builtins, 'builtin_%s' % builtin, func) def remove_modules(self): for modname in self.MODNAMES: @@ -83,23 +83,10 @@ class Py23CompatTC(CompatTCMixIn, TestCase): - BUILTINS = ('enumerate', 'sum') MODNAMES = { 'sets' : ('Set', 'ImmutableSet'), - 'itertools' : ('izip', 'chain'), } - def test_sum(self): - from logilab.common.compat import sum - self.assertEqual(sum(range(5)), 10) - self.assertRaises(TypeError, sum, 'abc') - - def test_enumerate(self): - from logilab.common.compat import enumerate - self.assertEqual(list(enumerate([])), []) - self.assertEqual(list(enumerate('abc')), - [(0, 'a'), (1, 'b'), (2, 'c')]) - def test_basic_set(self): from logilab.common.compat import set s = set('abc') @@ -142,6 +129,8 @@ BUILTINS = ('reversed', 'sorted', 'set', 'frozenset',) def test_sorted(self): + if sys.version_info >= (3, 0): + self.skip("don't test 2.4 compat 'sorted' on >= 3.0") from logilab.common.compat import sorted l = [3, 1, 2, 5, 4] s = sorted(l) @@ -163,6 +152,8 @@ self.assertEqual(l, range(5)) def test_set(self): + if sys.version_info >= (3, 0): + self.skip("don't test 2.4 compat 'set' on >= 3.0") from logilab.common.compat import set s1 = set(range(5)) s2 = set(range(2, 6)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/test/unittest_fileutils.py new/logilab-common-0.52.1/test/unittest_fileutils.py --- old/logilab-common-0.52.0/test/unittest_fileutils.py 2010-05-25 10:14:30.000000000 +0200 +++ new/logilab-common-0.52.1/test/unittest_fileutils.py 2010-10-11 16:05:41.000000000 +0200 @@ -18,16 +18,17 @@ """unit tests for logilab.common.fileutils""" import sys, os, tempfile, shutil +from stat import S_IWRITE from os.path import join -from logilab.common.testlib import TestCase, unittest_main +from logilab.common.testlib import TestCase, unittest_main, unittest from logilab.common.fileutils import * - -DATA_DIR = 'data' +DATA_DIR = join(os.path.abspath(os.path.dirname(__file__)), 'data') NEWLINES_TXT = join(DATA_DIR,'newlines.txt') + class FirstleveldirectoryTC(TestCase): def test_known_values_first_level_directory(self): @@ -71,7 +72,7 @@ os.mkdir(self.tempdir) def test(self): - export('data', self.tempdir, verbose=0) + export(DATA_DIR, self.tempdir, verbose=0) self.assert_(exists(join(self.tempdir, '__init__.py'))) self.assert_(exists(join(self.tempdir, 'sub'))) self.assert_(not exists(join(self.tempdir, '__init__.pyc'))) @@ -82,8 +83,8 @@ class ProtectedFileTC(TestCase): def setUp(self): - self.rpath = 'data/write_protected_file.txt' - self.rwpath = 'data/normal_file.txt' + self.rpath = join(DATA_DIR, 'write_protected_file.txt') + self.rwpath = join(DATA_DIR, 'normal_file.txt') # Make sure rpath is not writable ! os.chmod(self.rpath, 33060) # Make sure rwpath is writable ! @@ -92,32 +93,43 @@ def test_mode_change(self): """tests that mode is changed when needed""" # test on non-writable file - self.assert_(not os.access(self.rpath, os.W_OK)) + #self.assert_(not os.access(self.rpath, os.W_OK)) + self.assert_(not os.stat(self.rpath).st_mode & S_IWRITE) wp_file = ProtectedFile(self.rpath, 'w') + self.assert_(os.stat(self.rpath).st_mode & S_IWRITE) self.assert_(os.access(self.rpath, os.W_OK)) # test on writable-file + self.assert_(os.stat(self.rwpath).st_mode & S_IWRITE) self.assert_(os.access(self.rwpath, os.W_OK)) wp_file = ProtectedFile(self.rwpath, 'w') + self.assert_(os.stat(self.rwpath).st_mode & S_IWRITE) self.assert_(os.access(self.rwpath, os.W_OK)) def test_restore_on_close(self): """tests original mode is restored on close""" # test on non-writable file - self.assert_(not os.access(self.rpath, os.W_OK)) + #self.assert_(not os.access(self.rpath, os.W_OK)) + self.assert_(not os.stat(self.rpath).st_mode & S_IWRITE) ProtectedFile(self.rpath, 'w').close() - self.assert_(not os.access(self.rpath, os.W_OK)) + #self.assert_(not os.access(self.rpath, os.W_OK)) + self.assert_(not os.stat(self.rpath).st_mode & S_IWRITE) # test on writable-file self.assert_(os.access(self.rwpath, os.W_OK)) + self.assert_(os.stat(self.rwpath).st_mode & S_IWRITE) ProtectedFile(self.rwpath, 'w').close() self.assert_(os.access(self.rwpath, os.W_OK)) + self.assert_(os.stat(self.rwpath).st_mode & S_IWRITE) def test_mode_change_on_append(self): """tests that mode is changed when file is opened in 'a' mode""" - self.assert_(not os.access(self.rpath, os.W_OK)) + #self.assert_(not os.access(self.rpath, os.W_OK)) + self.assert_(not os.stat(self.rpath).st_mode & S_IWRITE) wp_file = ProtectedFile(self.rpath, 'a') self.assert_(os.access(self.rpath, os.W_OK)) + self.assert_(os.stat(self.rpath).st_mode & S_IWRITE) wp_file.close() - self.assert_(not os.access(self.rpath, os.W_OK)) + #self.assert_(not os.access(self.rpath, os.W_OK)) + self.assert_(not os.stat(self.rpath).st_mode & S_IWRITE) from logilab.common.testlib import DocTest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/test/unittest_modutils.py new/logilab-common-0.52.1/test/unittest_modutils.py --- old/logilab-common-0.52.0/test/unittest_modutils.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/test/unittest_modutils.py 2010-09-28 18:22:01.000000000 +0200 @@ -164,7 +164,12 @@ """ def test_knownValues_is_standard_module_0(self): - self.assertEqual(modutils.is_standard_module('__builtin__'), True) + if sys.version_info < (3, 0): + self.assertEqual(modutils.is_standard_module('__builtin__'), True) + self.assertEqual(modutils.is_standard_module('builtins'), False) + else: + self.assertEqual(modutils.is_standard_module('__builtin__'), False) + self.assertEqual(modutils.is_standard_module('builtins'), True) def test_knownValues_is_standard_module_1(self): self.assertEqual(modutils.is_standard_module('sys'), True) @@ -176,7 +181,14 @@ self.assertEqual(modutils.is_standard_module('unknown'), False) def test_knownValues_is_standard_module_4(self): - self.assertEqual(modutils.is_standard_module('StringIO'), True) + if sys.version_info < (3, 0): + self.assertEqual(modutils.is_standard_module('StringIO'), True) + else: + self.assertEqual(modutils.is_standard_module('StringIO'), False) + if sys.version_info < (2, 6): + self.assertEqual(modutils.is_standard_module('io'), False) + else: + self.assertEqual(modutils.is_standard_module('io'), True) def test_knownValues_is_standard_module_5(self): self.assertEqual(modutils.is_standard_module('data.module', (DATADIR,)), True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/test/unittest_shellutils.py new/logilab-common-0.52.1/test/unittest_shellutils.py --- old/logilab-common-0.52.0/test/unittest_shellutils.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/test/unittest_shellutils.py 2010-09-28 18:22:01.000000000 +0200 @@ -20,15 +20,15 @@ import sys, os, tempfile, shutil from os.path import join import datetime, time +from StringIO import StringIO from logilab.common.testlib import TestCase, unittest_main from logilab.common.shellutils import (globfind, find, ProgressBar, acquire_lock, release_lock, RawInput) - +from logilab.common.compat import str_to_bytes from logilab.common.proc import NoSuchProcess -from StringIO import StringIO DATA_DIR = join('data','find_test') @@ -127,7 +127,7 @@ """Test the progress bar for nbops > size""" def half(total): for counter in range(1,total+1): - yield counter / 2 + yield counter // 2 self._update_test(40, half(40)) def test_nbops_lt_size(self): @@ -165,14 +165,14 @@ def test_wrong_process(self): fd = os.open(self.lock, os.O_EXCL | os.O_RDWR | os.O_CREAT) - os.write(fd, '1111111111') + os.write(fd, str_to_bytes('1111111111')) os.close(fd) self.assertTrue(os.path.exists(self.lock)) self.assertRaises(Exception, acquire_lock, self.lock, 1, 1) def test_wrong_process_and_continue(self): fd = os.open(self.lock, os.O_EXCL | os.O_RDWR | os.O_CREAT) - os.write(fd, '1111111111') + os.write(fd, str_to_bytes('1111111111')) os.close(fd) self.assertTrue(os.path.exists(self.lock)) self.assertTrue(acquire_lock(self.lock)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/test/unittest_testlib.py new/logilab-common-0.52.1/test/unittest_testlib.py --- old/logilab-common-0.52.0/test/unittest_testlib.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/test/unittest_testlib.py 2010-10-11 16:05:41.000000000 +0200 @@ -17,7 +17,6 @@ # with logilab-common. If not, see http://www.gnu.org/licenses/. """unittest module for logilab.comon.testlib""" -import unittest import os import sys from os.path import join, dirname, isdir, isfile, abspath, exists @@ -32,15 +31,10 @@ except NameError: __file__ = sys.argv[0] -if sys.version_info < (3, 2): - from unittest2 import TestSuite -else: - from unittest import TestSuite - +from logilab.common.testlib import unittest, TestSuite, unittest_main from logilab.common.testlib import TestCase, SkipAwareTextTestRunner, Tags from logilab.common.testlib import mock_object, NonStrictTestLoader, create_files -from logilab.common.testlib import capture_stdout, unittest_main, InnerTest -from logilab.common.testlib import with_tempdir, tag +from logilab.common.testlib import capture_stdout, InnerTest, with_tempdir, tag from logilab.common.testlib import require_version, require_module @@ -273,7 +267,7 @@ tc = MyTC('test_1') self.assertEqual(tc.datapath('bar'), join('foo', 'bar')) # instance's custom datadir - self.skipTest('should this really works?') + self.skipTest('should this really work?') tc.datadir = 'spam' self.assertEqual(tc.datapath('bar'), join('spam', 'bar')) @@ -662,6 +656,7 @@ sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ + @unittest.skipIf(not sys.stdout.isatty(), "need stdout") def test_stdout_capture(self): class FooTC(TestCase): def test_stdout(self): @@ -673,6 +668,7 @@ self.assertEqual(captured_out.strip(), "foo") self.assertEqual(captured_err.strip(), "") + @unittest.skipIf(not sys.stderr.isatty(), "need stderr") def test_stderr_capture(self): class FooTC(TestCase): def test_stderr(self): @@ -684,7 +680,8 @@ self.assertEqual(captured_out.strip(), "") self.assertEqual(captured_err.strip(), "foo") - + @unittest.skipIf(not sys.stderr.isatty(), "need stderr") + @unittest.skipIf(not sys.stdout.isatty(), "need stdout") def test_both_capture(self): class FooTC(TestCase): def test_stderr(self): @@ -697,6 +694,8 @@ self.assertEqual(captured_out.strip(), "bar") self.assertEqual(captured_err.strip(), "foo") + @unittest.skipIf(not sys.stderr.isatty(), "need stderr") + @unittest.skipIf(not sys.stdout.isatty(), "need stdout") def test_no_capture(self): class FooTC(TestCase): def test_stderr(self): @@ -711,7 +710,7 @@ self.assertEqual(captured_out.strip(), "") self.assertEqual(captured_err.strip(), "") - + @unittest.skipIf(not sys.stdout.isatty(), "need stdout") def test_capture_core(self): # output = capture_stdout() # bootstrap_print("hello", output=sys.stdout) @@ -740,9 +739,7 @@ class DecoratorTC(TestCase): @with_tempdir - def test_tmp_dir_normal(self): - - + def test_tmp_dir_normal_1(self): tempdir = tempfile.gettempdir() # assert temp directory is empty self.assertListEqual(list(os.walk(tempdir)), @@ -772,7 +769,7 @@ [(tempdir,[],[])]) @with_tempdir - def test_tmp_dir_normal(self): + def test_tmp_dir_normal_2(self): tempdir = tempfile.gettempdir() # assert temp directory is empty @@ -796,7 +793,6 @@ self.assertRaises(WitnessException, createfile) - # assert tempdir didn't change self.assertEqual(tempfile.gettempdir(), tempdir) @@ -804,7 +800,6 @@ self.assertListEqual(list(os.walk(tempdir)), [(tempdir,[],[])]) - def setUp(self): self.pyversion = sys.version_info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/testlib.py new/logilab-common-0.52.1/testlib.py --- old/logilab-common-0.52.0/testlib.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/testlib.py 2010-10-13 19:12:12.000000000 +0200 @@ -55,7 +55,6 @@ from shutil import rmtree from operator import itemgetter import warnings -from compiler.consts import CO_GENERATOR from ConfigParser import ConfigParser from logilab.common.deprecation import deprecated from itertools import dropwhile @@ -85,8 +84,8 @@ test_support = TestSupport() # pylint: disable=W0622 -from logilab.common.compat import set, enumerate, any, sorted, InheritableSet -# pylint: enable-msg=W0622 +from logilab.common.compat import set, any, sorted, InheritableSet, callable +# pylint: enable=W0622 from logilab.common.modutils import load_module_from_name from logilab.common.debugger import Debugger, colorize_source from logilab.common.decorators import cached, classproperty @@ -102,6 +101,23 @@ FILE_RESTART = ".pytest.restart" +if sys.version_info >= (2, 6): + # FIXME : this does not work as expected / breaks tests on testlib + # however testlib does not work on py3k for many reasons ... + from inspect import CO_GENERATOR +else: + from compiler.consts import CO_GENERATOR + +if sys.version_info >= (3, 0): + def is_generator(function): + flags = function.__code__.co_flags + return flags & CO_GENERATOR + +else: + def is_generator(function): + flags = function.func_code.co_flags + return flags & CO_GENERATOR + # used by unittest to count the number of relevant levels in the traceback __unittest = 1 @@ -486,7 +502,6 @@ testname = '%s.%s' % (test.im_class.__name__, func.__name__) else: return True # Not sure when this happens - if is_generator(func) and skipgenerator: return self.does_match_tags(func) # Let inner tests decide at run time # print 'testname', testname, self.test_pattern @@ -959,10 +974,6 @@ """raised when a test is skipped""" pass -def is_generator(function): - flags = function.func_code.co_flags - return flags & CO_GENERATOR - def parse_generative_args(params): args = [] varargs = () @@ -1033,7 +1044,7 @@ super(TestCase, self).__init__(methodName) # internal API changed in python2.5 if sys.version_info >= (2, 5): - self.__exc_info = self._exc_info + self.__exc_info = sys.exc_info self.__testMethodName = self._testMethodName else: # let's give easier access to _testMethodName to every subclasses diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/textutils.py new/logilab-common-0.52.1/textutils.py --- old/logilab-common-0.52.0/textutils.py 2010-09-28 14:23:30.000000000 +0200 +++ new/logilab-common-0.52.1/textutils.py 2010-10-11 16:05:41.000000000 +0200 @@ -73,12 +73,12 @@ def unormalize(ustring, ignorenonascii=False): """replace diacritical characters with their corresponding ascii characters - + Convert the unicode string to its long normalized form (unicode character will be transform into several characters) and keep the first one only. The normal form KD (NFKD) will apply the compatibility decomposition, i.e. replace all compatibility characters with their equivalents. - + :see: Another project about ASCII transliterations of Unicode text http://pypi.python.org/pypi/Unidecode """ @@ -286,7 +286,7 @@ return res for line in text.splitlines(): line = line.strip() - if line: + if line and not line.startswith('#'): key, value = [w.strip() for w in line.split('=', 1)] if key in res: try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logilab-common-0.52.0/umessage.py new/logilab-common-0.52.1/umessage.py --- old/logilab-common-0.52.0/umessage.py 2010-09-28 14:23:31.000000000 +0200 +++ new/logilab-common-0.52.1/umessage.py 2010-09-28 18:22:01.000000000 +0200 @@ -25,8 +25,14 @@ import email from encodings import search_function -from email.Utils import parseaddr, parsedate -from email.Header import decode_header +import sys +if sys.version_info >= (2, 5): + from email.utils import parseaddr, parsedate + from email.header import decode_header +else: + from email.Utils import parseaddr, parsedate + from email.Header import decode_header + from datetime import datetime try: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de