Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-colorful for openSUSE:Factory 
checked in at 2023-01-04 17:53:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-colorful (Old)
 and      /work/SRC/openSUSE:Factory/.python-colorful.new.1563 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-colorful"

Wed Jan  4 17:53:37 2023 rev:2 rq:1055865 version:0.5.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-colorful/python-colorful.changes  
2022-10-11 18:04:52.782019811 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-colorful.new.1563/python-colorful.changes    
    2023-01-04 17:53:53.726638775 +0100
@@ -1,0 +2,9 @@
+Wed Jan  4 14:25:06 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 0.5.5:
+  * Fix `setup(colormode=NO_COLORS)`
+  * Fix correctnes of `__str__` to return always a str
+  * Drop Python 2 support
+  * Test Python 3.5 - Python 3.11
+
+-------------------------------------------------------------------

Old:
----
  colorful-0.5.4.tar.gz

New:
----
  colorful-0.5.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-colorful.spec ++++++
--- /var/tmp/diff_new_pack.rcX93X/_old  2023-01-04 17:53:54.270641982 +0100
+++ /var/tmp/diff_new_pack.rcX93X/_new  2023-01-04 17:53:54.274642006 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-colorful
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-colorful
-Version:        0.5.4
+Version:        0.5.5
 Release:        0
 Summary:        Terminal string styling done right, in Python
 License:        MIT

++++++ colorful-0.5.4.tar.gz -> colorful-0.5.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/.github/workflows/main.yml 
new/colorful-0.5.5/.github/workflows/main.yml
--- old/colorful-0.5.4/.github/workflows/main.yml       2019-09-21 
14:24:45.000000000 +0200
+++ new/colorful-0.5.5/.github/workflows/main.yml       2022-12-04 
14:47:35.000000000 +0100
@@ -8,15 +8,20 @@
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
-      max-parallel: 4
+      max-parallel: 8
       matrix:
-        python-version: [2.7, 3.5, 3.6, 3.7]
+        python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
         os: [ubuntu-latest, windows-latest, macOS-latest]
+        include:
+          - os: ubuntu-18.04
+            python-version: 3.5
+          - os: ubuntu-18.04
+            python-version: 3.6
 
     steps:
-      - uses: actions/checkout@v1
+      - uses: actions/checkout@v3
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v1
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
       - name: Setup build and test environment
@@ -29,7 +34,7 @@
       - name: Lint with flake8
         run: |
           pip install flake8
-          flake8 --show-source src/ tests/
+          flake8 --show-source colorful/ tests/
       - name: Test with pytest
         run: |
           coverage run --parallel -m pytest
@@ -41,7 +46,7 @@
       - name: Upload coverage to Codecov
         # codecov only runs on Linux
         if: startsWith(matrix.os, 'ubuntu-')
-        uses: codecov/[email protected]
+        uses: codecov/codecov-action@v3
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           file: ./coverage.xml
@@ -53,12 +58,12 @@
     runs-on: ubuntu-latest
 
     steps:
-      - uses: actions/checkout@v1
-      - name: Set up Python 3.7
+      - uses: actions/checkout@v3
+      - name: Set up Python 3.11
         if: startsWith(github.event.ref, 'refs/tags')
-        uses: actions/setup-python@v1
+        uses: actions/setup-python@v4
         with:
-          python-version: 3.7
+          python-version: 3.11
       - name: Build Package
         if: startsWith(github.event.ref, 'refs/tags')
         run: |
@@ -66,7 +71,7 @@
           python setup.py sdist bdist_wheel --universal
       - name: Publish Package on PyPI
         if: startsWith(github.event.ref, 'refs/tags')
