Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-configargparse for 
openSUSE:Factory checked in at 2021-03-10 08:56:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-configargparse (Old)
 and      /work/SRC/openSUSE:Factory/.python-configargparse.new.2378 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-configargparse"

Wed Mar 10 08:56:57 2021 rev:11 rq:877832 version:1.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-configargparse/python-configargparse.changes  
    2020-06-11 10:12:21.548635933 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-configargparse.new.2378/python-configargparse.changes
    2021-03-10 08:58:30.234966312 +0100
@@ -1,0 +2,6 @@
+Mon Mar  8 22:37:50 UTC 2021 - Dirk M??ller <[email protected]>
+
+- update to 1.3:
+  * Python 3.9 support 
+
+-------------------------------------------------------------------

Old:
----
  ConfigArgParse-1.2.3.tar.gz

New:
----
  ConfigArgParse-1.3.tar.gz

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

Other differences:
------------------
++++++ python-configargparse.spec ++++++
--- /var/tmp/diff_new_pack.F8Xpy7/_old  2021-03-10 08:58:30.718966811 +0100
+++ /var/tmp/diff_new_pack.F8Xpy7/_new  2021-03-10 08:58:30.722966816 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-configargparse
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 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-%{**}}
 %bcond_without python2
 Name:           python-configargparse
-Version:        1.2.3
+Version:        1.3
 Release:        0
 Summary:        A drop-in replacement for argparse
 License:        MIT

++++++ ConfigArgParse-1.2.3.tar.gz -> ConfigArgParse-1.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ConfigArgParse-1.2.3/ConfigArgParse.egg-info/PKG-INFO 
new/ConfigArgParse-1.3/ConfigArgParse.egg-info/PKG-INFO
--- old/ConfigArgParse-1.2.3/ConfigArgParse.egg-info/PKG-INFO   2020-04-24 
05:43:41.000000000 +0200
+++ new/ConfigArgParse-1.3/ConfigArgParse.egg-info/PKG-INFO     2021-02-15 
00:17:35.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ConfigArgParse
-Version: 1.2.3
+Version: 1.3
 Summary: A drop-in replacement for argparse that allows options to also be set 
via config files and/or environment variables.
 Home-page: https://github.com/bw2/ConfigArgParse
 License: MIT
@@ -63,7 +63,7 @@
         Example
         ~~~~~~~
         
-        *my_script.py*:
+        *config_test.py*:
         
         Script that defines 4 options and a positional arg and then parses and 
prints the values. Also,
         it prints out the help message as well as the string produced by 
:code:`format_values()` to show
@@ -218,7 +218,7 @@
         
         .. code:: py
         
