#NEWLINE# def main( ) : #NEWLINE# #INDENT# if ( os . path . exists ( DEST_PATH ) and os . path . isfile ( DEST_PATH ) and os . access ( DEST_PATH , os . X_OK ) ) : #NEWLINE# #INDENT# print ( 'Already installed!' ) #NEWLINE# return 0 #NEWLINE# #UNINDENT# shutil . rmtree ( DEST_DIR , ignore_errors = True ) #NEWLINE# os . makedirs ( DEST_DIR , exist_ok = True ) #NEWLINE# contents = io . BytesIO ( urlopen ( DOWNLOAD_PATH ) . read ( ) ) #NEWLINE# with tarfile . open ( fileobj = contents ) as tar : #NEWLINE# #INDENT# with tar . extractfile ( PATH_IN_TAR ) as src_file : #NEWLINE# #INDENT# with open ( DEST_PATH , 'wb' ) as dest_file : #NEWLINE# #INDENT# shutil . copyfileobj ( src_file , dest_file ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# os . chmod ( DEST_PATH , 493 )