-        uses: pypa/gh-action-pypi-publish@master
+        uses: pypa/gh-action-pypi-publish@release/v1
         with:
           user: __token__
           password: ${{ secrets.pypi_token }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/.github/workflows/stale.yml 
new/colorful-0.5.5/.github/workflows/stale.yml
--- old/colorful-0.5.4/.github/workflows/stale.yml      2019-09-21 
14:24:45.000000000 +0200
+++ new/colorful-0.5.5/.github/workflows/stale.yml      1970-01-01 
01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-name: "Close Stale Issues and Pull Requests"
-on:
-  schedule:
-  - cron: "0 * * * *"
-
-jobs:
-  stale:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/stale@v1
-      with:
-        repo-token: ${{ secrets.GITHUB_TOKEN }}
-        days-before-stale: 60
-        days-before-close: 7
-        stale-issue-label: stale
-        stale-pr-label: state
-        stale-issue-message: 'This Issue is stale because it has been open 60 
days with no activity. Remove stale label or comment or this will be closed in 
7 days'
-        stale-pr-message: 'This Pull Request is stale because it has been open 
60 days with no activity. Remove stale label or comment or this will be closed 
in 7 days'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/CHANGELOG.md 
new/colorful-0.5.5/CHANGELOG.md
--- old/colorful-0.5.4/CHANGELOG.md     2019-09-21 14:24:45.000000000 +0200
+++ new/colorful-0.5.5/CHANGELOG.md     2022-12-04 14:47:35.000000000 +0100
@@ -6,6 +6,13 @@
 
 *Nothing here yet.*
 
+## [v0.5.5]
+## Fixed
+- Fix `setup(colormode=NO_COLORS)`
+- Fix correctnes of `__str__` to return always a str
+- Drop Python 2 support
+- Test Python 3.5 - Python 3.11
+
 ## [v0.5.4]
 ## Fixed
 - `__getattr__` protocol implementation
@@ -116,7 +123,8 @@
 
 - Initial release
 
-[Unreleased]: https://github.com/timofurrer/colorful/compare/v0.5.4...HEAD
+[Unreleased]: https://github.com/timofurrer/colorful/compare/v0.5.5...HEAD
+[v0.5.5]: https://github.com/timofurrer/colorful/compare/v0.5.4...v0.5.5
 [v0.5.4]: https://github.com/timofurrer/colorful/compare/v0.5.3...v0.5.4
 [v0.5.3]: https://github.com/timofurrer/colorful/compare/v0.5.2...v0.5.3
 [v0.5.2]: https://github.com/timofurrer/colorful/compare/v0.5.1...v0.5.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/README.md new/colorful-0.5.5/README.md
--- old/colorful-0.5.4/README.md        2019-09-21 14:24:45.000000000 +0200
+++ new/colorful-0.5.5/README.md        2022-12-04 14:47:35.000000000 +0100
@@ -54,7 +54,7 @@
     'companyOrange': '#f4b942',
     'companyBaige': '#e8dcc5'
 }
-with cf.with_palette(my_company_palette) as c:
+with cf.with_palette(MY_COMPANY_PALETTE) as c:
     print(c.companyOrange_on_companyBaige('Thanks for choosing our product!'))
 
 # use f-string (only Python >= 3.6)
@@ -79,7 +79,7 @@
 
 ## Usage
 
-**colorful** supports all major Python versions: *2.7*, *3.4*, *3.5*, *3.6* 
and *3.7*. <br>
+**colorful** supports all major Python versions: *3.5*, *3.6* and *3.7*, 
*3.8*, *3.9*, *3.10*, *3.11*. <br>
 We recommend to use the latest version released on 
