• Brandon LeBlanc's avatar
    Resolve ``ValueError`` when mapping value contains a literal ``=``. · e28fc7e8
    Brandon LeBlanc authored
    Example ``setup.cfg``::
    
        project_urls =
          Documentation = https://format-pipfile.readthedocs.io/en/latest/?badge=latest
    
    Current result::
    
        $ ./setup.py
        ERROR:root:Error parsing
        Traceback (most recent call last):
          File "/usr/local/lib/python3.7/site-packages/pbr/core.py", line 96, in pbr
            attrs = util.cfg_to_args(path, dist.script_args)
          File "/usr/local/lib/python3.7/site-packages/pbr/util.py", line 258, in cfg_to_args
            kwargs = setup_cfg_to_setup_kwargs(config, script_args)
          File "/usr/local/lib/python3.7/site-packages/pbr/util.py", line 336, in setup_cfg_to_setup_kwargs
            k, v = i.split(=)
        ValueError: too many values to unpack (expected 2)
        error in setup command: Error parsing /Users/brandon/src/format-pipfile/setup.cfg: ValueError: too many values to unpack (expected 2)
    
    After changes::
    
        $ ./setup.py egg_info
        [...]
        $ grep -i project-url *.egg-info/PKG-INFO
        [...]
        Project-URL: Documentation, https://format-pipfile.readthedocs.io/en/latest/?badge=latest
        [...]
    
    add unit tests
    
        {1} pbr.tests.test_util.TestMapFieldsParsingScenarios.test_project_url_parsing(simple_project_urls) [0.034230s] ... ok
        {1} pbr.tests.test_util.TestMapFieldsParsingScenarios.test_project_url_parsing(query_parameters) [0.029791s] ... ok
    
    Closes-Bug: #1817592
    Change-Id: Ifd4c46111528d99dadee77d6aabed201d9e84bdb
    Signed-off-by: 's avatarBrandon LeBlanc <brandon@leblanc.codes>
    e28fc7e8