🏟️ add test for _parse_from_pbxproj

Also fix lint issues
This commit is contained in:
Michael Pöhn 2024-04-04 13:53:02 +02:00
parent 450765490b
commit f742799a9d
No known key found for this signature in database
GPG key ID: 725F386C05529A5A
3 changed files with 26 additions and 4 deletions

View file

@ -1762,14 +1762,14 @@ def get_public_key_from_jar(jar):
def make_altstore(apps, apks, config, repodir, indent=None):
"""
Assemble altstore-index.json for iOS (.ipa) apps.
builds index files based on:
https://faq.altstore.io/distribute-your-apps/make-a-source
https://faq.altstore.io/distribute-your-apps/updating-apps
"""
# for now alt-store support is english only
for lang in ['en']:
# prepare minimal altstore index
idx = {
'name': config['repo_name'],

View file

@ -629,7 +629,7 @@ def parse_ipa(ipa_path, file_size, sha256):
if info.filename.endswith("/embedded.mobileprovision"):
print("parsing", info.filename)
with ipa_zip.open(info) as mopro_file:
mopro_content_info = cms.ContentInfo.load(mopro_file.read())
mopro_content_info = asn1crypto.cms.ContentInfo.load(mopro_file.read())
mopro_payload_info = mopro_content_info['content']
mopro_payload = mopro_payload_info['encap_content_info']['content'].native
mopro = biplist.readPlistFromString(mopro_payload)
@ -1670,6 +1670,10 @@ def _get_ipa_icon(src_dir):
def _parse_from_pbxproj(pbxproj_path, key):
"""Parse values from apple project files.
This is a naive regex based parser. Should this proofe to unreliable we
might want to consider using a dedicated pbxproj parser:
https://pypi.org/project/pbxproj/
e.g. when looking for key 'ASSETCATALOG_COMPILER_APPICON_NAME'
This function will extract 'MyIcon' from if the provided file
contains this line: