Beispiel #1
0
def ParseManifest(options):
    parser = ManifestJsonParser(os.path.expanduser(options.manifest))
    if not options.package:
        options.package = 'org.xwalk.' + parser.GetAppName().lower()
    if not options.name:
        options.name = parser.GetAppName()
    if not options.app_version:
        options.app_version = parser.GetVersion()
    if parser.GetDescription():
        options.description = parser.GetDescription()
    if parser.GetPermissions():
        options.permissions = parser.GetPermissions()
    if parser.GetAppUrl():
        options.app_url = parser.GetAppUrl()
    if parser.GetAppRoot():
        options.app_root = parser.GetAppRoot()
        temp_dict = parser.GetIcons()
        try:
            icon_dict = dict((int(k), v) for k, v in temp_dict.iteritems())
        except ValueError:
            print 'The key of icon in the manifest file should be a number.'
        # TODO(junmin): add multiple icons support.
        if icon_dict:
            icon_file = max(icon_dict.iteritems(),
                            key=operator.itemgetter(0))[1]
            options.icon = os.path.join(options.app_root, icon_file)
    if parser.GetAppLocalPath():
        options.app_local_path = parser.GetAppLocalPath()
    options.enable_remote_debugging = False
    if parser.GetFullScreenFlag().lower() == 'true':
        options.fullscreen = True
    elif parser.GetFullScreenFlag().lower() == 'false':
        options.fullscreen = False
Beispiel #2
0
def ParseManifest(options):
    parser = ManifestJsonParser(os.path.expanduser(options.manifest))
    if not options.name:
        options.name = parser.GetAppName()
    if not options.app_version:
        options.app_version = parser.GetVersion()
    if parser.GetDescription():
        options.description = parser.GetDescription()
    if parser.GetPermissions():
        options.permissions = parser.GetPermissions()
    if parser.GetAppUrl():
        options.app_url = parser.GetAppUrl()
    elif parser.GetAppLocalPath():
        options.app_local_path = parser.GetAppLocalPath()
    else:
        print('Error: there is no app launch path defined in manifest.json.')
        sys.exit(9)
    options.icon_dict = {}
    if parser.GetAppRoot():
        options.app_root = parser.GetAppRoot()
        options.icon_dict = parser.GetIcons()
    if parser.GetOrientation():
        options.orientation = parser.GetOrientation()
    if parser.GetFullScreenFlag().lower() == 'true':
        options.fullscreen = True
    elif parser.GetFullScreenFlag().lower() == 'false':
        options.fullscreen = False
    return parser
Beispiel #3
0
def ParseManifest(options):
  parser = ManifestJsonParser(os.path.expanduser(options.manifest))
  app_name = parser.GetAppName()
  if options.package:
    VerifyAppName(options.package, 'packagename')
  else:
    VerifyAppName(app_name)
    options.package = 'org.xwalk.' + app_name.lower()
  if options.name:
    VerifyAppName(options.name)
  else:
    VerifyAppName(app_name)
    options.name = app_name
  if not options.app_version:
    options.app_version = parser.GetVersion()
  if not options.app_versionCode and not options.app_versionCodeBase:
    options.app_versionCode = 1
  if parser.GetDescription():
    options.description = parser.GetDescription()
  if parser.GetPermissions():
    options.permissions = parser.GetPermissions()
  if parser.GetAppUrl():
    options.app_url = parser.GetAppUrl()
  elif parser.GetAppLocalPath():
    options.app_local_path = parser.GetAppLocalPath()
  else:
    print('Error: there is no app launch path defined in manifest.json.')
    sys.exit(9)
  if parser.GetAppRoot():
    options.app_root = parser.GetAppRoot()
    options.icon_dict = parser.GetIcons()
  if parser.GetFullScreenFlag().lower() == 'true':
    options.fullscreen = True
  elif parser.GetFullScreenFlag().lower() == 'false':
    options.fullscreen = False
Beispiel #4
0
def ParseManifest(options):
  parser = ManifestJsonParser(os.path.expanduser(options.manifest))
  if not options.package:
    options.package = 'org.xwalk.' + parser.GetAppName().lower()
  if not options.name:
    options.name = parser.GetAppName()
  if not options.app_version:
    options.app_version = parser.GetVersion()
  if not options.app_versionCode and not options.app_versionCodeBase:
    options.app_versionCode = 1
  if parser.GetDescription():
    options.description = parser.GetDescription()
  if parser.GetPermissions():
    options.permissions = parser.GetPermissions()
  if parser.GetAppUrl():
    options.app_url = parser.GetAppUrl()
  elif parser.GetAppLocalPath():
    options.app_local_path = parser.GetAppLocalPath()
  else:
    print('Error: there is no app launch path defined in manifest.json.')
    sys.exit(9)
  if parser.GetAppRoot():
    options.app_root = parser.GetAppRoot()
    temp_dict = parser.GetIcons()
    try:
      icon_dict = dict((int(k), v) for k, v in temp_dict.items())
    except ValueError:
      print('The key of icon in the manifest file should be a number.')
    # TODO(junmin): add multiple icons support.
    if icon_dict:
      icon_file = max(iter(icon_dict.items()), key=operator.itemgetter(0))[1]
      options.icon = os.path.join(options.app_root, icon_file)
  if parser.GetFullScreenFlag().lower() == 'true':
    options.fullscreen = True
  elif parser.GetFullScreenFlag().lower() == 'false':
    options.fullscreen = False
  if parser.GetLaunchScreenImg():
    options.launch_screen_img  = os.path.join(options.app_root,
                                              parser.GetLaunchScreenImg())