Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-knack for openSUSE:Factory 
checked in at 2022-08-22 11:05:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-knack (Old)
 and      /work/SRC/openSUSE:Factory/.python-knack.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-knack"

Mon Aug 22 11:05:02 2022 rev:19 rq:998562 version:0.10.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-knack/python-knack.changes        
2022-03-28 17:01:56.245081552 +0200
+++ /work/SRC/openSUSE:Factory/.python-knack.new.2083/python-knack.changes      
2022-08-22 11:05:08.225702148 +0200
@@ -1,0 +2,8 @@
+Sat Aug 20 08:15:46 UTC 2022 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- Update to version 0.10.0
+  * Enable Virtual Terminal mode on legacy Windows terminal
+    to support ANSI escape sequences (#265)
+  * Drop Python 3.6 support (#259)
+
+-------------------------------------------------------------------

Old:
----
  knack-0.9.0.tar.gz

New:
----
  knack-0.10.0.tar.gz

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

Other differences:
------------------
++++++ python-knack.spec ++++++
--- /var/tmp/diff_new_pack.hod13r/_old  2022-08-22 11:05:08.861703540 +0200
+++ /var/tmp/diff_new_pack.hod13r/_new  2022-08-22 11:05:08.865703548 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-knack
-Version:        0.9.0
+Version:        0.10.0
 Release:        0
 Summary:        A Command-Line Interface framework
 License:        MIT

++++++ knack-0.9.0.tar.gz -> knack-0.10.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/HISTORY.rst new/knack-0.10.0/HISTORY.rst
--- old/knack-0.9.0/HISTORY.rst 2021-11-05 06:18:23.000000000 +0100
+++ new/knack-0.10.0/HISTORY.rst        2022-08-19 07:55:35.000000000 +0200
@@ -3,6 +3,17 @@
 Release History
 ===============
 
+0.10.0
+++++++
+
+* Enable Virtual Terminal mode on legacy Windows terminal to support ANSI 
escape sequences (#265)
+* Drop Python 3.6 support (#259)
+
+0.9.1
++++++
+
+* Use proper PEP 508 environment marker to install colorama on Windows only 
(#257)
+
 0.9.0
 +++++
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/PKG-INFO new/knack-0.10.0/PKG-INFO
--- old/knack-0.9.0/PKG-INFO    2021-11-05 06:18:29.853407900 +0100
+++ new/knack-0.10.0/PKG-INFO   2022-08-19 07:55:52.571604300 +0200
@@ -1,18 +1,16 @@
 Metadata-Version: 2.1
 Name: knack
-Version: 0.9.0
+Version: 0.10.0
 Summary: A Command-Line Interface framework
 Home-page: https://github.com/microsoft/knack
 Author: Microsoft Corporation
 Author-email: azpy...@microsoft.com
 License: MIT
-Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: System Administrators
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
@@ -170,5 +168,3 @@
 =======
 
 Knack is licensed under `MIT <LICENSE>`__.
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/knack/_win_vt.py 
new/knack-0.10.0/knack/_win_vt.py
--- old/knack-0.9.0/knack/_win_vt.py    1970-01-01 01:00:00.000000000 +0100
+++ new/knack-0.10.0/knack/_win_vt.py   2022-08-19 07:55:35.000000000 +0200
@@ -0,0 +1,77 @@
+# 
--------------------------------------------------------------------------------------------
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License. See License.txt in the project root for 
license information.
+# 
--------------------------------------------------------------------------------------------
+
+"""
+Enable Virtual Terminal mode on legacy Windows terminal to support ANSI escape 
sequences.
+Migrated from https://github.com/Azure/azure-cli/pull/12942
+"""
+
+from ctypes import WinDLL, get_last_error, byref
+from ctypes.wintypes import HANDLE, LPDWORD, DWORD
+from msvcrt import get_osfhandle  # pylint: disable=import-error
+from knack.log import get_logger
+
+logger = get_logger(__name__)
+
+ERROR_INVALID_PARAMETER = 0x0057
+ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
+
+
+def _check_zero(result, _, args):
+    if not result:
+        raise OSError(get_last_error())
+    return args
+
+
+# See:
+# - https://docs.microsoft.com/en-us/windows/console/getconsolemode
+# - https://docs.microsoft.com/en-us/windows/console/setconsolemode
+kernel32 = WinDLL("kernel32", use_last_error=True)
+kernel32.GetConsoleMode.errcheck = _check_zero
+kernel32.GetConsoleMode.argtypes = (HANDLE, LPDWORD)
+kernel32.SetConsoleMode.errcheck = _check_zero
+kernel32.SetConsoleMode.argtypes = (HANDLE, DWORD)
+
+
+def _get_conout_mode():
+    with open("CONOUT$", "w") as conout:  # pylint: 
disable=unspecified-encoding
+        mode = DWORD()
+        conout_handle = get_osfhandle(conout.fileno())
+        kernel32.GetConsoleMode(conout_handle, byref(mode))
+        return mode.value
+
+
+def _set_conout_mode(mode):
+    with open("CONOUT$", "w") as conout:  # pylint: 
disable=unspecified-encoding
+        conout_handle = get_osfhandle(conout.fileno())
+        kernel32.SetConsoleMode(conout_handle, mode)
+
+
+def _update_conout_mode(mode):
+    old_mode = _get_conout_mode()
+    if old_mode & mode != mode:
+        mode = old_mode | mode  # pylint: disable=unsupported-binary-operation
+        _set_conout_mode(mode)
+
+
+def enable_vt_mode():
+    """Enables virtual terminal mode for Windows 10 console.
+
+    Windows 10 supports VT (virtual terminal) / ANSI escape sequences since 
version 1607.
+
+    cmd.exe enables VT mode, but only for itself. It disables VT mode before 
starting other programs,
+    and also at shutdown (See: https://bugs.python.org/issue30075).
+
+    Return True if success, else False.
+    """
+    try:
+        _update_conout_mode(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+        return True
+    except OSError as e:
+        if e.errno == ERROR_INVALID_PARAMETER:
+            logger.debug("Unable to enable virtual terminal processing for 
legacy Windows terminal.")
+        else:
+            logger.debug("Unable to enable virtual terminal processing: %s.", 
e.errno)
+        return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/knack/cli.py 
new/knack-0.10.0/knack/cli.py
--- old/knack-0.9.0/knack/cli.py        2021-11-05 06:18:23.000000000 +0100
+++ new/knack-0.10.0/knack/cli.py       2022-08-19 07:55:35.000000000 +0200
@@ -97,8 +97,8 @@
 
         self.only_show_errors = self.config.getboolean('core', 
'only_show_errors', fallback=False)
         self.enable_color = self._should_enable_color()
-        # Init colorama only in Windows legacy terminal
-        self._should_init_colorama = self.enable_color and sys.platform == 
'win32' and not is_modern_terminal()
+        # Enable VT mode only in Windows legacy terminal
+        self._should_enable_vt_mode = self.enable_color and sys.platform == 
'win32' and not is_modern_terminal()
 
     @staticmethod
     def _should_show_version(args):
@@ -205,12 +205,14 @@
         exit_code = 0
         try:
             out_file = out_file or self.out_file
-            if out_file is sys.stdout and self._should_init_colorama:
-                self.init_debug_log.append("Init colorama.")
-                import colorama
-                colorama.init()
-                # point out_file to the new sys.stdout which is overwritten by 
colorama
-                out_file = sys.stdout
+
+            # Enable VT mode if necessary
+            if out_file is sys.stdout and self._should_enable_vt_mode:
+                self.init_debug_log.append("Enable VT mode.")
+                from ._win_vt import enable_vt_mode
+                if not enable_vt_mode():
+                    # Disable color if we can't enable it
+                    self.enable_color = False
 
             args = self.completion.get_completion_args() or args
 
@@ -249,10 +251,6 @@
         finally:
             self.raise_event(EVENT_CLI_POST_EXECUTE)
 
-            if self._should_init_colorama:
-                import colorama
-                colorama.deinit()
-
         return exit_code
 
     def _should_enable_color(self):
@@ -262,7 +260,6 @@
         #      - Otherwise, if the downstream command doesn't support color, 
Knack will fail with
         #      BrokenPipeError: [Errno 32] Broken pipe, like `az --version | 
head --lines=1`
         #      https://github.com/Azure/azure-cli/issues/13413
-        #      - May also hit https://github.com/tartley/colorama/issues/200
         #   3. stderr is a tty.
         #      - Otherwise, the output in stderr won't have LEVEL tag
         #   4. out_file is stdout
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/knack/invocation.py 
new/knack-0.10.0/knack/invocation.py
--- old/knack-0.9.0/knack/invocation.py 2021-11-05 06:18:23.000000000 +0100
+++ new/knack-0.10.0/knack/invocation.py        2022-08-19 07:55:35.000000000 
+0200
@@ -4,20 +4,20 @@
 # 
--------------------------------------------------------------------------------------------
 
 import sys
-
 from collections import defaultdict
 
-from .deprecation import ImplicitDeprecated, resolve_deprecate_info
-from .preview import ImplicitPreviewItem, resolve_preview_info
-from .experimental import ImplicitExperimentalItem, resolve_experimental_info
-from .util import CLIError, CtxTypeError, CommandResultItem, todict
-from .parser import CLICommandParser
 from .commands import CLICommandsLoader
+from .deprecation import ImplicitDeprecated, resolve_deprecate_info
 from .events import (EVENT_INVOKER_PRE_CMD_TBL_CREATE, 
EVENT_INVOKER_POST_CMD_TBL_CREATE,
                      EVENT_INVOKER_CMD_TBL_LOADED, 
EVENT_INVOKER_PRE_PARSE_ARGS,
                      EVENT_INVOKER_POST_PARSE_ARGS, 
EVENT_INVOKER_TRANSFORM_RESULT,
                      EVENT_INVOKER_FILTER_RESULT)
+from .experimental import ImplicitExperimentalItem, resolve_experimental_info
 from .help import CLIHelp
+from .log import CLILogging
+from .parser import CLICommandParser
+from .preview import ImplicitPreviewItem, resolve_preview_info
+from .util import CLIError, CtxTypeError, CommandResultItem, todict
 
 
 class CommandInvoker(object):
@@ -137,7 +137,8 @@
         self.parser.load_command_table(self.commands_loader)
         self.cli_ctx.raise_event(EVENT_INVOKER_CMD_TBL_LOADED, 
parser=self.parser)
 
-        arg_check = [a for a in args if a not in ['--verbose', '--debug', 
'--only-show-warnings']]
+        arg_check = [a for a in args if a not in
+                     (CLILogging.DEBUG_FLAG, CLILogging.VERBOSE_FLAG, 
CLILogging.ONLY_SHOW_ERRORS_FLAG)]
         if not arg_check:
             self.cli_ctx.completion.enable_autocomplete(self.parser)
             subparser = self.parser.subparsers[tuple()]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/knack.egg-info/PKG-INFO 
new/knack-0.10.0/knack.egg-info/PKG-INFO
--- old/knack-0.9.0/knack.egg-info/PKG-INFO     2021-11-05 06:18:29.000000000 
+0100
+++ new/knack-0.10.0/knack.egg-info/PKG-INFO    2022-08-19 07:55:52.000000000 
+0200
@@ -1,18 +1,16 @@
 Metadata-Version: 2.1
 Name: knack
-Version: 0.9.0
+Version: 0.10.0
 Summary: A Command-Line Interface framework
 Home-page: https://github.com/microsoft/knack
 Author: Microsoft Corporation
 Author-email: azpy...@microsoft.com
 License: MIT
-Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: System Administrators
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: 3.9
@@ -170,5 +168,3 @@
 =======
 
 Knack is licensed under `MIT <LICENSE>`__.
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/knack.egg-info/SOURCES.txt 
new/knack-0.10.0/knack.egg-info/SOURCES.txt
--- old/knack-0.9.0/knack.egg-info/SOURCES.txt  2021-11-05 06:18:29.000000000 
+0100
+++ new/knack-0.10.0/knack.egg-info/SOURCES.txt 2022-08-19 07:55:52.000000000 
+0200
@@ -6,6 +6,7 @@
 setup.cfg
 setup.py
 knack/__init__.py
+knack/_win_vt.py
 knack/arguments.py
 knack/cli.py
 knack/commands.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/setup.py new/knack-0.10.0/setup.py
--- old/knack-0.9.0/setup.py    2021-11-05 06:18:23.000000000 +0100
+++ new/knack-0.10.0/setup.py   2022-08-19 07:55:35.000000000 +0200
@@ -8,7 +8,7 @@
 import sys
 from setuptools import setup
 
-VERSION = '0.9.0'
+VERSION = '0.10.0'
 
 DEPENDENCIES = [
     'argcomplete',
@@ -18,10 +18,6 @@
     'tabulate'
 ]
 
-# On Windows, colorama is required for legacy terminals.
-if sys.platform == 'win32':
-    DEPENDENCIES.append('colorama')
-
 with open('README.rst', 'r') as f:
     README = f.read()
 
@@ -41,7 +37,6 @@
         'Intended Audience :: System Administrators',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/tests/test_deprecation.py 
new/knack-0.10.0/tests/test_deprecation.py
--- old/knack-0.9.0/tests/test_deprecation.py   2021-11-05 06:18:23.000000000 
+0100
+++ new/knack-0.10.0/tests/test_deprecation.py  2022-08-19 07:55:35.000000000 
+0200
@@ -409,7 +409,7 @@
 
     @redirect_io
     def test_deprecate_options_execute_hidden_non_deprecated(self):
-        """ Ensure hidden non-deprecated optionss can be used without warning. 
"""
+        """ Ensure hidden non-deprecated options can be used without warning. 
"""
         self.cli_ctx.invoke('arg-test --arg1 foo --opt1 bar --opt3 
bar'.split())
         actual = self.io.getvalue()
         expected = "Option '--alt3' has been deprecated and will be removed in 
a future release. Use '--opt3' instead."
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.9.0/tests/test_help.py 
new/knack-0.10.0/tests/test_help.py
--- old/knack-0.9.0/tests/test_help.py  2021-11-05 06:18:23.000000000 +0100
+++ new/knack-0.10.0/tests/test_help.py 2022-08-19 07:55:35.000000000 +0200
@@ -203,7 +203,7 @@
 
     @redirect_io
     def test_help_long_and_short_description_from_docstring(self):
-        """ Ensure the first sentence of a docstring is parsed as the short 
summary and subsequent text is interpretted
+        """ Ensure the first sentence of a docstring is parsed as the short 
summary and subsequent text is interpreted
         as the long summary. """
 
         with self.assertRaises(SystemExit):

Reply via email to