

def extract_msi(fname, targetdir=None, verbose=False):
    'Extract .msi installer to a temporary directory (if targetdir\n    is None). Return the temporary directory path'
    assert fname.endswith('.msi')
    if (targetdir is None):
        targetdir = _create_temp_dir()
    extract = 'msiexec.exe'
    bname = osp.basename(fname)
    args = ['/a', ('%s' % bname)]
    if (not verbose):
        args += ['/qn']
    args += [('TARGETDIR=%s' % targetdir)]
    subprocess.call(([extract] + args), cwd=osp.dirname(fname))
    print(('fname=%s' % fname))
    print(('TARGETDIR=%s' % targetdir))
    if ('-3.3' not in targetdir):
        subprocess.call([('%s\\%s' % (targetdir, 'python.exe')), '-m', 'ensurepip'], cwd=osp.dirname(('%s\\%s' % (targetdir, 'pythons.exe'))))
        import glob
        for fname in glob.glob(('%s\\Scripts\\*.exe' % targetdir)):
            patch_shebang_line(fname)
    return bname

dataset/ETHPy150Open winpython/winpython/winpython/utils.py extract_msi/VarMisuse@209/340 `targetdir`->`bname`