Merge "Tie recursion calls to Dist object, not module"

This commit is contained in:
Zuul 2023-01-07 00:17:13 +00:00 committed by Gerrit Code Review
commit 1ca7781493
1 changed files with 2 additions and 8 deletions

View File

@ -61,11 +61,6 @@ else:
integer_types = (int, long) # noqa
# We use this canary to detect whether the module has already been called,
# in order to avoid recursion
in_use = False
def pbr(dist, attr, value):
"""Implements the actual pbr setup() keyword.
@ -91,10 +86,9 @@ def pbr(dist, attr, value):
# particularly when using PEP517 build-system configs without
# setup_requires in setup.py. We can avoid the recursion by setting
# this canary so we don't repeat ourselves.
global in_use
if in_use:
if hasattr(dist, '_pbr_initialized'):
return
in_use = True
dist._pbr_initialized = True
if not value:
return