<s> """<STR_LIT>""" <EOL> import subprocess <EOL> import os <EOL> import platform <EOL> import tarfile <EOL> import zipfile <EOL> import textwrap <EOL> os_type = platform . system ( ) <EOL> def get_spec ( ) : <EOL> gui_data = [ <EOL> ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ] <EOL> bin_ext = "<STR_LIT>" <EOL> if os_type == "<STR_LIT>" : <EOL> bin_ext = "<STR_LIT>" <EOL> return textwrap . dedent ( """<STR_LIT>""" . rstrip ( ) ) % { <EOL> "<STR_LIT>" : gui_data , <EOL> "<STR_LIT>" : bin_ext , <EOL> } <EOL> def init_environ ( ) : <EOL> if os_type == "<STR_LIT>" : <EOL> os . environ [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> if os_type == "<STR_LIT>" : <EOL> os . environ [ "<STR_LIT>" ] = os . environ . get ( "<STR_LIT>" , "<STR_LIT>" ) + "<STR_LIT>" <EOL> def get_version ( ) : <EOL> try : <EOL> version = subprocess . check_output ( "<STR_LIT>" , shell = True ) <EOL> version = version . strip ( ) [ <NUM_LIT:1> : ] <EOL> except : <EOL> version = "<STR_LIT>" <EOL> return version <EOL> def build ( version ) : <EOL> print "<STR_LIT>" % version <EOL> file ( "<STR_LIT>" , "<STR_LIT:w>" ) . write ( get_spec ( ) ) <EOL> pyinstaller = os . path . join ( "<STR_LIT:..>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> comp = subprocess . Popen ( "<STR_LIT>" % pyinstaller , shell = True ) <EOL> comp . wait ( ) <EOL> os . unlink ( "<STR_LIT>" ) <EOL> def package ( version ) : <EOL> print "<STR_LIT>" % os_type <EOL> os . chdir ( "<STR_LIT>" ) <EOL> if os_type == "<STR_LIT>" : <EOL> tar = tarfile . open ( "<STR_LIT>" % version , "<STR_LIT>" ) <EOL> tar . add ( "<STR_LIT>" ) <EOL> tar . close ( ) <EOL> tar = tarfile . open ( "<STR_LIT>" % version , "<STR_LIT>" ) <EOL> tar . add ( "<STR_LIT>" ) <EOL> tar . close ( ) <EOL> if os_type == "<STR_LIT>" : <EOL> zip = zipfile . ZipFile ( "<STR_LIT>" % version , "<STR_LIT:w>" ) <EOL> zip . write ( "<STR_LIT>" ) <EOL> zip . close ( ) <EOL> zip = zipfile . ZipFile ( "<STR_LIT>" % version , "<STR_LIT:w>" ) <EOL> zip . write ( "<STR_LIT>" ) <EOL> zip . close ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> init_environ ( ) <EOL> version = get_version ( ) <EOL> build ( version ) <EOL> package ( version ) </s>
