(winecmd: T.List[str], wine_paths: T.Sequence[str])
return wine_path.strip(';')
Get A short version of @wine_paths to avoid reaching WINEPATH number
    of char limit.
Get A short version of
Get A short version of
def get_wine_shortpath(winecmd: T.List[str], wine_paths: T.Sequence[str]) -> str:
    """Get A short version of @wine_paths to avoid reaching WINEPATH number
    of char limit.
    """

    wine_paths = list(OrderedSet(wine_paths))

    getShortPathScript = '%s.bat' % str(uuid.uuid4()).lower()[:5]
    with open(getShortPathScript, mode='w', encoding='utf-8') as f:
        f.write("@ECHO OFF\nfor %%x in (%*) do (\n echo|set /p=;%~sx\n)\n")
        f.flush()
    try:
        with open(os.devnull, 'w', encoding='utf-8') as stderr:
            wine_path = subprocess.check_output(
                winecmd +
                ['cmd', '/C', getShortPathScript] + wine_paths,
                stderr=stderr).decode('utf-8')
    except subprocess.CalledProcessError as e:
        print("Could not get short paths: %s" % e)
        wine_path = ';'.join(wine_paths)
    finally:
        os.remove(getShortPathScript)
    if len(wine_path) > 2048:
        raise MesonException(
            'WINEPATH size {} > 2048'
            ' this will cause random failure.'.format(
                len(wine_path)))

    return wine_path.strip(';')
def get_wine_shortpath ( winecmd : T . List [ str ] , wine_paths : T . Sequence [ str ] ) -> str : wine_paths = list ( OrderedSet ( wine_paths ) ) getShortPathScript = '%s.bat' % str ( uuid . uuid4 ( ) ) . lower ( ) [ : 5 ] with open ( getShortPathScript , mode = 'w' , encoding = 'utf-8' ) as f : f . write ( "@ECHO OFF\nfor %%x in (%*) do (\n echo|set /p=;%~sx\n)\n" ) f . flush ( ) try : with open ( os . devnull , 'w' , encoding = 'utf-8' ) as stderr : wine_path = subprocess . check_output ( winecmd + [ 'cmd' , '/C' , getShortPathScript ] + wine_paths , stderr = stderr ) . decode ( 'utf-8' ) except subprocess . CalledProcessError as e : print ( "Could not get short paths: %s" % e ) wine_path = ';' . join ( wine_paths ) finally : os . remove ( getShortPathScript ) if len ( wine_path ) > 2048 : raise MesonException ( 'WINEPATH size {} > 2048' ' this will cause random failure.' . format ( len ( wine_path ) ) ) return wine_path . strip ( ';' )