#NEWLINE# def compile( self , name , modules , opt = False , threads = False , defines = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# path = self . get_path ( ) #NEWLINE# filename = ( '%s.c' % name ) #NEWLINE# shutil . copy ( os . path . join ( local_dir , filename ) , path ) #NEWLINE# shutil . copy ( os . path . join ( local_dir , 'thread-test.h' ) , path ) #NEWLINE# import distutils.ccompiler #NEWLINE# curdir = os . getcwd ( ) #NEWLINE# try : #NEWLINE# #INDENT# os . chdir ( self . get_path ( ) ) #NEWLINE# c = distutils . ccompiler . new_compiler ( ) #NEWLINE# print ( ( 'compiling %s with %r' % ( name , modules ) ) ) #NEWLINE# extra_preargs = [ ] #NEWLINE# debug = True #NEWLINE# if ( sys . platform == 'win32' ) : #NEWLINE# #INDENT# libfiles = [ ] #NEWLINE# for m in modules : #NEWLINE# #INDENT# m = os . path . basename ( m ) #NEWLINE# assert m . endswith ( '.dll' ) #NEWLINE# libfiles . append ( ( 'Release\\%s.lib' % m [ : ( - 4 ) ] ) ) #NEWLINE# #UNINDENT# modules = libfiles #NEWLINE# extra_preargs . append ( '/MANIFEST' ) #NEWLINE# debug = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if threads : #NEWLINE# #INDENT# extra_preargs . append ( '-pthread' ) #NEWLINE# #UNINDENT# #UNINDENT# objects = c . compile ( [ filename ] , macros = sorted ( defines . items ( ) ) , debug = debug ) #NEWLINE# c . link_executable ( ( objects + modules ) , name , extra_preargs = filename ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# os . chdir ( curdir )