From: <lu...@us...> - 2010-03-17 14:46:21
|
Revision: 383 http://pyscard.svn.sourceforge.net/pyscard/?rev=383&view=rev Author: ludov Date: 2010-03-17 14:46:09 +0000 (Wed, 17 Mar 2010) Log Message: ----------- use regular expression to match ATR Modified Paths: -------------- trunk/contrib/parseATR/parseATR.py Modified: trunk/contrib/parseATR/parseATR.py =================================================================== --- trunk/contrib/parseATR/parseATR.py 2010-03-12 10:34:04 UTC (rev 382) +++ trunk/contrib/parseATR/parseATR.py 2010-03-17 14:46:09 UTC (rev 383) @@ -23,6 +23,7 @@ T = -1 import exceptions +import re class ParseAtrException(exceptions.Exception): @@ -735,12 +736,16 @@ atr = toHexString(normalize(atr)) file = open(atr_file) for line in file: - if line.startswith("#"): + if line.startswith("#") or line.startswith("\t") or line == "\n": continue line = line.rstrip("\n") - if line == atr: + pattern = re.compile(line) + if pattern.match(atr): # found the ATR + if atr != line: + card.append("") + card.append(line) for desc in file: if desc == "\n": break This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |