示例#1
0
   lz4 = True
   leading = ''
 elif arg == '--use-preload-plugins':
   use_preload_plugins = True
   leading = ''
 elif arg.startswith('--js-output'):
   jsoutput = arg.split('=')[1] if '=' in arg else None
   leading = ''
 elif arg.startswith('--no-closure'):
   no_closure = True
   leading = ''
 elif arg.startswith('--crunch'):
   try:
     from shared import CRUNCH
   except Exception, e:
     print >> sys.stderr, 'could not import CRUNCH (make sure it is defined properly in ' + shared.hint_config_file_location() + ')'
     raise e
   crunch = arg.split('=')[1] if '=' in arg else '128'
   leading = ''
 elif arg.startswith('--plugin'):
   plugin = open(arg.split('=')[1], 'r').read()
   eval(plugin) # should append itself to plugins
   leading = ''
 elif leading == 'preload' or leading == 'embed':
   mode = leading
   uses_at_notation = '@' in arg.replace('@@', '') # '@@' in input string means there is an actual @ character, a single '@' means the 'src@dst' notation.
   arg = arg.replace('@@', '@')
   if uses_at_notation:
     srcpath, dstpath = arg.split('@') # User is specifying destination filename explicitly.
   else:
     srcpath = dstpath = arg # Use source path as destination path.
示例#2
0
     lz4 = True
     leading = ''
 elif arg == '--use-preload-plugins':
     use_preload_plugins = True
     leading = ''
 elif arg.startswith('--js-output'):
     jsoutput = arg.split('=')[1] if '=' in arg else None
     leading = ''
 elif arg.startswith('--no-closure'):
     no_closure = True
     leading = ''
 elif arg.startswith('--crunch'):
     try:
         from shared import CRUNCH
     except Exception, e:
         print >> sys.stderr, 'could not import CRUNCH (make sure it is defined properly in ' + shared.hint_config_file_location(
         ) + ')'
         raise e
     crunch = arg.split('=')[1] if '=' in arg else '128'
     leading = ''
 elif arg.startswith('--plugin'):
     plugin = open(arg.split('=')[1], 'r').read()
     eval(plugin)  # should append itself to plugins
     leading = ''
 elif leading == 'preload' or leading == 'embed':
     mode = leading
     at_position = arg.replace('@@', '__').find(
         '@'
     )  # position of @ if we're doing 'src@dst'. '__' is used to keep the index same with the original if they escaped with '@@'.
     uses_at_notation = (
         at_position != -1
     )  # '@@' in input string means there is an actual @ character, a single '@' means the 'src@dst' notation.
示例#3
0
def validate_asmjs_jsfile(filename, muteOutput):
  cmd = shared.SPIDERMONKEY_ENGINE + ['-c', filename]
  if not shared.SPIDERMONKEY_ENGINE or cmd[0] == 'js-not-found' or len(cmd[0].strip()) == 0:
    print >> sys.stderr, 'Could not find SpiderMonkey engine! Please set its location to SPIDERMONKEY_ENGINE in your ' + shared.hint_config_file_location() + ' configuration file!'
    return False
  try:
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
  except Exception, e:
    print >> sys.stderr, 'Executing command ' + str(cmd) + ' failed due to an exception: ' + str(e) + '!'
    return False