try to remove python2.7 settings before adding python3

Change-Id: I08d155926e9f4cfea4a6d51debe44fdc9c18a434
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-09-26 18:37:29 -04:00
parent b43191241e
commit 049d7b384c
1 changed files with 8 additions and 0 deletions

View File

@ -184,6 +184,14 @@ def fix_one(workdir, repo, bad_envs):
for env in bad_envs:
env_header = '[{}]\n'.format(env)
LOG.info('updating %r', env_header.rstrip())
# First try to remove a python2 setting, if it is there. This
# won't catch everything, but it does seem to be the most
# common pattern.
tox_contents = tox_contents.replace(
env_header + 'basepython = python2.7\n',
env_header,
)
# Now try to add the python3 setting.
tox_contents = tox_contents.replace(
env_header,
env_header + 'basepython = python3\n',