示例#1
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
示例#2
0
def ParseManifest(options, app_info):
    parser = ManifestJsonParser(os.path.expanduser(options.manifest))
    original_name = app_info.original_name = parser.GetAppName()
    app_name = None
    if options.package:
        VerifyAppName(options.package, 'packagename')
    else:
        VerifyAppName(original_name)
        app_name = ReplaceSpaceWithUnderscore(original_name)
        options.package = 'org.xwalk.' + app_name.lower()
    if options.name:
        VerifyAppName(options.name)
        app_info.original_name = options.name
        options.name = ReplaceSpaceWithUnderscore(options.name)
    else:
        VerifyAppName(original_name)
        options.name = ReplaceSpaceWithUnderscore(original_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.GetOrientation():
        options.orientation = parser.GetOrientation()
    if parser.GetFullScreenFlag().lower() == 'true':
        options.fullscreen = True
    elif parser.GetFullScreenFlag().lower() == 'false':
        options.fullscreen = False