[Pcsclite-git-commit] [contrib] 01/01: plist2txt.py: check the 3 arrays have the same size
Ludovic Rousseau
rousseau at moszumanska.debian.org
Wed Jan 25 16:03:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository contrib.
commit cc89afedd6ad3033bf111168d98f565ad48ec522
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Wed Jan 25 17:02:22 2017 +0100
plist2txt.py: check the 3 arrays have the same size
If the 3 arrays ifdVendorID, ifdProductID and ifdFriendlyName had
different sizes then the program did not complained.
---
plist2txt.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/plist2txt.py b/plist2txt.py
index 4304b71..672633b 100755
--- a/plist2txt.py
+++ b/plist2txt.py
@@ -23,6 +23,7 @@
# Usage:
# ./plist2txt.py /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
+from __future__ import print_function
import plistlib
import sys
@@ -32,10 +33,21 @@ def convert(filename):
root = plistlib.readPlist(filename)
# for key in root:
# print key
+
+ n_ifdVendorID = len(root['ifdVendorID'])
+ n_ifdProductID = len(root['ifdProductID'])
+ n_ifdFriendlyName = len(root['ifdFriendlyName'])
+ if n_ifdVendorID != n_ifdProductID or n_ifdVendorID != n_ifdFriendlyName:
+ print("Error: wrongs sizes")
+ print("ifdVendorID:", n_ifdVendorID)
+ print("ifdProductID:", n_ifdProductID)
+ print("ifdFriendlyName:", n_ifdFriendlyName)
+ return
+
zipped = zip(root['ifdVendorID'], root['ifdProductID'],
root['ifdFriendlyName'])
for elt in sorted(zipped):
- print ":".join(elt)
+ print(":".join(elt))
if __name__ == "__main__":
convert(sys.argv[1])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/contrib.git
More information about the Pcsclite-cvs-commit
mailing list