Hello community, here is the log from the commit of package python-traits for openSUSE:Factory checked in at 2019-02-24 17:18:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-traits (Old) and /work/SRC/openSUSE:Factory/.python-traits.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-traits" Sun Feb 24 17:18:57 2019 rev:2 rq:678045 version:5.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-traits/python-traits.changes 2018-05-29 16:47:23.790588944 +0200 +++ /work/SRC/openSUSE:Factory/.python-traits.new.28833/python-traits.changes 2019-02-24 17:19:02.388411654 +0100 @@ -1,0 +2,17 @@ +Thu Feb 21 15:55:27 UTC 2019 - Todd R <[email protected]> + +- Add avoid_sys_modules_hackery.patch + Fixes building with latest numpy + see: gh#enthought/traits#441 + +------------------------------------------------------------------- +Wed Feb 6 19:07:03 UTC 2019 - Todd R <[email protected]> + +- Update to 5.0.0 + + highlights of this release are + * Removal of 2to3 fixers and the use of six to provide Python 2/3 compatibility + * Removal of deprecated `traits.protocols` submodule and related utils. + * New `HasRequiredTraits` class + * Better IPython tab completion for `HasTraits` subclasses + +------------------------------------------------------------------- Old: ---- traits-4.6.0.tar.gz New: ---- avoid_sys_modules_hackery.patch traits-5.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-traits.spec ++++++ --- /var/tmp/diff_new_pack.GHGAWW/_old 2019-02-24 17:19:03.872411390 +0100 +++ /var/tmp/diff_new_pack.GHGAWW/_new 2019-02-24 17:19:03.880411389 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-traits # -# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -20,7 +20,7 @@ %define oldpython python %bcond_without test Name: python-traits -Version: 4.6.0 +Version: 5.0.0 Release: 0 Summary: Explicitly typed attributes for Python License: BSD-3-Clause and EPL-1.0 and LGPL-2.1 @@ -31,15 +31,20 @@ # 3-clause license. Confirmed from upstream. Url: https://github.com/enthought/traits Source: https://files.pythonhosted.org/packages/source/t/traits/traits-%{version}.tar.gz +# PATCH-FIX-UPSTREAM avoid_sys_modules_hackery.patch -- Avoid sys.modules hackery in a test -- gh#enthought/traits#441 +Patch0: avoid_sys_modules_hackery.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module numpy} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros %if %{with test} +BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} %endif Requires: python-numpy +Requires: python-six Recommends: python-traitsui %ifpython2 Provides: %{oldpython}-Traits = %{version} @@ -67,6 +72,7 @@ %prep %setup -q -n traits-%{version} +%patch0 -p1 %fdupes examples/ # file not utf-8 iconv -f iso8859-1 -t utf-8 image_LICENSE_Eclipse.txt > image_LICENSE_Eclipse.txt.conv ++++++ avoid_sys_modules_hackery.patch ++++++ >From 652ca3847a8e4b53cca195f8574135ff6080902b Mon Sep 17 00:00:00 2001 From: Mark Dickinson <[email protected]> Date: Wed, 30 Jan 2019 14:44:11 +0000 Subject: [PATCH] Avoid sys.modules hackery in a test. --- traits/tests/test_trait_types.py | 54 +++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/traits/tests/test_trait_types.py b/traits/tests/test_trait_types.py index e58e55fb..34138c7b 100644 --- a/traits/tests/test_trait_types.py +++ b/traits/tests/test_trait_types.py @@ -18,7 +18,20 @@ """ Unit test case for testing trait types created by subclassing TraitType. """ -from traits.testing.unittest_tools import unittest +import os +import sys +import tempfile +import textwrap +import shutil +import subprocess +import unittest + +try: + import numpy # noqa F401 +except ImportError: + numpy_available = False +else: + numpy_available = True from traits.api import Float, TraitType @@ -35,28 +48,31 @@ def get(self, obj, name): LazyProperty().as_ctrait() self.assertFalse(Float().transient) + @unittest.skipUnless(numpy_available, "test requires NumPy") def test_numpy_validators_loaded_if_numpy_present(self): - # If 'numpy' is available, the numpy validators should be loaded. - - # Make sure that numpy is present on this machine. - try: + # If 'numpy' is available, the numpy validators should be loaded, + # even if numpy is imported after traits. + test_script = textwrap.dedent(""" + from traits.trait_types import float_fast_validate import numpy - except ImportError: - self.skipTest("numpy library not found.") - # Remove numpy from the list of imported modules. - import sys - - del sys.modules["numpy"] - for k in list(sys.modules): - if k.startswith("numpy."): - del sys.modules[k] - - # Check that the validators contain the numpy types. - from traits.trait_types import float_fast_validate - import numpy + if numpy.floating in float_fast_validate: + print("Success") + else: + print("Failure") + """) + this_python = sys.executable + tmpdir = tempfile.mkdtemp() + try: + tmpfile = os.path.join(tmpdir, "test_script.py") + with open(tmpfile, "w") as f: + f.write(test_script) + cmd = [this_python, tmpfile] + output = subprocess.check_output(cmd).decode("utf-8") + finally: + shutil.rmtree(tmpdir) - self.assertIn(numpy.floating, float_fast_validate) + self.assertEqual(output.strip(), "Success") # Run the unit tests (if invoked from the command line): ++++++ traits-4.6.0.tar.gz -> traits-5.0.0.tar.gz ++++++ ++++ 40990 lines of diff (skipped)
