Commit Graph

15 Commits

Author SHA1 Message Date
ljhuang 2290f58eb9 Replace deprecated readfp method with read_file
The readfp method has been deprecated since version 3.2 [1].

[1] https://docs.python.org/3/library/configparser.html?highlight=deprecated#configparser.ConfigParser.readfp

Change-Id: Ib9549509bfcc749740953e3769030d787b2bf251
2022-07-22 17:41:30 +08:00
Stephen Finucane f40c41d28f Add test for cfg -> py transformation
Change-Id: I176dc6a2c6d8f37717e1e17ba41ee72bef9536fb
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2021-04-22 10:00:38 +01:00
Antoine Musso 07b6ac85e6 Update some url to use opendev.org
The git web URL is now: https://opendev.org/openstack/pbr

Also stop linking README.rst to no more existing history/changelog
documentation page (removed by 96b84a9014).

Change-Id: I56b0e2b86a7fc66c5ae25e06175033a885f500f6
2020-08-06 15:09:50 +02:00
Clark Boylan 206b795517 Update hacking
This allows us to run tox -epep8 on newer python versions. Fix the
issues newer hacking calls out. They were complaints about indentation
and ambigious l value variable names.

Change-Id: I9552fba791bdf54649fbe25fc26bffdf8186ff0a
2020-08-05 15:01:21 -07:00
Ben Nemec 3b102a551b Read description file as utf-8
Currently pbr fails if the description file contains unicode
characters.  To fix this we need to open the description file as
utf-8 explicitly.  Since open() in Python 2 doesn't support an
encoding parameter, use io.open() which works on both 2 and 3.

Co-Authored-By: Hervé Beraud<hberaud@redhat.com>

Change-Id: I1bee502ac84b474cc9db5523d2437a8c0a861c00
Closes-Bug: 1704472
2019-05-24 10:59:17 +02:00
Will Szumski 50356da839 Fix white space handling in file names
Previously, when using data_files with a glob that matched a file with
whitespace in the name, pip would error with a message that the file
does not exist, e.g:

    error: can't copy 'ansible/roles/yatesr.timezone/templates/timezone-Arch': doesn't exist or not a regular file

The problem was that ansible/roles/yatesr.timezone/templates/timezone-Arch
was a truncated form of the actual filename:

    ansible/roles/yatesr.timezone/templates/timezone-Arch Linux.j2

Note the space in the filename and that it has been split on this space.

This change allows you to use a glob that matches files with whitespace
in the name. It does this by quoting the path.

Change-Id: Id2cc32e4e40c1f834b19756e922118d8526358d3
Fixes-Bug: 1810934
2019-04-25 11:25:56 +01:00
Ben Nemec 7f9d653c29 Support provides_extra metadata
This was added to setuptools in [1] so we should support passing it
through from pbr.

Change-Id: I46493c18756bcb01c53575ab51ec5e5e97670fc3
1: b2ea3c4a20
Closes-Bug: 1760938
2019-03-25 16:39:59 +00:00
Hervé Beraud 2e3aa0d851 Fix error when keywords are defined as a list in cfg
When keywords are defined as a list in cfg file the generated
output have errors and breaks metadata generation.

Change-Id: Ie8a5f30d6af1e81ecf3ca40bc94bc460cca38179
Closes-Bug: #1811475
2019-03-04 18:44:35 +01:00
Brandon LeBlanc e28fc7e870 Resolve ``ValueError`` when mapping value contains a literal ``=``.
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: Brandon LeBlanc <brandon@leblanc.codes>
2019-02-25 17:09:55 +01:00
Monty Taylor 225e882322 Put test-requirements into an extra named 'test'
In bindep files we use a 'test' environment to indicate dependencies
that are needed for testing. Make the same thing available for our
python dependencies, allowing things like "pip install .[test]" or "pip
install shade[test]" to work.

Change-Id: If3ad8b6a79a8cab2f7434b73207f35384e8516ba
2017-12-06 11:01:52 +00:00
jiansong 77d9ab7d07 Deprecated warning for SafeConfigParser
tox -e py34 is reporting a deprecation warning for SafeConfigParser
/octavia/.tox/py34/lib/python3.4/site-packages/pbr/util.py:207:
DeprecationWarning: The SafeConfigParser class has been renamed to
ConfigParser in Python 3.2. This alias will be removed in future
versions. Use ConfigParser directly instead.
  parser = configparser.SafeConfigParser()

Closes-Bug: #1618666
Change-Id: Ib280b778938b64717ee1cf94efae2f7b553c8f5e
2016-09-11 23:15:54 -07:00
Sachi King 11ffee94fa Do not silently drop markers that fail to evaluate
We are silently dropping requirements that do not parse, do not do this
and bubble the error up.

Change-Id: I5bfce7c7d0be2ccd880e78509856074a09c57166
Closes-Bug: 1554331
2016-03-09 11:26:43 +11:00
Robert Collins d92f3a736e Remove redundant testscenarios glue.
discover can correctly handle packages these days, so we can load and
apply just once.

Change-Id: I8bedf6d15b0aaf3e45c2a47098ffe24240192193
2015-10-07 14:51:23 +13:00
Monty Taylor 61a3a1ecdf Wrap env markers in parens
If there are boolean conditions in the env marker, the existing join
causes the extra tag to only be applied to the first of them, causing
carnage.

Change-Id: I7b735befae76b330f923276e1c48ef23816774d4
2015-07-10 21:24:35 +00:00
James Polley 2b29c4fc2b Teach pbr to read extras and env markers
This adds support for reading extras from setup.cfg.

It also adds support for handling environment markers, both in the
extras section and in install_requires and in requirements.txt.

Change-Id: I6fd8276012e65f82934df9c374613b1ce6856b5a
2015-05-15 21:31:21 +10:00