def check_version(component, expected_version):
    """Make sure the package version in setuptools matches what we expect it to be"""

    comp = comp_names[component]

    compath = os.path.realpath(os.path.abspath(comp.path))
    sys.path.insert(0, compath)

    import version

    if version.version != expected_version:
        raise EnvironmentError("Version mismatch during release, expected={}, found={}".format(expected_version, version.version))