def determine_version(self, path):
    # Map of target version numbers to their equivalent class file versions, which are different.
    version_map = {
      '50.0': '1.6',
      '51.0': '1.7',
      '52.0': '1.8',
    }
    p = Popen(['file', path], stdout=PIPE, stderr=PIPE)
    out, err = p.communicate()
    self.assertEqual(0, p.returncode, 'Failed to run file on {}.'.format(path))
    match = re.search(r'version (\d+[.]\d+)', out)
    self.assertTrue(match is not None, 'Could not determine version for {}'.format(path))
    return version_map[match.group(1)]
Given the filepath to a class file, invokes the 'file' commandline to find its java version.
dataset/ETHPy150Open pantsbuild/pants/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/jvm_platform_integration_mixin.py/JvmPlatformIntegrationMixin.determine_version