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
This commit is contained in:
46
doc/source/compatibility.rst
Normal file
46
doc/source/compatibility.rst
Normal file
@@ -0,0 +1,46 @@
|
||||
..
|
||||
The name of this document and the anchor in this document must be
|
||||
treated as a stable API. Links to this document are coded into
|
||||
pbr and deployed versions of pbr will refer users to this document
|
||||
in the case of certain errors.
|
||||
Ensure any link you use in PBR is defined via a ref with .. _name.
|
||||
|
||||
|
||||
===================
|
||||
Compatibility Notes
|
||||
===================
|
||||
|
||||
Useful notes about errors users may encounter when features cannot be
|
||||
supported on older versions of setuptools / pip / wheel.
|
||||
|
||||
|
||||
setuptools
|
||||
==========
|
||||
|
||||
|
||||
.. _evaluate-marker:
|
||||
|
||||
evaluate_marker
|
||||
---------------
|
||||
|
||||
evaluate_markers may run into issues with the '>', '>=', '<', and '<='
|
||||
operators if the installed version of setuptools is less than 17.1. Projects
|
||||
using these operators with markers should specify a minimum version of 17.1
|
||||
for setuptools.
|
||||
|
||||
|
||||
pip
|
||||
===
|
||||
|
||||
markers
|
||||
-------
|
||||
|
||||
For versions of pip < 7 with pbr < 1.9, dependencies that use markers will not
|
||||
be installed. Projects using pbr and markers should set a minimum version of
|
||||
1.9 for pbr.
|
||||
|
||||
|
||||
Recommended setup.py
|
||||
====================
|
||||
|
||||
:ref:`setup_py`.
|
||||
@@ -144,19 +144,21 @@ Usage
|
||||
``setuptools.setup()``. While the normal setuptools facilities are available,
|
||||
pbr makes it possible to express them through static data files.
|
||||
|
||||
.. _setup_py:
|
||||
|
||||
setup.py
|
||||
--------
|
||||
|
||||
`pbr` only requires a minimal `setup.py` file compared to a standard setuptools
|
||||
project. This is because most configuration is located in static configuration
|
||||
files. This minimal `setup.py` file should look something like this::
|
||||
files. This recommended minimal `setup.py` file should look something like this::
|
||||
|
||||
#!/usr/bin/env python
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
setup_requires=['pbr'],
|
||||
setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
|
||||
pbr=True,
|
||||
)
|
||||
|
||||
@@ -395,6 +397,7 @@ Additional Docs
|
||||
packagers
|
||||
semver
|
||||
testing
|
||||
compatibility
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
@@ -45,10 +45,11 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase):
|
||||
foo:python_version=='2.6'
|
||||
bar
|
||||
baz<1.6 :python_version=='2.6'
|
||||
zaz :python_version>'1.0'
|
||||
""",
|
||||
'expected_extra_requires': {
|
||||
"test:(python_version=='2.6')": ['foo', 'baz<1.6'],
|
||||
"test": ['bar']}}),
|
||||
"test": ['bar', 'zaz']}}),
|
||||
('no_extras', {
|
||||
'config_text': """
|
||||
[metadata]
|
||||
@@ -73,3 +74,10 @@ class TestExtrasRequireParsingScenarios(base.BaseTestCase):
|
||||
|
||||
self.assertEqual(self.expected_extra_requires,
|
||||
kwargs['extras_require'])
|
||||
|
||||
|
||||
class TestInvalidMarkers(base.BaseTestCase):
|
||||
|
||||
def test_invalid_marker_raises_error(self):
|
||||
config = {'extras': {'test': "foo :bad_marker>'1.0'"}}
|
||||
self.assertRaises(SyntaxError, util.setup_cfg_to_setup_kwargs, config)
|
||||
|
||||
@@ -431,7 +431,13 @@ def setup_cfg_to_setup_kwargs(config, script_args=()):
|
||||
if pkg_resources.evaluate_marker('(%s)' % env_marker):
|
||||
extras_key = req_group
|
||||
except SyntaxError:
|
||||
pass
|
||||
log.error(
|
||||
"Marker evaluation failed, see the following "
|
||||
"error. For more information see: "
|
||||
"http://docs.openstack.org/"
|
||||
"developer/pbr/compatibility.html#evaluate-marker"
|
||||
)
|
||||
raise
|
||||
else:
|
||||
extras_key = req_group
|
||||
extras_require.setdefault(extras_key, []).append(requirement)
|
||||
|
||||
Reference in New Issue
Block a user