def main(): arguments = docopt(__doc__, version='1.0', options_first=True) ipa = IPAparser(arguments['<IPA>']) InfoPlist = ipa.parseInfo() # # Saving icon files # if arguments['icons']: # Old search icons = InfoPlist.get('CFBundleIconFiles', list()) for icn in icons: icon_path = ipa.findFile(icn) print icon_path ipa.saveFileTo(icon_path, "%s-%s" % (arguments['IPA'].split('/')[-1].split('.')[0], icn)) elif arguments['manifest']: display_name = InfoPlist.get('CFBundleDisplayName') bundle_id = InfoPlist.get('CFBundleIdentifier') bundle_version = InfoPlist.get('CFBundleShortVersionString') ipa_url = arguments['<IPA_URL>'] icon_url = arguments['<ICON_URL>'] manifest_path = 'manifest.plist' if arguments['<MANIFEST_FILENAME>'] is None else arguments['<MANIFEST_FILENAME>'] manifest = {'items': [{'assets': [{'url': ipa_url, 'kind': 'software-package'}, {'url': icon_url,'kind': 'display-image'}, {'url': icon_url,'kind': 'full-size-image'}], 'metadata': {'kind': 'software', 'title': display_name, 'bundle-identifier': bundle_id,'bundle-version': bundle_version}}], 'custom': 'prova_paolo' } plistlib.writePlist(manifest, manifest_path) else: key_filter = DEFAULT_KEYS if arguments['--keys']: key_filter = arguments['--keys'] if arguments['--all']: d = InfoPlist else: d = dict((k, v) for k, v in InfoPlist.items() if k in key_filter) if arguments['--out'] == 'json': out = json.dumps(d, indent=2) elif arguments['--out'] == 'text': # todo: print list as text in a nicer way out = "\n".join([str(v) for k, v in d.items()]) # todo: other formats?? else: err('Wrong output format: %s' % arguments['--out']) if arguments['FILE']: f = open(arguments['FILE'], "w") f.write(out) f.close() else: print out
def parse_ipa(ipa_path): ipa_parser = IPAparser(ipa_path) info = ipa_parser.parseInfo() bundle_id = info["CFBundleIdentifier"] version_name = info["CFBundleShortVersionString"] version_code = info["CFBundleVersion"] tmp_icon = get_icon(info, ipa_parser, ipa_path) return {"version_code": version_code, "version_name": version_name, "tmp_icon": tmp_icon, "package": bundle_id}
def __init__(self, ipaFilePath): self.__parser = IPAparser(ipaFilePath) self.__ipaInfo = self.__parser.parseInfo() self.__adhocShortVersion = self.__ipaInfo['CFBundleShortVersionString'] self.__adhocBundleIdentifier = self.__ipaInfo['CFBundleIdentifier'] self.__adhocBundleName = self.__ipaInfo['CFBundleName'] self.__ipaFileName = os.path.splitext(ipaFilePath)[0]
def parse_ipa(ipa_path, app_key): ipa_parser = IPAparser(ipa_path) info = ipa_parser.parseInfo() bundle_id = info['CFBundleIdentifier'] version_name = info['CFBundleShortVersionString'] version_code = info['CFBundleVersion'] icon_keys = filter(lambda i: 'CFBundleIcon' in i, info.keys()) if len(icon_keys): print info[icon_keys[0]] #TODO: implement icons parsing icon_dest = None # icon_dest = os.path.join(os.path.dirname(ipa_path), "%s_icon.png" % app_key) # ipa_parser.saveFileTo(icon_zip_path, icon_dest) build = Build(app_key, version_code, version_name) return {"build": build, "icon_path": icon_dest, "package": bundle_id}
class PlistMaker(object): def __init__(self, ipaFilePath): self.__parser = IPAparser(ipaFilePath) self.__ipaInfo = self.__parser.parseInfo() self.__adhocShortVersion = self.__ipaInfo['CFBundleShortVersionString'] self.__adhocBundleIdentifier = self.__ipaInfo['CFBundleIdentifier'] self.__adhocBundleName = self.__ipaInfo['CFBundleName'] self.__ipaFileName = os.path.splitext(ipaFilePath)[0] def makePlist(self, destUrlPath): t = Template(PLIST_TEMPLATE) plist = t.render(ipaUrl=urljoin(destUrlPath, self.__ipaFileName + '.ipa'), adhocBundleVersion=self.__adhocShortVersion, adhocBundleIdentifier=self.__adhocBundleIdentifier, adhocBundleName=self.__adhocBundleName) return plist
class HTMLMaker(object): def __init__(self, ipaFilePath): self.__parser = IPAparser(ipaFilePath) self.__ipaInfo = self.__parser.parseInfo() self.__adhocBundleName = self.__ipaInfo['CFBundleName'] self.__adhocShortVersion = self.__ipaInfo['CFBundleShortVersionString'] self.__adhocBundleVersion = self.__ipaInfo['CFBundleVersion'] self.__ipaFileName = os.path.splitext(ipaFilePath)[0] def makeHtml(self, destUrlPath): t = Template(HTML_TEMPLATE) html = t.render(adhocBundleName=self.__adhocBundleName, adhocShortVersion=self.__adhocShortVersion, adhocBundleVersion=self.__adhocBundleVersion, adhocPlistUrl=urljoin(destUrlPath, self.__ipaFileName + '.plist'), ) return html
def main(): arguments = docopt(__doc__, version='1.0', options_first=True) ipa = IPAparser(arguments['<IPA>']) InfoPlist = ipa.parseInfo() # # Saving icon files # if arguments['icons']: # Old search icons = InfoPlist.get('CFBundleIconFiles', list()) for icn in icons: icon_path = ipa.findFile(icn) print icon_path ipa.saveFileTo( icon_path, "%s-%s" % (arguments['IPA'].split('/')[-1].split('.')[0], icn)) elif arguments['manifest']: display_name = InfoPlist.get('CFBundleDisplayName') bundle_id = InfoPlist.get('CFBundleIdentifier') bundle_version = InfoPlist.get('CFBundleShortVersionString') ipa_url = arguments['<IPA_URL>'] icon_url = arguments['<ICON_URL>'] manifest_path = 'manifest.plist' if arguments[ '<MANIFEST_FILENAME>'] is None else arguments['<MANIFEST_FILENAME>'] manifest = { 'items': [{ 'assets': [{ 'url': ipa_url, 'kind': 'software-package' }, { 'url': icon_url, 'kind': 'display-image' }, { 'url': icon_url, 'kind': 'full-size-image' }], 'metadata': { 'kind': 'software', 'title': display_name, 'bundle-identifier': bundle_id, 'bundle-version': bundle_version } }], 'custom': 'prova_paolo' } plistlib.writePlist(manifest, manifest_path) else: key_filter = DEFAULT_KEYS if arguments['--keys']: key_filter = arguments['--keys'] if arguments['--all']: d = InfoPlist else: d = dict((k, v) for k, v in InfoPlist.items() if k in key_filter) if arguments['--out'] == 'json': out = json.dumps(d, indent=2) elif arguments['--out'] == 'text': # todo: print list as text in a nicer way out = "\n".join([str(v) for k, v in d.items()]) # todo: other formats?? else: err('Wrong output format: %s' % arguments['--out']) if arguments['FILE']: f = open(arguments['FILE'], "w") f.write(out) f.close() else: print out