diff --git a/.gitignore b/.gitignore index c58dfb9..9b8aa5f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /scikit-learn-0.15.0b1.tar.gz /scikit-learn-0.15.0b2.tar.gz /scikit-learn-0.15.0.tar.gz +/scikit-learn-0.15.1.tar.gz diff --git a/python-scikit-learn.spec b/python-scikit-learn.spec index 21eb420..b37e7fe 100644 --- a/python-scikit-learn.spec +++ b/python-scikit-learn.spec @@ -2,7 +2,7 @@ %global with_python3 1 Name: python-scikit-learn -Version: 0.15.0 +Version: 0.15.1 Release: 1%{?dist} Summary: Machine learning in Python License: BSD @@ -124,6 +124,9 @@ popd %endif # with_python3 %changelog +* Sat Aug 02 2014 Sergio Pascual - 0.15.1-1 +- New upstream (0.15.1), bugfix + * Tue Jul 15 2014 Sergio Pascual - 0.15.0-1 - New upstream (0.15.0), final diff --git a/sources b/sources index 88a5c79..2c333b7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7017e300ee98475d2c3648ba9b9046b5 scikit-learn-0.15.0.tar.gz +236aa05b1a6d067c28f34d5e9942af17 scikit-learn-0.15.1.tar.gz diff --git a/system-six.py b/system-six.py index 3a39d22..4888620 100644 --- a/system-six.py +++ b/system-six.py @@ -1,55 +1,56 @@ # Licensed under a 3-clause BSD style license - see README.rst + """ Handle loading six package from system or from the bundled copy - """ -import sys - -# Trying to load alternate six packages -sys.modules['sklearn.externals.six'] = None - -# We have removed everything we already imported -# Importing again - -import sys - -def _load_six_moves(base, dest): - _cur_sys_modules = list(sys.modules.items()) - for i,mod in _cur_sys_modules: - if i.startswith(base): - pre, full, trail = i.partition(base) - if not pre: - modname = dest + trail - sys.modules[modname] = mod - -_system_package = False - -_dest_moves = 'sklearn.externals.six.moves' -_dest_root = 'sklearn.externals.six' - -try: - import six - _system_package = True -except ImportError: - _system_package = False - -if _system_package: - # Check six version - _valid_version = True - if _valid_version: - # handle 'moves' - _base_moves = 'six.moves' - _load_six_moves(_base_moves, _dest_moves) - six.system_package = True - six.bundled_package = False - sys.modules[_dest_root] = six - -if not _system_package: - import astropy.extern.bundled.six as six - # handle 'moves' - _base_moves = 'sklearn.externals.six.bundled.six.moves' - _load_six_moves(_base_moves, _dest_moves) - six.system_package = False - six.bundled_package = True - sys.modules[_dest_root] = six +import imp +from distutils.version import StrictVersion + + +_SIX_MIN_VERSION = StrictVersion('1.5.0') + +# Update this to prevent Astropy from using its bundled copy of six +# (but only if some other version of at least _SIX_MIN_VERSION can +# be provided) +_SIX_SEARCH_PATH = ['six', 'sklearn.externals.bundled.six'] + + +def _find_module(name, path=None): + """ + Alternative to `imp.find_module` that can also search in subpackages. + """ + + parts = name.split('.') + + for part in parts: + if path is not None: + path = [path] + + fh, path, descr = imp.find_module(part, path) + + return fh, path, descr + + +for mod_name in _SIX_SEARCH_PATH: + try: + mod_info = _find_module(mod_name) + except ImportError: + continue + + mod = imp.load_module(__name__, *mod_info) + + try: + if StrictVersion(mod.__version__) >= _SIX_MIN_VERSION: + break + except (AttributeError, ValueError): + # Attribute error if the six module isn't what it should be and doesn't + # have a .__version__; ValueError if the version string exists but is + # somehow bogus/unparseable + continue +else: + raise ImportError( + "sklearn requires the 'six' module of minimum version {0}; " + "normally this is bundled with the astropy package so if you get " + "this warning consult the packager of your sklearn " + "distribution.".format(_SIX_MIN_VERSION))