mediapipe/third_party/rules_apple_c0863d0596ae6b769a29fa3fb72ff036444fd249.diff

26 lines
1.2 KiB
Diff
Raw Normal View History

commit c0863d0596ae6b769a29fa3fb72ff036444fd249 (HEAD -> py3)
Author: Camillo Lugaresi <camillol@google.com>
Date: Fri Aug 16 00:13:16 2019 -0700
Fix codesigningtool.py py3 compatibility.
In recent versions of plistlib, binary data entries are returned as instances of the built-in bytes class, and plistlib.Data is deprecated.
Since this script was expecting a plistlib.Data, it would fail with the error "AttributeError: 'bytes' object has no attribute 'data'".
This change makes it compatible with both new and old versions of plistlib.
diff --git a/tools/codesigningtool/codesigningtool.py b/tools/codesigningtool/codesigningtool.py
index 59f3841..40cdcf3 100644
--- a/tools/codesigningtool/codesigningtool.py
+++ b/tools/codesigningtool/codesigningtool.py
@@ -102,7 +102,9 @@ def _certificate_fingerprint(identity):
def _get_identities_from_provisioning_profile(mpf):
"""Iterates through all the identities in a provisioning profile, lazily."""
for identity in mpf["DeveloperCertificates"]:
- yield _certificate_fingerprint(identity.data)
+ if not _PY3:
+ identity = identity.data
+ yield _certificate_fingerprint(identity)
def _find_codesign_identities(identity=None):