Handle projects without setup.py or valid setup.cfg
project-config has tox jobs but does not have a setup.py. This confuses the siblings code. First - check for a setup.cfg and if one is not there just give up. Second - we switched to just reading setup.cfg in the other part of the module. Do that for determining package name as well. Change-Id: I1f33261871791863e77789b522fc6f7db3f3cdbb
This commit is contained in:
parent
76dc3d8e09
commit
204f96e1ef
@ -100,15 +100,23 @@ def main():
|
||||
project_dir = module.params['project_dir']
|
||||
projects = module.params['projects']
|
||||
|
||||
if not os.path.exists(os.path.join(project_dir, 'setup.cfg')):
|
||||
module.exit_json(changed=False, msg="No setup.cfg, no action needed")
|
||||
|
||||
# Who are we?
|
||||
try:
|
||||
c = configparser.ConfigParser()
|
||||
c.read(os.path.join(project_dir, 'setup.cfg'))
|
||||
package_name = c.get('metadata', 'name')
|
||||
except Exception:
|
||||
module.exit_json(
|
||||
changed=False, msg="No name in setup.cfg, skipping siblings")
|
||||
|
||||
tox_python = '{project_dir}/.tox/{envlist}/bin/python'.format(
|
||||
project_dir=project_dir, envlist=envlist)
|
||||
# Write a log file into the .tox dir so that it'll get picked up
|
||||
log_file = '{project_dir}/.tox/{envlist}/log/siblings.txt'.format(
|
||||
project_dir=project_dir, envlist=envlist)
|
||||
# Who are we?
|
||||
package_name = subprocess.check_output(
|
||||
['.tox/{envlist}/bin/python'.format(envlist=envlist),
|
||||
'setup.py', '--name'], cwd=project_dir).strip()
|
||||
|
||||
log = list()
|
||||
log.append(
|
||||
|
Loading…
x
Reference in New Issue
Block a user