Hello community, here is the log from the commit of package python-coloredlogs for openSUSE:Factory checked in at 2020-04-01 19:20:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-coloredlogs (Old) and /work/SRC/openSUSE:Factory/.python-coloredlogs.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-coloredlogs" Wed Apr 1 19:20:06 2020 rev:7 rq:790586 version:14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-coloredlogs/python-coloredlogs.changes 2020-02-15 22:25:49.735322981 +0100 +++ /work/SRC/openSUSE:Factory/.python-coloredlogs.new.3248/python-coloredlogs.changes 2020-04-01 19:20:12.987581816 +0200 @@ -1,0 +2,20 @@ +Wed Apr 1 11:52:27 UTC 2020 - Marketa Calabkova <[email protected]> + +- Update to 14.0 + * Merged pull request `#80`_ that drops support for Python 3.4 which + has gone end-of-life and now represents less than 1% of PyPI downloads. + * Improved compatibility with the Python standard library by changing + the order of positional arguments received by the initializer of the + :class:`~coloredlogs.ColoredFormatter` class (as suggested in `#64`_ + and `#75`_). + * Add support for the ``%(username)s`` field (requested in `#76`_) and properly + document supported custom fields. + * Consistently use ``console`` highlighting in documentation. + * Fix a broken link in the readme. + * Merge pull request `#79`_ which adds support for Python 3.8. + * Fix support for custom log record factories and add a test to avoid + regressions (`#47`_, `#59`_). + * Change ``make screenshots`` to be Python 3 compatible and document + additional requirements (`#65`_). + +------------------------------------------------------------------- Old: ---- coloredlogs-11.0.tar.gz New: ---- coloredlogs-14.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-coloredlogs.spec ++++++ --- /var/tmp/diff_new_pack.Eixyvk/_old 2020-04-01 19:20:14.395582450 +0200 +++ /var/tmp/diff_new_pack.Eixyvk/_new 2020-04-01 19:20:14.403582453 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-coloredlogs -Version: 11.0 +Version: 14.0 Release: 0 Summary: Colored terminal output for Python's logging module License: MIT @@ -27,7 +27,7 @@ URL: https://github.com/xolox/python-coloredlogs Source: https://files.pythonhosted.org/packages/source/c/coloredlogs/coloredlogs-%{version}.tar.gz # PATCH-FIX-OPENSUSE test_cli_conversion_test.patch [email protected] -# With using alternatives, we don't have versionless command in time of %check +# With using alternatives, we don't have versionless command in time of %%check Patch0: test_cli_conversion_test.patch BuildRequires: %{python_module capturer >= 2.4} BuildRequires: %{python_module humanfriendly >= 6.1} ++++++ coloredlogs-11.0.tar.gz -> coloredlogs-14.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/CHANGELOG.rst new/coloredlogs-14.0/CHANGELOG.rst --- old/coloredlogs-11.0/CHANGELOG.rst 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/CHANGELOG.rst 2020-02-16 21:50:46.000000000 +0100 @@ -11,6 +11,90 @@ .. _Keep a Changelog: http://keepachangelog.com/ .. _semantic versioning: http://semver.org/ +`Release 14.0`_ (2020-02-16) +---------------------------- + +Integrate native Windows 10 support for ANSI escape sequences (`#71`_, `#72`_). + +Native support for ANSI escape sequences was added to Windows 10 after its +initial release, specifically in release 10.0.14393. I've now updated +:pypi:`coloredlogs` and :pypi:`humanfriendly` to detect and enable this "new" +native support. + +Windows 10 seems to comprise the majority of Windows installations worldwide so +in the interest of "looking forward" I've decided to drop the :pypi:`colorama` +requirement, given that it has now become a minority use case. + +Hopefully most existing users will not experience any regression because they +previously installed :pypi:`colorama` already, and when available it will still +be used. However new installations on older Windows systems now require users +to install :pypi:`colorama` separately. This has been documented in the readme +in an attempt to minimize resulting confusion. + +PS. In case anyone is wondering: I decided that giving a major Windows support +update in :pypi:`coloredlogs` the version 13.0 was asking for trouble, so I +decided not to do that 😇. + +.. _Release 14.0: https://github.com/xolox/python-coloredlogs/compare/12.0...14.0 +.. _#71: https://github.com/xolox/python-coloredlogs/issues/71 +.. _#72: https://github.com/xolox/python-coloredlogs/pull/72 + +`Release 12.0`_ (2020-02-16) +---------------------------- + +Two backwards incompatible changes prompted another major version bump: + +- Merged pull request `#80`_ that drops support for Python 3.4 which + has gone end-of-life and now represents less than 1% of PyPI downloads. + +- Improved compatibility with the Python standard library by changing + the order of positional arguments received by the initializer of the + :class:`~coloredlogs.ColoredFormatter` class (as suggested in `#64`_ + and `#75`_). + +.. _Release 12.0: https://github.com/xolox/python-coloredlogs/compare/11.3...12.0 +.. _#80: https://github.com/xolox/python-coloredlogs/pull/80 +.. _#64: https://github.com/xolox/python-coloredlogs/issues/64 +.. _#75: https://github.com/xolox/python-coloredlogs/issues/75 + +`Release 11.3`_ (2020-02-15) +---------------------------- + +- Add support for the ``%(username)s`` field (requested in `#76`_) and properly + document supported custom fields. + +- Consistently use ``console`` highlighting in documentation. + +- Fix a broken link in the readme. + +.. _Release 11.3: https://github.com/xolox/python-coloredlogs/compare/11.2...11.3 +.. _#76: https://github.com/xolox/python-coloredlogs/issues/76 + +`Release 11.2`_ (2020-02-15) +---------------------------- + +Merge pull request `#79`_ which adds support for Python 3.8. + +.. _Release 11.2: https://github.com/xolox/python-coloredlogs/compare/11.1...11.2 +.. _#79: https://github.com/xolox/python-coloredlogs/pull/79 + +`Release 11.1`_ (2020-02-15) +---------------------------- + +Starting with the previous release I've resolved to try and tackle the large +number of open issues after an unplanned hiatus from the development and +maintenance of my open source projects, so here are some more bug fixes: + +- Fix support for custom log record factories and add a test to avoid + regressions (`#47`_, `#59`_). + +- Change ``make screenshots`` to be Python 3 compatible and document + additional requirements (`#65`_). + +.. _Release 11.1: https://github.com/xolox/python-coloredlogs/compare/11.0...11.1 +.. _#59: https://github.com/xolox/python-coloredlogs/issues/59 +.. _#65: https://github.com/xolox/python-coloredlogs/issues/65 + `Release 11.0`_ (2020-02-14) ---------------------------- @@ -715,7 +799,7 @@ - Vim syntax mode for colored logs! .. _Release 0.2: https://github.com/xolox/python-coloredlogs/compare/0.1...0.2 -.. _verboselogs: https://pypi.python.org/pypi/verboselogs +.. _verboselogs: https://pypi.org/project/verboselogs `Release 0.1`_ (2013-05-16) --------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/PKG-INFO new/coloredlogs-14.0/PKG-INFO --- old/coloredlogs-11.0/PKG-INFO 2020-02-15 00:18:35.000000000 +0100 +++ new/coloredlogs-14.0/PKG-INFO 2020-02-16 21:51:08.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: coloredlogs -Version: 11.0 +Version: 14.0 Summary: Colored terminal output for Python's logging module Home-page: https://coloredlogs.readthedocs.io Author: Peter Odding @@ -19,10 +19,10 @@ module. The ColoredFormatter_ class inherits from `logging.Formatter`_ and uses `ANSI escape sequences`_ to render your logging messages in color. It uses only standard colors so it should work on any UNIX terminal. It's currently tested - on Python 2.7, 3.4, 3.5, 3.6, 3.7 and PyPy. On Windows `coloredlogs` - automatically pulls in Colorama_ as a dependency and enables ANSI escape - sequence translation using Colorama. Here is a screen shot of the demo that is - printed when the command ``coloredlogs --demo`` is executed: + on Python 2.7, 3.5+ and PyPy. On Windows `coloredlogs` automatically tries to + enable native ANSI support (on up-to-date Windows 10 installations) and falls + back on using colorama_ (if installed). Here is a screen shot of the demo that + is printed when the command ``coloredlogs --demo`` is executed: .. image:: https://coloredlogs.readthedocs.io/en/latest/_images/defaults.png @@ -40,7 +40,7 @@ The `coloredlogs` package is available on PyPI_ which means installation should be as simple as: - .. code-block:: sh + .. code-block:: console $ pip install coloredlogs @@ -50,6 +50,18 @@ if this intimidates you then read up on your options before returning to these instructions 😉. + Optional dependencies + ~~~~~~~~~~~~~~~~~~~~~ + + Native ANSI support on Windows requires an up-to-date Windows 10 installation. + If this is not working for you then consider installing the colorama_ package: + + .. code-block:: console + + $ pip install colorama + + Once colorama_ is installed it will be used automatically. + Usage ----- @@ -128,11 +140,24 @@ to the date/time format, it will be replaced by the value of ``%(msecs)03d``. Support for the ``%f`` directive was added to `release 9.3`_ (due to `#45`_). + Custom logging fields + ~~~~~~~~~~~~~~~~~~~~~ + + The following custom log format fields are supported: + + - ``%(hostname)s`` provides the hostname of the local system. + - ``%(programname)s`` provides the name of the currently running program. + - ``%(username)s`` provides the username of the currently logged in user. + + When `coloredlogs.install()`_ detects that any of these fields are used in the + format string the applicable logging.Filter_ subclasses are automatically + registered to populate the relevant log record fields. + Changing text styles and colors ------------------------------- The online documentation contains `an example of customizing the text styles and - colors <https://coloredlogs.readthedocs.io/en/latest/#changing-the-colors-styles>`_. + colors <https://coloredlogs.readthedocs.io/en/latest/api.html#changing-the-colors-styles>`_. Colored output from cron ------------------------ @@ -200,27 +225,28 @@ .. _#16: https://github.com/xolox/python-coloredlogs/issues/16 .. _#45: https://github.com/xolox/python-coloredlogs/issues/45 .. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors - .. _capturer: https://pypi.python.org/pypi/capturer + .. _capturer: https://pypi.org/project/capturer .. _changelog: https://coloredlogs.readthedocs.org/en/latest/changelog.html - .. _Colorama: https://pypi.python.org/pypi/colorama + .. _colorama: https://pypi.org/project/colorama .. _ColoredCronMailer: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.converter.ColoredCronMailer .. _ColoredFormatter: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.ColoredFormatter .. _coloredlogs.install(): https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.install .. _cron: https://en.wikipedia.org/wiki/Cron .. _GitHub: https://github.com/xolox/python-coloredlogs .. _logging.basicConfig(): https://docs.python.org/2/library/logging.html#logging.basicConfig + .. _logging.Filter: https://docs.python.org/3/library/logging.html#filter-objects .. _logging.Formatter: https://docs.python.org/2/library/logging.html#logging.Formatter .. _logging: https://docs.python.org/2/library/logging.html .. _MIT license: https://en.wikipedia.org/wiki/MIT_License .. _online documentation: https://coloredlogs.readthedocs.io/ .. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/ .. [email protected]: [email protected] - .. _PyPI: https://pypi.python.org/pypi/coloredlogs + .. _PyPI: https://pypi.org/project/coloredlogs .. _release 3.0: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-3-0-2015-10-23 .. _release 7.1: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-7-1-2017-07-15 .. _release 9.3: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-9-3-2018-04-29 .. _to include 'msecs': https://stackoverflow.com/questions/6290739/python-logging-use-milliseconds-in-time-format - .. _verboselogs: https://pypi.python.org/pypi/verboselogs + .. _verboselogs: https://pypi.org/project/verboselogs .. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/ Platform: UNKNOWN @@ -238,10 +264,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Communications @@ -257,5 +283,5 @@ Classifier: Topic :: System :: Systems Administration Classifier: Topic :: Terminals Classifier: Topic :: Utilities -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* Provides-Extra: cron diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/README.rst new/coloredlogs-14.0/README.rst --- old/coloredlogs-11.0/README.rst 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/README.rst 2020-02-16 21:50:46.000000000 +0100 @@ -11,10 +11,10 @@ module. The ColoredFormatter_ class inherits from `logging.Formatter`_ and uses `ANSI escape sequences`_ to render your logging messages in color. It uses only standard colors so it should work on any UNIX terminal. It's currently tested -on Python 2.7, 3.4, 3.5, 3.6, 3.7 and PyPy. On Windows `coloredlogs` -automatically pulls in Colorama_ as a dependency and enables ANSI escape -sequence translation using Colorama. Here is a screen shot of the demo that is -printed when the command ``coloredlogs --demo`` is executed: +on Python 2.7, 3.5+ and PyPy. On Windows `coloredlogs` automatically tries to +enable native ANSI support (on up-to-date Windows 10 installations) and falls +back on using colorama_ (if installed). Here is a screen shot of the demo that +is printed when the command ``coloredlogs --demo`` is executed: .. image:: https://coloredlogs.readthedocs.io/en/latest/_images/defaults.png @@ -32,7 +32,7 @@ The `coloredlogs` package is available on PyPI_ which means installation should be as simple as: -.. code-block:: sh +.. code-block:: console $ pip install coloredlogs @@ -42,6 +42,18 @@ if this intimidates you then read up on your options before returning to these instructions 😉. +Optional dependencies +~~~~~~~~~~~~~~~~~~~~~ + +Native ANSI support on Windows requires an up-to-date Windows 10 installation. +If this is not working for you then consider installing the colorama_ package: + +.. code-block:: console + + $ pip install colorama + +Once colorama_ is installed it will be used automatically. + Usage ----- @@ -120,11 +132,24 @@ to the date/time format, it will be replaced by the value of ``%(msecs)03d``. Support for the ``%f`` directive was added to `release 9.3`_ (due to `#45`_). +Custom logging fields +~~~~~~~~~~~~~~~~~~~~~ + +The following custom log format fields are supported: + +- ``%(hostname)s`` provides the hostname of the local system. +- ``%(programname)s`` provides the name of the currently running program. +- ``%(username)s`` provides the username of the currently logged in user. + +When `coloredlogs.install()`_ detects that any of these fields are used in the +format string the applicable logging.Filter_ subclasses are automatically +registered to populate the relevant log record fields. + Changing text styles and colors ------------------------------- The online documentation contains `an example of customizing the text styles and -colors <https://coloredlogs.readthedocs.io/en/latest/#changing-the-colors-styles>`_. +colors <https://coloredlogs.readthedocs.io/en/latest/api.html#changing-the-colors-styles>`_. Colored output from cron ------------------------ @@ -192,25 +217,26 @@ .. _#16: https://github.com/xolox/python-coloredlogs/issues/16 .. _#45: https://github.com/xolox/python-coloredlogs/issues/45 .. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors -.. _capturer: https://pypi.python.org/pypi/capturer +.. _capturer: https://pypi.org/project/capturer .. _changelog: https://coloredlogs.readthedocs.org/en/latest/changelog.html -.. _Colorama: https://pypi.python.org/pypi/colorama +.. _colorama: https://pypi.org/project/colorama .. _ColoredCronMailer: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.converter.ColoredCronMailer .. _ColoredFormatter: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.ColoredFormatter .. _coloredlogs.install(): https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.install .. _cron: https://en.wikipedia.org/wiki/Cron .. _GitHub: https://github.com/xolox/python-coloredlogs .. _logging.basicConfig(): https://docs.python.org/2/library/logging.html#logging.basicConfig +.. _logging.Filter: https://docs.python.org/3/library/logging.html#filter-objects .. _logging.Formatter: https://docs.python.org/2/library/logging.html#logging.Formatter .. _logging: https://docs.python.org/2/library/logging.html .. _MIT license: https://en.wikipedia.org/wiki/MIT_License .. _online documentation: https://coloredlogs.readthedocs.io/ .. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/ .. [email protected]: [email protected] -.. _PyPI: https://pypi.python.org/pypi/coloredlogs +.. _PyPI: https://pypi.org/project/coloredlogs .. _release 3.0: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-3-0-2015-10-23 .. _release 7.1: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-7-1-2017-07-15 .. _release 9.3: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-9-3-2018-04-29 .. _to include 'msecs': https://stackoverflow.com/questions/6290739/python-logging-use-milliseconds-in-time-format -.. _verboselogs: https://pypi.python.org/pypi/verboselogs +.. _verboselogs: https://pypi.org/project/verboselogs .. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/coloredlogs/__init__.py new/coloredlogs-14.0/coloredlogs/__init__.py --- old/coloredlogs-11.0/coloredlogs/__init__.py 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/coloredlogs/__init__.py 2020-02-16 21:50:46.000000000 +0100 @@ -1,7 +1,7 @@ # Colored terminal output for Python's logging module. # # Author: Peter Odding <[email protected]> -# Last Change: February 14, 2020 +# Last Change: February 16, 2020 # URL: https://coloredlogs.readthedocs.io """ @@ -90,7 +90,7 @@ The simplest customization is to change the log format, for example: .. literalinclude:: examples/custom-log-format.txt - :language: sh + :language: console Here's what that looks like in a terminal (I always work in terminals with a black background and white text): @@ -105,7 +105,7 @@ part and leave only the time: .. literalinclude:: examples/custom-datetime-format.txt - :language: sh + :language: console Here's what it looks like in a terminal: @@ -118,7 +118,7 @@ Finally you can customize the colors and text styles that are used: .. literalinclude:: examples/custom-colors.txt - :language: sh + :language: console Here's an explanation of the features used here: @@ -202,18 +202,12 @@ # External dependencies. from humanfriendly import coerce_boolean -from humanfriendly.compat import coerce_string, is_string -from humanfriendly.terminal import ANSI_COLOR_CODES, ansi_wrap, terminal_supports_colors +from humanfriendly.compat import coerce_string, is_string, on_windows +from humanfriendly.terminal import ANSI_COLOR_CODES, ansi_wrap, enable_ansi_support, terminal_supports_colors from humanfriendly.text import format, split -# Windows requires special handling and the first step is detecting it :-). -WINDOWS = sys.platform.startswith('win') - -# Optional external dependency (only needed on Windows). -NEED_COLORAMA = WINDOWS - # Semi-standard module versioning. -__version__ = '11.0' +__version__ = '14.0' DEFAULT_LOG_LEVEL = logging.INFO """The default log level for :mod:`coloredlogs` (:data:`logging.INFO`).""" @@ -227,21 +221,14 @@ CHROOT_FILES = ['/etc/debian_chroot'] """A list of filenames that indicate a chroot and contain the name of the chroot.""" -CAN_USE_BOLD_FONT = (not NEED_COLORAMA) -""" -Whether bold fonts can be used in default styles (a boolean). - -This is disabled on Windows because in my (admittedly limited) experience the -ANSI escape sequence for bold font is simply not translated by Colorama, -instead it's printed to the terminal without any translation. -""" - DEFAULT_FIELD_STYLES = dict( asctime=dict(color='green'), hostname=dict(color='magenta'), - levelname=dict(color='black', bold=CAN_USE_BOLD_FONT), + levelname=dict(color='black', bold=True), + name=dict(color='blue'), programname=dict(color='cyan'), - name=dict(color='blue')) + username=dict(color='yellow'), +) """Mapping of log format names to default font styles.""" DEFAULT_LEVEL_STYLES = dict( @@ -251,9 +238,10 @@ info=dict(), notice=dict(color='magenta'), warning=dict(color='yellow'), - success=dict(color='green', bold=CAN_USE_BOLD_FONT), + success=dict(color='green', bold=True), error=dict(color='red'), - critical=dict(color='red', bold=CAN_USE_BOLD_FONT)) + critical=dict(color='red', bold=True), +) """Mapping of log level names to default font styles.""" DEFAULT_FORMAT_STYLE = '%' @@ -351,6 +339,7 @@ the previous configuration. :param use_chroot: Refer to :class:`HostNameFilter`. :param programname: Refer to :class:`ProgramNameFilter`. + :param username: Refer to :class:`UserNameFilter`. :param syslog: If :data:`True` then :func:`.enable_system_logging()` will be called without arguments (defaults to :data:`False`). The `syslog` argument may also be a number or string, in this @@ -381,8 +370,9 @@ with the `fmt` and `datefmt` keyword arguments (or their computed defaults). - 4. :func:`HostNameFilter.install()` and :func:`ProgramNameFilter.install()` - are called to enable the use of additional fields in the log format. + 4. :func:`HostNameFilter.install()`, :func:`ProgramNameFilter.install()` + and :func:`UserNameFilter.install()` are called to enable the use of + additional fields in the log format. 5. If the logger's level is too restrictive it is relaxed (refer to `notes about log levels`_ for details). @@ -423,7 +413,7 @@ # that SysLogHandler isn't intended to be used on Windows; I've had # reports of coloredlogs spewing extremely verbose errno 10057 warning # messages to the console (once for each log message I suppose). - if syslog_enabled not in (None, False) and not WINDOWS: + if syslog_enabled not in (None, False) and not on_windows(): from coloredlogs.syslog import enable_system_logging if syslog_enabled is True: # If the caller passed syslog=True then we leave the choice of @@ -436,19 +426,11 @@ # Figure out whether we can use ANSI escape sequences. use_colors = kw.get('isatty', None) if use_colors or use_colors is None: - if NEED_COLORAMA: - try: - # On Windows we can only use ANSI escape - # sequences if Colorama is available. - import colorama - colorama.init() - use_colors = True - except ImportError: - # If Colorama isn't available then we specifically - # shouldn't emit ANSI escape sequences! - use_colors = False - elif use_colors is None: - # Auto-detect terminal support on other platforms. + # Try to enable Windows native ANSI support or Colorama. + if on_windows(): + use_colors = enable_ansi_support() + # Disable ANSI escape sequences if 'stream' isn't connected to a terminal. + if use_colors or use_colors is None: use_colors = terminal_supports_colors(stream) # Create a stream handler. handler = logging.StreamHandler(stream) if stream else StandardErrorHandler() @@ -505,6 +487,13 @@ programname=kw.get('programname'), style=style, ) + # Do we need to make %(username) available to the formatter? + UserNameFilter.install( + fmt=formatter_options['fmt'], + handler=handler, + username=kw.get('username'), + style=style, + ) # Inject additional formatter arguments specific to ColoredFormatter? if use_colors: for name, environment_name in (('field_styles', 'COLOREDLOGS_FIELD_STYLES'), @@ -805,6 +794,26 @@ or 'python') +def find_username(): + """ + Find the username to include in log messages. + + :returns: A suitable username (a string). + + On UNIX systems this uses the :mod:`pwd` module which means ``root`` will + be reported when :man:`sudo` is used (as it should). If this fails (for + example on Windows) then :func:`getpass.getuser()` is used as a fall back. + """ + try: + import pwd + uid = os.getuid() + entry = pwd.getpwuid(uid) + return entry.pw_name + except Exception: + import getpass + return getpass.getuser() + + def replace_handler(logger, match_handler, reconfigure): """ Prepare to replace a handler. @@ -956,11 +965,11 @@ the use of ``%f`` for millisecond formatting in date/time strings. .. note:: If you want to use :class:`ColoredFormatter` on Windows then you - may need to call :func:`colorama.init()`. This is done for you - when you call :func:`coloredlogs.install()`. + need to call :func:`~humanfriendly.terminal.enable_ansi_support()`. + This is done for you when you call :func:`coloredlogs.install()`. """ - def __init__(self, fmt=None, datefmt=None, level_styles=None, field_styles=None, style=DEFAULT_FORMAT_STYLE): + def __init__(self, fmt=None, datefmt=None, style=DEFAULT_FORMAT_STYLE, level_styles=None, field_styles=None): """ Initialize a :class:`ColoredFormatter` object. @@ -981,10 +990,6 @@ initializer of the base class. """ self.nn = NameNormalizer() - # The use of the logging.getLogRecordFactory() is preferable over - # logging.LogRecord in Python 3, but this function isn't available in - # Python 2. We'll check the existence of the function just once now. - self.log_record_factory = getattr(logging, 'getLogRecordFactory', None) # The default values of the following arguments are defined here so # that Sphinx doesn't embed the default values in the generated # documentation (because the result is awkward to read). @@ -1102,11 +1107,7 @@ # For more details refer to issue 29 on GitHub: # https://github.com/xolox/python-coloredlogs/issues/29 copy = Empty() - copy.__class__ = ( - self.log_record_factory() - if self.log_record_factory is not None - else logging.LogRecord - ) + copy.__class__ = record.__class__ copy.__dict__.update(record.__dict__) copy.msg = ansi_wrap(coerce_string(record.msg), **style) record = copy @@ -1236,6 +1237,60 @@ return 1 +class UserNameFilter(logging.Filter): + + """ + Log filter to enable the ``%(username)s`` format. + + Python's :mod:`logging` module doesn't expose the username of the currently + logged in user as requested in `#76`_. Given that :class:`HostNameFilter` + and :class:`ProgramNameFilter` are already provided by `coloredlogs` it + made sense to provide :class:`UserNameFilter` as well. + + Refer to :class:`HostNameFilter` for an example of how to manually install + these log filters. + + .. _#76: https://github.com/xolox/python-coloredlogs/issues/76 + """ + + @classmethod + def install(cls, handler, fmt, username=None, style=DEFAULT_FORMAT_STYLE): + """ + Install the :class:`UserNameFilter` (only if needed). + + :param fmt: The log format string to check for ``%(username)``. + :param style: One of the characters ``%``, ``{`` or ``$`` (defaults to + :data:`DEFAULT_FORMAT_STYLE`). + :param handler: The logging handler on which to install the filter. + :param username: Refer to :func:`__init__()`. + + If `fmt` is given the filter will only be installed if `fmt` uses the + ``username`` field. If `fmt` is not given the filter is installed + unconditionally. + """ + if fmt: + parser = FormatStringParser(style=style) + if not parser.contains_field(fmt, 'username'): + return + handler.addFilter(cls(username)) + + def __init__(self, username=None): + """ + Initialize a :class:`UserNameFilter` object. + + :param username: The username to use (defaults to the + result of :func:`find_username()`). + """ + self.username = username or find_username() + + def filter(self, record): + """Set each :class:`~logging.LogRecord`'s `username` field.""" + # Modify the record. + record.username = self.username + # Don't filter the record. + return 1 + + class StandardErrorHandler(logging.StreamHandler): """ @@ -1244,9 +1299,9 @@ The :class:`StandardErrorHandler` class enables `monkey patching of sys.stderr <https://github.com/xolox/python-coloredlogs/pull/31>`_. It's basically the same as the ``logging._StderrHandler`` class present in - Python 3 but it will available regardless of Python version. This handler - is used by :func:`coloredlogs.install()` to improve compatibility with the - Python standard library. + Python 3 but it will be available regardless of Python version. This + handler is used by :func:`coloredlogs.install()` to improve compatibility + with the Python standard library. """ def __init__(self, level=logging.NOTSET): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/coloredlogs/tests.py new/coloredlogs-14.0/coloredlogs/tests.py --- old/coloredlogs-11.0/coloredlogs/tests.py 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/coloredlogs/tests.py 2020-02-16 21:50:46.000000000 +0100 @@ -1,14 +1,13 @@ # Automated tests for the `coloredlogs' package. # # Author: Peter Odding <[email protected]> -# Last Change: February 14, 2020 +# Last Change: February 16, 2020 # URL: https://coloredlogs.readthedocs.io """Automated tests for the `coloredlogs` package.""" # Standard library modules. import contextlib -import imp import logging import logging.handlers import os @@ -20,9 +19,8 @@ # External dependencies. from humanfriendly.compat import StringIO from humanfriendly.terminal import ANSI_COLOR_CODES, ansi_style, ansi_wrap -from humanfriendly.testing import PatchedItem, TestCase, retry +from humanfriendly.testing import PatchedAttribute, PatchedItem, TestCase, retry from humanfriendly.text import format, random_string -from mock import MagicMock # The module we're testing. import coloredlogs @@ -36,6 +34,7 @@ find_handler, find_hostname, find_program_name, + find_username, get_level, increase_verbosity, install, @@ -46,6 +45,7 @@ set_level, walk_propagation_tree, ) +from coloredlogs.demo import demonstrate_colored_logging from coloredlogs.syslog import SystemLogging, match_syslog_handler from coloredlogs.converter import ( ColoredCronMailer, @@ -159,30 +159,13 @@ output = capturer.get_text() assert find_program_name() in output - def test_colorama_enabled(self): - """Test that colorama is enabled (through mocking).""" - init_function = MagicMock() - with mocked_colorama_module(init_function): - # Configure logging to the terminal. - coloredlogs.install() - # Ensure that our mock method was called. - assert init_function.called - - def test_colorama_missing(self): - """Test that colorama is missing (through mocking).""" - def init_function(): - raise ImportError - with mocked_colorama_module(init_function): - # Configure logging to the terminal. It is expected that internally - # an ImportError is raised, but the exception is caught and colored - # output is disabled. - coloredlogs.install() - # Find the handler that was created by coloredlogs.install(). - handler, logger = find_handler(logging.getLogger(), match_stream_handler) - # Make sure that logging to the terminal was initialized. - assert isinstance(handler.formatter, logging.Formatter) - # Make sure colored logging is disabled. - assert not isinstance(handler.formatter, ColoredFormatter) + def test_username_filter(self): + """Make sure :func:`install()` integrates with :class:`~coloredlogs.UserNameFilter()`.""" + install(fmt='%(username)s') + with CaptureOutput() as capturer: + logging.info("A truly insignificant message ..") + output = capturer.get_text() + assert find_username() in output def test_system_logging(self): """Make sure the :class:`coloredlogs.syslog.SystemLogging` context manager works.""" @@ -415,42 +398,42 @@ '<code>plain text followed by <span style="color:{css}">{name}</span> text</code>', css=EIGHT_COLOR_PALETTE[ansi_code], name=color_name, ) - self.assertEquals(expected_html, convert(ansi_encoded_text)) + self.assertEqual(expected_html, convert(ansi_encoded_text)) # Check conversion of bright colored text. expected_html = '<code><span style="color:#FF0">bright yellow</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('bright yellow', color='yellow', bright=True))) + self.assertEqual(expected_html, convert(ansi_wrap('bright yellow', color='yellow', bright=True))) # Check conversion of text with a background color. expected_html = '<code><span style="background-color:#DE382B">red background</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('red background', background='red'))) + self.assertEqual(expected_html, convert(ansi_wrap('red background', background='red'))) # Check conversion of text with a bright background color. expected_html = '<code><span style="background-color:#F00">bright red background</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('bright red background', background='red', bright=True))) + self.assertEqual(expected_html, convert(ansi_wrap('bright red background', background='red', bright=True))) # Check conversion of text that uses the 256 color mode palette as a foreground color. expected_html = '<code><span style="color:#FFAF00">256 color mode foreground</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('256 color mode foreground', color=214))) + self.assertEqual(expected_html, convert(ansi_wrap('256 color mode foreground', color=214))) # Check conversion of text that uses the 256 color mode palette as a background color. expected_html = '<code><span style="background-color:#AF0000">256 color mode background</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('256 color mode background', background=124))) + self.assertEqual(expected_html, convert(ansi_wrap('256 color mode background', background=124))) # Check that invalid 256 color mode indexes don't raise exceptions. expected_html = '<code>plain text expected</code>' - self.assertEquals(expected_html, convert('\x1b[38;5;256mplain text expected\x1b[0m')) + self.assertEqual(expected_html, convert('\x1b[38;5;256mplain text expected\x1b[0m')) # Check conversion of bold text. expected_html = '<code><span style="font-weight:bold">bold text</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('bold text', bold=True))) + self.assertEqual(expected_html, convert(ansi_wrap('bold text', bold=True))) # Check conversion of underlined text. expected_html = '<code><span style="text-decoration:underline">underlined text</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('underlined text', underline=True))) + self.assertEqual(expected_html, convert(ansi_wrap('underlined text', underline=True))) # Check conversion of strike-through text. expected_html = '<code><span style="text-decoration:line-through">strike-through text</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('strike-through text', strike_through=True))) + self.assertEqual(expected_html, convert(ansi_wrap('strike-through text', strike_through=True))) # Check conversion of inverse text. expected_html = '<code><span style="background-color:#FFC706;color:#000">inverse</span></code>' - self.assertEquals(expected_html, convert(ansi_wrap('inverse', color='yellow', inverse=True))) + self.assertEqual(expected_html, convert(ansi_wrap('inverse', color='yellow', inverse=True))) # Check conversion of URLs. for sample_text in 'www.python.org', 'http://coloredlogs.rtfd.org', 'https://coloredlogs.rtfd.org': sample_url = sample_text if '://' in sample_text else ('http://' + sample_text) expected_html = '<code><a href="%s" style="color:inherit">%s</a></code>' % (sample_url, sample_text) - self.assertEquals(expected_html, convert(sample_text)) + self.assertEqual(expected_html, convert(sample_text)) # Check that the capture pattern for URLs doesn't match ANSI escape # sequences and also check that the short hand for the 0 reset code is # supported. These are tests for regressions of bugs found in @@ -464,7 +447,7 @@ 'https://coloredlogs.readthedocs.io' '</a></span>></code>' ) - self.assertEquals(expected_html, convert(ansi_encoded_text)) + self.assertEqual(expected_html, convert(ansi_encoded_text)) def test_output_interception(self): """Test capturing of output from external commands.""" @@ -538,6 +521,44 @@ """Test that the usage message is shown when ``--help`` is given.""" assert 'Usage:' in main('coloredlogs', '--help', capture=True) + def test_custom_record_factory(self): + """ + Test that custom LogRecord factories are supported. + + This test is a bit convoluted because the logging module suppresses + exceptions. We monkey patch the method suspected of encountering + exceptions so that we can tell after it was called whether any + exceptions occurred (despite the exceptions not propagating). + """ + if not hasattr(logging, 'getLogRecordFactory'): + return self.skipTest("this test requires Python >= 3.2") + + exceptions = [] + original_method = ColoredFormatter.format + original_factory = logging.getLogRecordFactory() + + def custom_factory(*args, **kwargs): + record = original_factory(*args, **kwargs) + record.custom_attribute = 0xdecafbad + return record + + def custom_method(*args, **kw): + try: + return original_method(*args, **kw) + except Exception as e: + exceptions.append(e) + raise + + with PatchedAttribute(ColoredFormatter, 'format', custom_method): + logging.setLogRecordFactory(custom_factory) + try: + demonstrate_colored_logging() + finally: + logging.setLogRecordFactory(original_factory) + + # Ensure that no exceptions were triggered. + assert not exceptions + def check_contents(filename, contents, match): """Check if a line in a file contains an expected string.""" @@ -563,30 +584,6 @@ @contextlib.contextmanager -def mocked_colorama_module(init_function): - """Context manager to ease testing of colorama integration.""" - module_name = 'colorama' - # Create a fake module shadowing colorama. - fake_module = imp.new_module(module_name) - setattr(fake_module, 'init', init_function) - # Temporarily reconfigure coloredlogs to use colorama. - need_colorama = coloredlogs.NEED_COLORAMA - coloredlogs.NEED_COLORAMA = True - # Install the fake colorama module. - saved_module = sys.modules.get(module_name, None) - sys.modules[module_name] = fake_module - # We've finished setting up, yield control. - yield - # Restore the original setting. - coloredlogs.NEED_COLORAMA = need_colorama - # Clean up the mock module. - if saved_module is not None: - sys.modules[module_name] = saved_module - else: - sys.modules.pop(module_name, None) - - [email protected] def cleanup_handlers(): """Context manager to cleanup output handlers.""" # There's nothing to set up so we immediately yield control. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/coloredlogs.egg-info/PKG-INFO new/coloredlogs-14.0/coloredlogs.egg-info/PKG-INFO --- old/coloredlogs-11.0/coloredlogs.egg-info/PKG-INFO 2020-02-15 00:18:35.000000000 +0100 +++ new/coloredlogs-14.0/coloredlogs.egg-info/PKG-INFO 2020-02-16 21:51:08.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: coloredlogs -Version: 11.0 +Version: 14.0 Summary: Colored terminal output for Python's logging module Home-page: https://coloredlogs.readthedocs.io Author: Peter Odding @@ -19,10 +19,10 @@ module. The ColoredFormatter_ class inherits from `logging.Formatter`_ and uses `ANSI escape sequences`_ to render your logging messages in color. It uses only standard colors so it should work on any UNIX terminal. It's currently tested - on Python 2.7, 3.4, 3.5, 3.6, 3.7 and PyPy. On Windows `coloredlogs` - automatically pulls in Colorama_ as a dependency and enables ANSI escape - sequence translation using Colorama. Here is a screen shot of the demo that is - printed when the command ``coloredlogs --demo`` is executed: + on Python 2.7, 3.5+ and PyPy. On Windows `coloredlogs` automatically tries to + enable native ANSI support (on up-to-date Windows 10 installations) and falls + back on using colorama_ (if installed). Here is a screen shot of the demo that + is printed when the command ``coloredlogs --demo`` is executed: .. image:: https://coloredlogs.readthedocs.io/en/latest/_images/defaults.png @@ -40,7 +40,7 @@ The `coloredlogs` package is available on PyPI_ which means installation should be as simple as: - .. code-block:: sh + .. code-block:: console $ pip install coloredlogs @@ -50,6 +50,18 @@ if this intimidates you then read up on your options before returning to these instructions 😉. + Optional dependencies + ~~~~~~~~~~~~~~~~~~~~~ + + Native ANSI support on Windows requires an up-to-date Windows 10 installation. + If this is not working for you then consider installing the colorama_ package: + + .. code-block:: console + + $ pip install colorama + + Once colorama_ is installed it will be used automatically. + Usage ----- @@ -128,11 +140,24 @@ to the date/time format, it will be replaced by the value of ``%(msecs)03d``. Support for the ``%f`` directive was added to `release 9.3`_ (due to `#45`_). + Custom logging fields + ~~~~~~~~~~~~~~~~~~~~~ + + The following custom log format fields are supported: + + - ``%(hostname)s`` provides the hostname of the local system. + - ``%(programname)s`` provides the name of the currently running program. + - ``%(username)s`` provides the username of the currently logged in user. + + When `coloredlogs.install()`_ detects that any of these fields are used in the + format string the applicable logging.Filter_ subclasses are automatically + registered to populate the relevant log record fields. + Changing text styles and colors ------------------------------- The online documentation contains `an example of customizing the text styles and - colors <https://coloredlogs.readthedocs.io/en/latest/#changing-the-colors-styles>`_. + colors <https://coloredlogs.readthedocs.io/en/latest/api.html#changing-the-colors-styles>`_. Colored output from cron ------------------------ @@ -200,27 +225,28 @@ .. _#16: https://github.com/xolox/python-coloredlogs/issues/16 .. _#45: https://github.com/xolox/python-coloredlogs/issues/45 .. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors - .. _capturer: https://pypi.python.org/pypi/capturer + .. _capturer: https://pypi.org/project/capturer .. _changelog: https://coloredlogs.readthedocs.org/en/latest/changelog.html - .. _Colorama: https://pypi.python.org/pypi/colorama + .. _colorama: https://pypi.org/project/colorama .. _ColoredCronMailer: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.converter.ColoredCronMailer .. _ColoredFormatter: https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.ColoredFormatter .. _coloredlogs.install(): https://coloredlogs.readthedocs.io/en/latest/api.html#coloredlogs.install .. _cron: https://en.wikipedia.org/wiki/Cron .. _GitHub: https://github.com/xolox/python-coloredlogs .. _logging.basicConfig(): https://docs.python.org/2/library/logging.html#logging.basicConfig + .. _logging.Filter: https://docs.python.org/3/library/logging.html#filter-objects .. _logging.Formatter: https://docs.python.org/2/library/logging.html#logging.Formatter .. _logging: https://docs.python.org/2/library/logging.html .. _MIT license: https://en.wikipedia.org/wiki/MIT_License .. _online documentation: https://coloredlogs.readthedocs.io/ .. _per user site-packages directory: https://www.python.org/dev/peps/pep-0370/ .. [email protected]: [email protected] - .. _PyPI: https://pypi.python.org/pypi/coloredlogs + .. _PyPI: https://pypi.org/project/coloredlogs .. _release 3.0: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-3-0-2015-10-23 .. _release 7.1: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-7-1-2017-07-15 .. _release 9.3: https://coloredlogs.readthedocs.io/en/latest/changelog.html#release-9-3-2018-04-29 .. _to include 'msecs': https://stackoverflow.com/questions/6290739/python-logging-use-milliseconds-in-time-format - .. _verboselogs: https://pypi.python.org/pypi/verboselogs + .. _verboselogs: https://pypi.org/project/verboselogs .. _virtual environments: http://docs.python-guide.org/en/latest/dev/virtualenvs/ Platform: UNKNOWN @@ -238,10 +264,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Communications @@ -257,5 +283,5 @@ Classifier: Topic :: System :: Systems Administration Classifier: Topic :: Terminals Classifier: Topic :: Utilities -Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* Provides-Extra: cron diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/coloredlogs.egg-info/SOURCES.txt new/coloredlogs-14.0/coloredlogs.egg-info/SOURCES.txt --- old/coloredlogs-11.0/coloredlogs.egg-info/SOURCES.txt 2020-02-15 00:18:35.000000000 +0100 +++ new/coloredlogs-14.0/coloredlogs.egg-info/SOURCES.txt 2020-02-16 21:51:08.000000000 +0100 @@ -4,6 +4,7 @@ README.rst coloredlogs.pth requirements-checks.txt +requirements-screenshots.txt requirements-tests.txt requirements-travis.txt requirements.txt diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/coloredlogs.egg-info/requires.txt new/coloredlogs-14.0/coloredlogs.egg-info/requires.txt --- old/coloredlogs-11.0/coloredlogs.egg-info/requires.txt 2020-02-15 00:18:35.000000000 +0100 +++ new/coloredlogs-14.0/coloredlogs.egg-info/requires.txt 2020-02-16 21:51:08.000000000 +0100 @@ -1,7 +1,4 @@ -humanfriendly>=6.1 - -[:sys_platform == "win32"] -colorama +humanfriendly>=7.1 [cron] capturer>=2.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/requirements-screenshots.txt new/coloredlogs-14.0/requirements-screenshots.txt --- old/coloredlogs-11.0/requirements-screenshots.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/coloredlogs-14.0/requirements-screenshots.txt 2020-02-15 17:13:20.000000000 +0100 @@ -0,0 +1,2 @@ +capturer >= 2.4 +executor >= 21.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/requirements-tests.txt new/coloredlogs-14.0/requirements-tests.txt --- old/coloredlogs-11.0/requirements-tests.txt 2018-01-05 03:28:20.000000000 +0100 +++ new/coloredlogs-14.0/requirements-tests.txt 2020-02-16 21:50:46.000000000 +0100 @@ -1,6 +1,5 @@ capturer >= 2.4 coverage >= 4.2 -mock >= 1.0.1 pytest >= 3.0.3 pytest-cov >= 2.3.1 verboselogs >= 1.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/requirements.txt new/coloredlogs-14.0/requirements.txt --- old/coloredlogs-11.0/requirements.txt 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/requirements.txt 2020-02-16 21:50:46.000000000 +0100 @@ -1 +1 @@ -humanfriendly >= 6.1 +humanfriendly >= 7.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/coloredlogs-11.0/setup.py new/coloredlogs-14.0/setup.py --- old/coloredlogs-11.0/setup.py 2020-02-15 00:18:02.000000000 +0100 +++ new/coloredlogs-14.0/setup.py 2020-02-16 21:50:46.000000000 +0100 @@ -3,7 +3,7 @@ # Setup script for the `coloredlogs' package. # # Author: Peter Odding <[email protected]> -# Last Change: February 14, 2020 +# Last Change: February 16, 2020 # URL: https://coloredlogs.readthedocs.io """ @@ -43,24 +43,6 @@ return metadata['version'] -def get_install_requires(): - """Add conditional dependencies for Windows (when creating source distributions).""" - install_requires = get_requirements('requirements.txt') - if 'bdist_wheel' not in sys.argv: - if sys.platform == 'win32': - install_requires.append('colorama') - return sorted(install_requires) - - -def get_extras_require(): - """Add conditional dependencies for Windows (when creating wheel distributions).""" - extras_require = dict(cron='capturer>=2.4') - if have_environment_marker_support(): - expression = ':sys_platform == "win32"' - extras_require[expression] = 'colorama' - return extras_require - - def get_requirements(*args): """Get requirements from pip requirement files.""" requirements = set() @@ -79,21 +61,6 @@ return os.path.join(os.path.dirname(os.path.abspath(__file__)), *args) -def have_environment_marker_support(): - """ - Check whether setuptools has support for PEP-426 environment marker support. - - Based on the ``setup.py`` script of the ``pytest`` package: - https://bitbucket.org/pytest-dev/pytest/src/default/setup.py - """ - try: - from pkg_resources import parse_version - from setuptools import __version__ - return parse_version(__version__) >= parse_version('0.7.2') - except Exception: - return False - - def find_pth_directory(): """ Determine the correct directory pathname for installing ``*.pth`` files. @@ -133,10 +100,10 @@ 'coloredlogs = coloredlogs.cli:main', ]), test_suite='coloredlogs.tests', - install_requires=get_install_requires(), - extras_require=get_extras_require(), + install_requires=get_requirements('requirements.txt'), + extras_require=dict(cron='capturer>=2.4'), tests_require=get_requirements('requirements-tests.txt'), - python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -152,10 +119,10 @@ '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 :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Communications',