-                config = configparser.ConfigParser(
+                config = configparser.ArgParser(
                     delimiters=("=",":"),
                     allow_no_value=False,
                     comment_prefixes=("#",";"),
@@ -256,7 +256,7 @@
                 import configargparse
                 import yaml
         
-                parser = configargparse.ConfigParser(
+                parser = configargparse.ArgParser(
                     
config_file_parser_class=configargparse.ConfigparserConfigFileParser
                 )
                 parser.add_argument('--system1_settings', type=yaml.safe_load)
@@ -485,6 +485,7 @@
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.2.3/PKG-INFO 
new/ConfigArgParse-1.3/PKG-INFO
--- old/ConfigArgParse-1.2.3/PKG-INFO   2020-04-24 05:43:41.000000000 +0200
+++ new/ConfigArgParse-1.3/PKG-INFO     2021-02-15 00:17:36.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: ConfigArgParse
-Version: 1.2.3
+Version: 1.3
 Summary: A drop-in replacement for argparse that allows options to also be set 
via config files and/or environment variables.
 Home-page: https://github.com/bw2/ConfigArgParse
 License: MIT
@@ -63,7 +63,7 @@
         Example
         ~~~~~~~
         
-        *my_script.py*:
+        *config_test.py*:
         
         Script that defines 4 options and a positional arg and then parses and 
prints the values. Also,
         it prints out the help message as well as the string produced by 
:code:`format_values()` to show
@@ -218,7 +218,7 @@
         
         .. code:: py
         
-                config = configparser.ConfigParser(
+                config = configparser.ArgParser(
                     delimiters=("=",":"),
                     allow_no_value=False,
                     comment_prefixes=("#",";"),
@@ -256,7 +256,7 @@
                 import configargparse
                 import yaml
         
-                parser = configargparse.ConfigParser(
+                parser = configargparse.ArgParser(
                     
config_file_parser_class=configargparse.ConfigparserConfigFileParser
                 )
                 parser.add_argument('--system1_settings', type=yaml.safe_load)
@@ -485,6 +485,7 @@
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.2.3/README.rst 
new/ConfigArgParse-1.3/README.rst
--- old/ConfigArgParse-1.2.3/README.rst 2020-04-23 03:09:45.000000000 +0200
+++ new/ConfigArgParse-1.3/README.rst   2021-02-14 23:41:31.000000000 +0100
@@ -57,7 +57,7 @@
 Example
 ~~~~~~~
 
-*my_script.py*:
+*config_test.py*:
 
 Script that defines 4 options and a positional arg and then parses and prints 
the values. Also,
 it prints out the help message as well as the string produced by 
:code:`format_values()` to show
@@ -212,7 +212,7 @@
 
 .. code:: py
 
-        config = configparser.ConfigParser(
+        config = configparser.ArgParser(
             delimiters=("=",":"),
             allow_no_value=False,
             comment_prefixes=("#",";"),
@@ -250,7 +250,7 @@
         import configargparse
         import yaml
 
-        parser = configargparse.ConfigParser(
+        parser = configargparse.ArgParser(
             
config_file_parser_class=configargparse.ConfigparserConfigFileParser
         )
         parser.add_argument('--system1_settings', type=yaml.safe_load)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.2.3/configargparse.py 
new/ConfigArgParse-1.3/configargparse.py
--- old/ConfigArgParse-1.2.3/configargparse.py  2020-04-24 05:42:52.000000000 
+0200
+++ new/ConfigArgParse-1.3/configargparse.py    2021-02-15 00:09:27.000000000 
+0100
@@ -1,4 +1,5 @@
 import argparse
+import json
 import glob
 import os
 import re
@@ -164,12 +165,17 @@
                 value = key_value_match.group("value")
 
                 if value.startswith("[") and value.endswith("]"):
-                    # handle special case of lists
-                    value = [elem.strip() for elem in value[1:-1].split(",")]
+                    # handle special case of k=[1,2,3] or other json-like 
syntax
+                    try:
+                        value = json.loads(value)
+                    except Exception as e:
+                        # for backward compatibility with legacy format (eg. 
where config value is [a, b, c] instead of proper json ["a", "b", "c"]
+                        value = [elem.strip() for elem in 
value[1:-1].split(",")]
 
                 items[key] = value
                 continue
 
+
             raise ConfigFileParserException("Unexpected line {} in {}: 
{}".format(i,
                 getattr(stream, 'name', 'stream'), line))
         return items
@@ -193,7 +199,7 @@
     def get_syntax_description(self):
         msg = """Uses configparser module to parse an INI file which allows 
multi-line
         values.
-        
+
         Allowed syntax is that for a ConfigParser with the following options:
 
             allow_no_value = False,
@@ -202,7 +208,7 @@
             empty_lines_in_values = False
 
         See https://docs.python.org/3/library/configparser.html for details.
-        
+
         Note: INI file sections names are still treated as comments.
         """
         return msg
@@ -271,7 +277,7 @@
         return msg
 
     def _load_yaml(self):
-        """lazy-import PyYAML so that configargparse doesn't have to dependend
+        """lazy-import PyYAML so that configargparse doesn't have to depend
         on it unless this parser is used."""
         try:
             import yaml
@@ -300,6 +306,8 @@
         for key, value in parsed_obj.items():
             if isinstance(value, list):
                 result[key] = value
+            elif value is None:
+                pass
             else:
                 result[key] = str(value)
 
@@ -352,11 +360,11 @@
                 environment variable)
             default_config_files: When specified, this list of config files 
will
                 be parsed in order, with the values from each config file
-                taking precedence over pervious ones. This allows an 
application
+                taking precedence over previous ones. This allows an 
application
                 to look for config files in multiple standard locations such as
                 the install directory, home directory, and current directory.
                 Also, shell * syntax can be used to specify all conf files in a
-                directory. For exmaple:
+                directory. For example:
                 ["/etc/conf/app_config.ini",
                  "/etc/conf/conf-enabled/*.ini",
                 "~/.my_app_config.ini",
@@ -366,7 +374,7 @@
                 configargparse args will be ignored. If false, they will be
                 processed and appended to the commandline like other args, and
                 can be retrieved using parse_known_args() instead of 
parse_args()
-            config_file_open_func: function used to open a config file for 
reading 
+            config_file_open_func: function used to open a config file for 
reading
                 or writing. Needs to return a file-like object.
             config_file_parser_class: configargparse.ConfigFileParser subclass
                 which determines the config file format. configargparse comes
@@ -836,18 +844,27 @@
 
             if not user_config_file:
                 continue
-            # validate the user-provided config file path
+
+            # open user-provided config file
             user_config_file = os.path.expanduser(user_config_file)
-            if not os.path.isfile(user_config_file):
-                self.error('File not found: %s' % user_config_file)
+            try:
+                stream = self._config_file_open_func(user_config_file)
+            except Exception as e:
+                if len(e.args) == 2:  # OSError
+                    errno, msg = e.args
+                else:
+                    msg = str(e)
+                self.error("Unable to open config file: %s. Error: %s" % (
+                    user_config_file, msg
+                ))
 
-            config_files += [self._config_file_open_func(user_config_file)]
+            config_files += [stream]
 
         return config_files
 
     def format_values(self):
         """Returns a string with all args and settings and where they came from
-        (eg. commandline, config file, enviroment variable or default)
+        (eg. commandline, config file, environment variable or default)
         """
         source_key_to_display_value_map = {
             _COMMAND_LINE_SOURCE_KEY: "Command Line Args: ",
@@ -943,7 +960,7 @@
     Additional Args:
         env_var: If set, the value of this environment variable will override
             any config file or default values for this arg (but can itself
-            be overriden on the commandline). Also, if auto_env_var_prefix is
+            be overridden on the commandline). Also, if auto_env_var_prefix is
             set in the constructor, this env var name will be used instead of
             the automatic name.
         is_config_file_arg: If True, this arg is treated as a config file path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.2.3/setup.py 
new/ConfigArgParse-1.3/setup.py
--- old/ConfigArgParse-1.2.3/setup.py   2020-04-24 05:43:20.000000000 +0200
+++ new/ConfigArgParse-1.3/setup.py     2021-02-15 00:14:13.000000000 +0100
@@ -76,7 +76,7 @@
 
 setup(
     name='ConfigArgParse',
-    version="1.2.3",
+    version="1.3",
     description='A drop-in replacement for argparse that allows options to '
                 'also be set via config files and/or environment variables.',
     long_description=long_description,
@@ -98,6 +98,7 @@
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
     ],
Binary files old/ConfigArgParse-1.2.3/tests/__init__.pyc and 
new/ConfigArgParse-1.3/tests/__init__.pyc differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ConfigArgParse-1.2.3/tests/test_configargparse.py 
new/ConfigArgParse-1.3/tests/test_configargparse.py
--- old/ConfigArgParse-1.2.3/tests/test_configargparse.py       2020-03-15 
12:07:55.000000000 +0100
+++ new/ConfigArgParse-1.3/tests/test_configargparse.py 2021-02-14 
23:41:54.000000000 +0100
@@ -189,7 +189,7 @@
                                    if sys.version_info.major < 3 else
                                    "the following arguments are required: vcf, 
-g/--my-cfg-file",
                                    args="--genome hg19")
-        self.assertParseArgsRaises("not found: file.txt", args="-g file.txt")
+        self.assertParseArgsRaises("Unable to open config file: file.txt. 
Error: No such file or director", args="-g file.txt")
 
         # check values after setting args on command line
         config_file2 = tempfile.NamedTemporaryFile(mode="w", delete=True)
@@ -427,6 +427,7 @@
         self.add_arg('--c')
         self.add_arg('--b', action="store_true")
         self.add_arg('--a', action="append", type=int)
+        self.add_arg('--m', action="append", nargs=3, metavar=("<a1>", "<a2>", 
"<a3>"),)
 
         ns = self.parse(args="-x 1", env_vars={}, config_file_contents="""
 
@@ -462,6 +463,8 @@
         a = 33
         ---
         z z 1
+        ---
+        m = [[1, 2, 3], [4, 5, 6]]
         """)
 
         self.assertEqual(ns.x, 1)
@@ -477,7 +480,7 @@
             '  b: \\s+ True\n'
             '  a: \\s+ 33\n'
             '  z: \\s+ z 1\n')
-
+        self.assertEqual(ns.m, [['1', '2', '3'], ['4', '5', '6']])
 
         # -x is not a long arg so can't be set via config file
         self.assertParseArgsRaises("argument -x is required"
@@ -838,7 +841,7 @@
 
         self.assertRegex(self.format_help(),
             r'usage: .* \[-h\] -c CONFIG_FILE\s+'
-            r'\[-w CONFIG_OUTPUT_PATH\]\s* --arg1 ARG1\s*\[--flag\]\s*'
+            r'\[-w CONFIG_OUTPUT_PATH\]\s* --arg1\s+ARG1\s*\[--flag\]\s*'
             'Args that start with \'--\' \\(eg. --arg1\\) can also be set in a 
'
             r'config file\s*\(~/.myconfig or specified via -c\).\s*'
             r'Config file syntax allows: key=value,\s*flag=true, 
stuff=\[a,b,c\] '
@@ -1029,6 +1032,20 @@
         options = p.parse(args=[])
         self.assertDictEqual(vars(options), {})
 
+    def testConfigOpenFuncError(self):
+        # test OSError
+        def error_func(path):
+            raise OSError(9, "some error")
+        self.initParser(config_file_open_func=error_func)
+        self.parser.add_argument('-g', is_config_file=True)
+        self.assertParseArgsRaises("Unable to open config file: file.txt. 
Error: some error", args="-g file.txt")
+
+        # test other error
+        def error_func(path):
+            raise Exception('custom error')
+        self.initParser(config_file_open_func=error_func)
+        self.parser.add_argument('-g', is_config_file=True)
+        self.assertParseArgsRaises("Unable to open config file: file.txt. 
Error: custom error", args="-g file.txt")
 
 class TestConfigFileParsers(TestCase):
     """Test ConfigFileParser subclasses in isolation"""
@@ -1079,11 +1096,11 @@
             '_b': 'c',
             '_list_arg1': ['a', 'b', 'c'],
             '_str_arg': 'true',
-            '_list_arg2': ['1', '2', '3'],
+            '_list_arg2': [1, 2, 3],
         })
 
         self.assertListEqual(parsed_obj['_list_arg1'], ['a', 'b', 'c'])
-        self.assertListEqual(parsed_obj['_list_arg2'], ['1', '2', '3'])
+        self.assertListEqual(parsed_obj['_list_arg2'], [1, 2, 3])
 
     def testYAMLConfigFileParser_Basic(self):
         try:
Binary files old/ConfigArgParse-1.2.3/tests/test_configargparse.pyc and 
new/ConfigArgParse-1.3/tests/test_configargparse.pyc differ

Reply via email to