#NEWLINE# def build_nsis( srcname , dstname , data ) : #NEWLINE# #INDENT# 'Build NSIS script' #NEWLINE# portable_dir = osp . join ( osp . dirname ( osp . abspath ( __file__ ) ) , 'portable' ) #NEWLINE# shutil . copy ( osp . join ( portable_dir , srcname ) , dstname ) #NEWLINE# data = ( [ ( '!addincludedir' , osp . join ( portable_dir , 'include' ) ) ] + list ( data ) ) #NEWLINE# replace_in_nsis_file ( dstname , data ) #NEWLINE# try : #NEWLINE# #INDENT# retcode = subprocess . call ( ( '"%s" -V2 "%s"' % ( NSIS_EXE , dstname ) ) , shell = True , stdout = sys . stderr ) #NEWLINE# if ( retcode < 0 ) : #NEWLINE# #INDENT# print ( 'Child was terminated by signal' , ( - retcode ) , file = sys . stderr ) #NEWLINE# #UNINDENT# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# print ( 'Execution failed:' , e , file = sys . stderr ) #NEWLINE# #UNINDENT# os . remove ( dstname )