def install(package, build_path, install_path):
    archive_name = download_to(package['url'], build_path)
    verify(path.join(build_path, archive_name), package['md5'])

    dev_null = open('/dev/null', 'wb')

    tgz_ext = '.tar.gz'
    zip_ext = '.zip'
    if archive_name.endswith(tgz_ext):
        subprocess.check_call(['tar', 'xzf', archive_name],
                              cwd=build_path, stdout=dev_null, stderr=dev_null)
        dist_path = path.join(build_path, archive_name[:-len(tgz_ext)])

    elif archive_name.endswith(zip_ext):
        subprocess.check_call(['unzip', archive_name],
                              cwd=build_path, stdout=dev_null, stderr=dev_null)
        dist_path = path.join(build_path, archive_name[:-len(zip_ext)])

    else:
        raise ValueError(archive_name % "Unknown archive format: %r")

    cmd = [sys.executable, 'setup.py', 'install', '--root='+install_path]
    if package['setuptools']:
        cmd.append('--single-version-externally-managed')
    subprocess.check_call(cmd, cwd=dist_path, stdout=dev_null, stderr=dev_null)
dataset/ETHPy150Open mgax/tinymail/python-builder/install_deps.py/install/swapped operands of `%`