Do not break on projects without setup.cfg
setup.cfg is used by pbr instead of setup.py. Projects not using pbr while not have setup.cfg at all or will have it with completely different contents. There's already a check in update.py whether or not the target project is using pbr, but it relies on presence of setup.cfg, which may not be the case. After this patch update.py will try to read setup.cfg only after it detected that pbr is used. Change-Id: I21fbbe159007b25db546fa6d36721e018d1dca24
This commit is contained in:
parent
ec1c788c2b
commit
569483fa41
13
update.py
13
update.py
@ -241,12 +241,13 @@ def _write_setup_py(dest_path):
|
||||
if not os.path.exists(target_setup_py):
|
||||
return
|
||||
has_pbr = 'pbr' in _read(target_setup_py)
|
||||
is_pbr = 'name = pbr' in _read(setup_cfg)
|
||||
if has_pbr and not is_pbr:
|
||||
verbose("Syncing setup.py")
|
||||
# We only want to sync things that are up to date with pbr mechanics
|
||||
with open(target_setup_py, 'w') as setup_file:
|
||||
setup_file.write(_setup_py_text)
|
||||
if has_pbr:
|
||||
if 'name = pbr' not in _read(setup_cfg):
|
||||
verbose("Syncing setup.py")
|
||||
# We only want to sync things that are up to date
|
||||
# with pbr mechanics
|
||||
with open(target_setup_py, 'w') as setup_file:
|
||||
setup_file.write(_setup_py_text)
|
||||
|
||||
|
||||
def main(options, args):
|
||||
|
Loading…
x
Reference in New Issue
Block a user