mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 07:20:29 +03:00
Make python3-biplist optional
This commit is contained in:
parent
e3d319f30b
commit
60371093e2
1 changed files with 20 additions and 18 deletions
|
|
@ -46,7 +46,6 @@ except ImportError:
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from biplist import readPlist
|
|
||||||
|
|
||||||
from . import _
|
from . import _
|
||||||
from . import common
|
from . import common
|
||||||
|
|
@ -555,25 +554,28 @@ def process_ipa(repodir, apks):
|
||||||
logging.error(_("Deleting unknown file: {path}").format(path=f))
|
logging.error(_("Deleting unknown file: {path}").format(path=f))
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
|
|
||||||
for f in glob.glob(os.path.join(repodir, '*.ipa')):
|
ipas = glob.glob(os.path.join(repodir, '*.ipa'))
|
||||||
ipa = {}
|
if ipas:
|
||||||
apks.append(ipa)
|
from biplist import readPlist
|
||||||
|
for f in ipas:
|
||||||
|
ipa = {}
|
||||||
|
apks.append(ipa)
|
||||||
|
|
||||||
ipa["apkName"] = os.path.basename(f)
|
ipa["apkName"] = os.path.basename(f)
|
||||||
ipa["hash"] = common.sha256sum(f)
|
ipa["hash"] = common.sha256sum(f)
|
||||||
ipa["hashType"] = "sha256"
|
ipa["hashType"] = "sha256"
|
||||||
ipa["size"] = os.path.getsize(f)
|
ipa["size"] = os.path.getsize(f)
|
||||||
|
|
||||||
with zipfile.ZipFile(f) as ipa_zip:
|
with zipfile.ZipFile(f) as ipa_zip:
|
||||||
for info in ipa_zip.infolist():
|
for info in ipa_zip.infolist():
|
||||||
if re.match("Payload/[^/]*.app/Info.plist", info.filename):
|
if re.match("Payload/[^/]*.app/Info.plist", info.filename):
|
||||||
with ipa_zip.open(info) as plist_file:
|
with ipa_zip.open(info) as plist_file:
|
||||||
plist = readPlist(plist_file)
|
plist = readPlist(plist_file)
|
||||||
ipa["packageName"] = plist["CFBundleIdentifier"]
|
ipa["packageName"] = plist["CFBundleIdentifier"]
|
||||||
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
|
# https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
|
||||||
ipa["versionCode"] = version_string_to_int(plist["CFBundleShortVersionString"])
|
ipa["versionCode"] = version_string_to_int(plist["CFBundleShortVersionString"])
|
||||||
ipa["versionName"] = plist["CFBundleShortVersionString"]
|
ipa["versionName"] = plist["CFBundleShortVersionString"]
|
||||||
ipa["usage"] = {k: v for k, v in plist.items() if 'Usage' in k}
|
ipa["usage"] = {k: v for k, v in plist.items() if 'Usage' in k}
|
||||||
|
|
||||||
|
|
||||||
def translate_per_build_anti_features(apps, apks):
|
def translate_per_build_anti_features(apps, apks):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue