def generate_resource_file(target, source, env):
 src_path = str(source[0])
 new_src_path = str(target[0])
 cmd = ('xxd -i %s | sed -e "s/^unsigned char /const char RESOURCE_/g" -e "s/^unsigned int /const unsigned int RESOURCE_/g"> %s' % (src_path, new_src_path))
 p = subprocess.Popen(cmd, env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
 (stdout, stderr) = p.communicate()
 if (p.returncode or stderr):
  error = 'failed to generate resource file'
  if stderr:
   error = ((error + ': ') + stderr)
  console.error_exit(error)
 return p.returncode

def generate_resource_file ( target , source , env ) : src_path = str ( source [ 0 ] ) new_src_path = str ( target [ 0 ] ) cmd = ( 'xxd -i %s | sed -e "s/^unsigned char /const char RESOURCE_/g" -e "s/^unsigned int /const unsigned int RESOURCE_/g"> %s' % ( src_path , new_src_path ) ) p = subprocess . Popen ( cmd , env = { } , stdout = subprocess . PIPE , stderr = subprocess . PIPE , shell = True , universal_newlines = True ) ( stdout , stderr ) = p . communicate ( ) if ( p . returncode or stderr ) : error = 'failed to generate resource file' if stderr : error = ( ( error + ': ' ) + stderr ) console . error_exit ( error ) return p . returncode
generate resource source file in resource_library .