[PyPI](https://pypi.python.org/pypi/colorful):
 
 ```bash
@@ -318,8 +318,6 @@
 
 The `cf.print()` method accepts the same arguments as the Python 3.X [built-in 
print()](https://docs.python.org/3/library/functions.html#print) function.
 
-*Note: for Python 2 you have to import the print function: `from __future__ 
import print_function`.*
-
 #### (5) Style a string with 
[`str.format()`](https://docs.python.org/3.6/library/stdtypes.html#str.format)
 
 ```python
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/colorful/__init__.py 
new/colorful-0.5.5/colorful/__init__.py
--- old/colorful-0.5.4/colorful/__init__.py     2019-09-21 14:24:45.000000000 
+0200
+++ new/colorful-0.5.5/colorful/__init__.py     2022-12-04 14:47:35.000000000 
+0100
@@ -21,7 +21,7 @@
 from . import terminal
 
 #: Holds the current version
-__version__ = '0.5.4'
+__version__ = '0.5.5'
 
 # if we are on Windows we have to init colorama
 if platform.system() == 'Windows':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/colorful/core.py 
new/colorful-0.5.5/colorful/core.py
--- old/colorful-0.5.4/colorful/core.py 2019-09-21 14:24:45.000000000 +0200
+++ new/colorful-0.5.5/colorful/core.py 2022-12-04 14:47:35.000000000 +0100
@@ -10,17 +10,12 @@
     :license: MIT, see LICENSE for more details.
 """
 
-from __future__ import print_function
-from __future__ import unicode_literals
-
 import os
-import sys
 
 from . import ansi
 from . import colors
 from . import styles
 from . import terminal
-from .utils import PY2, DEFAULT_ENCODING, UNICODE
 
 #: Holds the name of the env variable which is
 #  used as path to the default rgb.txt file
@@ -218,10 +213,7 @@
     ansi_start_code, ansi_end_code = ansi_style
 
     # replace nest placeholders with the current begin style
-    if PY2:
-        if isinstance(string, str):
-            string = string.decode(DEFAULT_ENCODING)
-    string = UNICODE(string).replace(ansi.NEST_PLACEHOLDER, ansi_start_code)
+    string = str(string).replace(ansi.NEST_PLACEHOLDER, ansi_start_code)
 
     return '{start_code}{string}{end_code}{nest_ph}'.format(
             start_code=ansi_start_code,
@@ -235,28 +227,15 @@
     Represents a colored string
     """
     def __init__(self, orig_string, styled_string, colorful_ctx):
-        self.orig_string = orig_string
-        self.styled_string = styled_string
+        self.orig_string = str(orig_string)
+        self.styled_string = str(styled_string)
         self.colorful_ctx = colorful_ctx
 
-    if PY2:
-        def __unicode__(self):
-            if self.colorful_ctx.colormode == terminal.NO_COLORS:
-                return self.orig_string
-            else:
-                return self.styled_string
-
-        def __str__(self):
-            if self.colorful_ctx.colormode == terminal.NO_COLORS:
-                return self.orig_string.encode(DEFAULT_ENCODING)
-            else:
-                return self.styled_string.encode(DEFAULT_ENCODING)
-    else:
-        def __str__(self):
-            if self.colorful_ctx.colormode == terminal.NO_COLORS:
-                return self.orig_string
-            else:
-                return self.styled_string
+    def __str__(self):
+        if self.colorful_ctx.colormode == terminal.NO_COLORS:
+            return self.orig_string
+        else:
+            return self.styled_string
 
     def __len__(self):
         return len(self.orig_string)
@@ -403,7 +382,7 @@
                                   color names to it's corresponding RGB value
         :param bool extend_colors: extend the active color palette instead of 
replacing it
         """
-        if colormode:
+        if colormode is not None:
             self.colormode = colormode
 
         if colorpalette:
@@ -497,7 +476,7 @@
         """
         return ColorfulString(string, string, self)
 
-    def print(self, *objects, **options):
+    def print(self, *objects, sep=' ', end='\n', file=None, flush=False):
         """
         Print the given objects to the given file stream.
         See https://docs.python.org/3/library/functions.html#print
@@ -511,27 +490,8 @@
         :param file: the file stream to write to
         :param bool flush: if the stream should be flushed
         """
-        # NOTE: change signature to same as print() built-in function as
-        #       soon as Python 2.7 is not supported anymore.
-        #       If causes problems because of the keyword args after *args
-        allowed_options = {'sep', 'end', 'file', 'flush'}
-        given_options = set(options.keys())
-        if not given_options.issubset(allowed_options):
-            raise TypeError('Colorful.print() got unexpected keyword 
arguments: {0}'.format(
-                ', '.join(given_options.difference(allowed_options))))
-
-        sep = options.get('sep', ' ')
-        end = options.get('end', '\n')
-        file = options.get('file', sys.stdout)
-        flush = options.get('flush', False)
-
         styled_objects = [self.format(o) for o in objects]
-        print(*styled_objects, sep=sep, end=end, file=file)
-
-        # NOTE: if Python 2.7 support is dropped we can directly forward the
-        #       flush keyword argument to the print() function.
-        if flush:
-            file.flush()
+        print(*styled_objects, sep=sep, end=end, file=file, flush=flush)
 
     class ColorfulStyle(object):
         """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/colorful/utils.py 
new/colorful-0.5.5/colorful/utils.py
--- old/colorful-0.5.4/colorful/utils.py        2019-09-21 14:24:45.000000000 
+0200
+++ new/colorful-0.5.5/colorful/utils.py        2022-12-04 14:47:35.000000000 
+0100
@@ -10,21 +10,6 @@
     :license: MIT, see LICENSE for more details.
 """
 import re
-import sys
-
-PY2 = sys.version_info.major == 2
-
-if PY2:
-    UNICODE = unicode  # noqa
-else:
-    UNICODE = str
-
-# Catch error in case sys.stdout was patched with an object that doesn't 
provide
-# the 'encoding' attribute.
-try:
-    DEFAULT_ENCODING = sys.stdout.encoding or 'utf-8'
-except AttributeError:
-    DEFAULT_ENCODING = 'utf-8'
 
 
 def hex_to_rgb(value):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/setup.py new/colorful-0.5.5/setup.py
--- old/colorful-0.5.4/setup.py 2019-09-21 14:24:45.000000000 +0200
+++ new/colorful-0.5.5/setup.py 2022-12-04 14:47:35.000000000 +0100
@@ -92,13 +92,15 @@
             'Operating System :: MacOS :: MacOS X',
             'Operating System :: Microsoft :: Windows',
             'Programming Language :: Python',
-            'Programming Language :: Python :: 2',
-            'Programming Language :: Python :: 2.7',
             'Programming Language :: Python :: 3',
             'Programming Language :: Python :: 3.4',
             'Programming Language :: Python :: 3.5',
             'Programming Language :: Python :: 3.6',
             'Programming Language :: Python :: 3.7',
