def replace_toml_version(relpath, newversion):
    p = pathlib.Path(relpath)
    assert p.exists()
    tmp_path = (str(p) + '_tmp')
    with open(tmp_path, 'w') as f:
        for line in open(str(p)):
            m = rex.match(line)
            if (m is not None):
                print('{}: set version={}'.format(relpath, newversion))
                f.write('version = "{}"\n'.format(newversion))
            else:
                f.write(line)
    os.rename(tmp_path, str(p))
def replace_toml_version(relpath, newversion):
    p = pathlib.Path(relpath)
    assert p.exists()
    tmp_path = (str(p) + '_tmp')
    with open(tmp_path, 'w') as f:
        for line in open(str(p)):
            m = rex.match(line)
            if (m is not None):
                print('{}: set version={}'.format(relpath, newversion))
                f.write('version = "{}"\n'.format(newversion))
            else:
                f.write(line)
    os.rename(tmp_path, str(p))