<s> from __future__ import absolute_import <EOL> from __future__ import unicode_literals <EOL> import contextlib <EOL> import os <EOL> import platform <EOL> import re <EOL> import shutil <EOL> import tempfile <EOL> import distlib . wheel <EOL> def default_platform_name ( ) : <EOL> """<STR_LIT>""" <EOL> def sanitize ( string ) : <EOL> return re . sub ( '<STR_LIT>' , '<STR_LIT:_>' , string . lower ( ) ) <EOL> def grab_version ( string , num ) : <EOL> """<STR_LIT>""" <EOL> return '<STR_LIT:.>' . join ( string . split ( '<STR_LIT:.>' ) [ : num ] ) <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> dist , version , __ = platform . linux_distribution ( ) <EOL> dist = re . sub ( '<STR_LIT>' , '<STR_LIT>' , dist . lower ( ) ) . strip ( ) <EOL> if dist == '<STR_LIT>' : <EOL> dist = '<STR_LIT>' <EOL> release = None <EOL> if dist in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> release = grab_version ( version , <NUM_LIT:1> ) <EOL> elif dist in [ '<STR_LIT>' ] : <EOL> release = grab_version ( version , <NUM_LIT:2> ) <EOL> if release : <EOL> return '<STR_LIT>' . format ( <EOL> dist = sanitize ( dist ) , <EOL> release = sanitize ( release ) , <EOL> arch = sanitize ( platform . machine ( ) ) , <EOL> ) <EOL> return distlib . wheel . ARCH <EOL> @ contextlib . contextmanager <EOL> def tmpdir ( ) : <EOL> """<STR_LIT>""" <EOL> tempdir = tempfile . mkdtemp ( ) <EOL> try : <EOL> yield tempdir <EOL> finally : <EOL> shutil . rmtree ( tempdir ) <EOL> def mkdirp ( path ) : <EOL> try : <EOL> os . makedirs ( path ) <EOL> except OSError : <EOL> if os . path . isdir ( path ) : <EOL> return <EOL> else : <EOL> raise </s>