+            'Programming Language :: Python :: 3.8',
+            'Programming Language :: Python :: 3.9',
+            'Programming Language :: Python :: 3.10',
+            'Programming Language :: Python :: 3.11',
             'Programming Language :: Python :: Implementation',
             'Programming Language :: Python :: Implementation :: CPython',
             'Programming Language :: Python :: Implementation :: PyPy'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/tests/test_core.py 
new/colorful-0.5.5/tests/test_core.py
--- old/colorful-0.5.4/tests/test_core.py       2019-09-21 14:24:45.000000000 
+0200
+++ new/colorful-0.5.5/tests/test_core.py       2022-12-04 14:47:35.000000000 
+0100
@@ -10,9 +10,6 @@
     :license: MIT, see LICENSE for more details.
 """
 
-# NOTE: only used for Colorful.print()
-from __future__ import print_function
-
 import os
 import sys
 
@@ -23,7 +20,6 @@
 
 import colorful.core as core  # noqa
 import colorful.terminal as terminal  # noqa
-from colorful.utils import UNICODE  # noqa
 
 
 @pytest.mark.parametrize('style_string,expected', [
@@ -453,7 +449,6 @@
     os.environ = os_env_backup
 
 
[email protected](not sys.stdout.isatty(), reason='fails without a tty')
 def test_reading_color_palette(tmpdir):
     """
     Test reading color palette from file
@@ -464,7 +459,7 @@
 0 0 0 myBlack
 255 255 255      myWhite""")
 
-    colorful = core.Colorful(colorpalette=str(palette_file))
+    colorful = core.Colorful(colormode=terminal.ANSI_8_COLORS, 
colorpalette=str(palette_file))
     assert str(colorful.myBlack) == '\033[30m'
     assert str(colorful.myWhite) == '\033[37m'
 
@@ -507,6 +502,18 @@
     assert str(colorful.black) == '\033[38;2;0;0;0m'
 
 
+def test_colorful_obj_setup_with_no_colors():
+    """
+    Test setup switching an existing colorful object to NO_COLORS (disabled)
+    """
+    colorful = core.Colorful(colormode=terminal.ANSI_8_COLORS)
+    colorful.setup(colormode=terminal.NO_COLORS)
+
+    assert colorful.colormode == terminal.NO_COLORS
+
+    assert str(colorful.red('color is illusion')) == 'color is illusion'
+
+
 @pytest.mark.parametrize('method_name, colorname, expected', [
     ('use_8_ansi_colors', 'black', '\033[30m'),
     ('use_16_ansi_colors', 'black', '\033[30m'),
@@ -606,18 +613,6 @@
     assert err == ''
 
 
-def test_colorful_print_wrong_argument():
-    """
-    Test calling the colorful.print method with wrong arguments
-    """
-    colorful = core.Colorful(colormode=terminal.ANSI_8_COLORS)
-
-    with pytest.raises(TypeError) as exc:
-        colorful.print('Never printed because of argument error', foo=42)
-
-    assert str(exc.value) == 'Colorful.print() got unexpected keyword 
arguments: foo'
-
-
 @pytest.mark.parametrize('method_name, expected', [
     ('bold', 'No, I am your father'),
     ('struckthrough', 'No, I am your father'),
@@ -775,7 +770,7 @@
     styled_s = colorful.black(s)
 
     # test basic unicode support
-    assert UNICODE(styled_s) == u'\033[30m🐧🎉🐧\033[39m'
+    assert str(styled_s) == u'\033[30m🐧🎉🐧\033[39m'
 
 
 def test_combining_styles():
@@ -851,6 +846,23 @@
     assert str(s) == "foo: bar"
 
 
+def test_underling_type_should_be_stored_as_str():
+    """
+    This test ensures that __str__ is correctly implement
+    if the input is not a str.
+    Otherwise Python complains:
+    TypeError: __str__ returned non-string (type int)
+    """
+    # given
+    colorful = core.Colorful(colormode=terminal.NO_COLORS)
+
+    # when
+    s = "foo: {}".format(str(colorful.red(1)))
+
+    # then
+    assert str(s) == "foo: 1"
+
+
 @pytest.mark.parametrize("style_a_name, style_b_name, expected_equal", [
     pytest.param("red", "red", True, id="red == red"),
     pytest.param("red", "blue", False, id="red != blue"),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/colorful-0.5.4/tox.ini new/colorful-0.5.5/tox.ini
--- old/colorful-0.5.4/tox.ini  2019-09-21 14:24:45.000000000 +0200
+++ new/colorful-0.5.5/tox.ini  2022-12-04 14:47:35.000000000 +0100
@@ -1,5 +1,5 @@
 [tox]
-envlist = flake8,py27,pypy,py34,py35,py36,py37
+envlist = flake8,pypy,py35,py36,py37,py38,py39,py310,py311
 skip_missing_interpreters = True
 
 [testenv]

Reply via email to