[Python-modules-commits] [pyscard] 01/05: Imported Upstream version 1.9.2

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri Feb 5 23:30:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository pyscard.

commit 5655a44973d7d877fb5f2d3235d91df11f625ebd
Author: Ludovic Rousseau <rousseau at debian.org>
Date:   Fri Feb 5 22:58:38 2016 +0100

    Imported Upstream version 1.9.2
---
 ChangeLog                                          |  7 +++++++
 MANIFEST.in                                        | 19 ++++++++---------
 Makefile                                           | 21 +++++++++++++++++++
 PKG-INFO                                           |  4 ++--
 README.md                                          | 24 ++++++++++++++++++++++
 pyscard.egg-info/PKG-INFO                          |  4 ++--
 pyscard.egg-info/SOURCES.txt                       |  2 ++
 setup.py                                           |  2 +-
 smartcard/CardConnection.py                        |  6 +++++-
 smartcard/Examples/framework/sample_ATR.py         |  4 ++--
 .../framework/sample_CardConnectionDecorator.py    |  1 -
 .../framework/sample_ExclusiveCardConnection.py    |  3 ++-
 .../Examples/framework/sample_MonitorCards.py      |  6 +++---
 .../framework/sample_MonitorCardsAndTransmit.py    |  2 +-
 .../framework/sample_apduTracerInterpreter.py      |  4 ++--
 smartcard/Examples/framework/sample_toHexString.py |  8 ++++----
 smartcard/util/__init__.py                         |  2 +-
 test/test_util.py                                  |  6 ++++++
 18 files changed, 94 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a84c60e..22733ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1.9.2 (February 2016)
+       * Fix toBytes regression
+       * Fix installation using pip
+       * improve pydoc documentation
+       * user-guide.rst: use real sample codes
+       * minor improvements
+
 1.9.1 (September 2015)
 ======================
        * Create a new version so that the upload to Pypi does _not_
diff --git a/MANIFEST.in b/MANIFEST.in
index 51c32b4..3f68602 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,29 +1,28 @@
+include ACKS
+include ChangeLog
 include LICENSE
 include MANIFEST.in
+include Makefile
 include README
-include ACKS
-include ChangeLog
+include README.md
 include TODO
+include smartcard/scard/PcscDefs.i
+include smartcard/scard/PcscTypemaps.i
 include smartcard/scard/gemalto.ver
 include smartcard/scard/helpers.c
 include smartcard/scard/helpers.h
 include smartcard/scard/memlog.h
 include smartcard/scard/pcsctypes.h
-include smartcard/scard/PcscDefs.i
-include smartcard/scard/PcscTypemaps.i
 include smartcard/scard/pyscard-reader.h
 include smartcard/scard/scard.def
 include smartcard/scard/scard.i
 include smartcard/scard/scard.rc
 include smartcard/scard/winscarddll.c
 include smartcard/scard/winscarddll.h
-recursive-include smartcard/wx *.ico
-recursive-include smartcard/Examples *.txt *.py *.ico
 include smartcard/test/configcheck.py
+recursive-include smartcard/Examples *.py *.ico
+recursive-include smartcard/doc *.html *.jpg *.css *.js *.png *.txt
 recursive-include smartcard/test/framework *.txt *.py
 recursive-include smartcard/test/frameworkpcsc *.txt *.py
 recursive-include smartcard/test/scard *.txt *.py
-recursive-include smartcard/doc *.html *.jpg *.css *.js *.png *.txt
-
-
-
+recursive-include smartcard/wx *.ico
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e3a7f6f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,21 @@
+PYTHON ?= python
+
+build:
+	$(PYTHON) setup.py build
+
+clean:
+	$(PYTHON) setup.py clean
+	rm -rf build
+
+pypi: clean
+	# files generated by swig
+	rm -f smartcard/scard/scard.py
+	rm -f smartcard/scard/scard_wrap.c
+	# files generated by sphinx
+	rm -rf smartcard/doc/_build
+	$(PYTHON) setup.py sdist upload
+
+test: build
+	$(PYTHON) setup.py test
+
+.PHONY: clean build pypi test
diff --git a/PKG-INFO b/PKG-INFO
index 4c090b8..ac6168c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: pyscard
-Version: 1.9.1
+Version: 1.9.2
 Summary: Smartcard module for Python.
 Home-page: http://www.gemalto.com
 Author: Jean-Daniel Aussel
 Author-email: aussel.jean-daniel at gemalto.com
 License: GNU LESSER GENERAL PUBLIC LICENSE
-Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.1/pyscard-1.9.1.tar.gz/download
+Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.2/pyscard-1.9.2.tar.gz/download
 Description: Smartcard package for Python
 Platform: linux
 Platform: win32
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0cd3489
--- /dev/null
+++ b/README.md
@@ -0,0 +1,24 @@
+pyscard: smartcard library for python
+=====================================
+
+[pyscard](http://pyscard.sourceforge.net/) - python smart card library - is a python module adding smart
+cards support to [python](https://www.python.org/).
+
+![alt text](http://pyscard.sourceforge.net/_images/pyscard.jpg "pyscard architecture")
+
+Documentation
+-------------
+http://pyscard.sourceforge.net/user-guide.html#pyscard-user-guide
+
+Samples
+-------
+High level API samples: See http://pyscard.sourceforge.net/pyscard-framework.html#framework-samples
+Low level API samples: See http://pyscard.sourceforge.net/pyscard-wrapper.html#wrapper-samples
+
+Continuous Integration status
+-----------------------------
+Travis CI: [![Travis CI](https://travis-ci.org/LudovicRousseau/pyscard.svg "Travis CI")](https://travis-ci.org/LudovicRousseau/pyscard)
+
+AppVeyor: [![Build status](https://ci.appveyor.com/api/projects/status/c97dsaodpcwkm0ra?svg=true)](https://ci.appveyor.com/project/LudovicRousseau/pyscard)
+
+Coveralls: [![Coverage Status](https://coveralls.io/repos/LudovicRousseau/pyscard/badge.svg?branch=master&service=github)](https://coveralls.io/github/LudovicRousseau/pyscard?branch=master)
diff --git a/pyscard.egg-info/PKG-INFO b/pyscard.egg-info/PKG-INFO
index 4c090b8..ac6168c 100644
--- a/pyscard.egg-info/PKG-INFO
+++ b/pyscard.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: pyscard
-Version: 1.9.1
+Version: 1.9.2
 Summary: Smartcard module for Python.
 Home-page: http://www.gemalto.com
 Author: Jean-Daniel Aussel
 Author-email: aussel.jean-daniel at gemalto.com
 License: GNU LESSER GENERAL PUBLIC LICENSE
-Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.1/pyscard-1.9.1.tar.gz/download
+Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.2/pyscard-1.9.2.tar.gz/download
 Description: Smartcard package for Python
 Platform: linux
 Platform: win32
diff --git a/pyscard.egg-info/SOURCES.txt b/pyscard.egg-info/SOURCES.txt
index de0238a..bd86597 100644
--- a/pyscard.egg-info/SOURCES.txt
+++ b/pyscard.egg-info/SOURCES.txt
@@ -2,7 +2,9 @@ ACKS
 ChangeLog
 LICENSE
 MANIFEST.in
+Makefile
 README
+README.md
 TODO
 setup.py
 ./smartcard/ATR.py
diff --git a/setup.py b/setup.py
index b4c21c3..0787f50 100755
--- a/setup.py
+++ b/setup.py
@@ -78,7 +78,7 @@ else:
     platform_extra_link_args = []   # ['-ggdb']
 
 
-VERSION_INFO = (1, 9, 1, 0)
+VERSION_INFO = (1, 9, 2, 0)
 VERSION_STR = '%i.%i.%i' % VERSION_INFO[:3]
 VERSION_ALT = '%i,%01i,%01i,%04i' % VERSION_INFO
 
diff --git a/smartcard/CardConnection.py b/smartcard/CardConnection.py
index 15bb52b..0e488ea 100644
--- a/smartcard/CardConnection.py
+++ b/smartcard/CardConnection.py
@@ -78,7 +78,11 @@ class CardConnection(Observable):
         CardConnection.T0_protocol, CardConnection.T1_protocol,
         CardConnection.RAW_protocol, CardConnection.T15_protocol
 
-        mode: passed as-is to the PC/SC layer
+        mode: SCARD_SHARE_SHARED (default), SCARD_SHARE_EXCLUSIVE or
+        SCARD_SHARE_DIRECT
+
+        disposition: SCARD_LEAVE_CARD (default), SCARD_RESET_CARD,
+        SCARD_UNPOWER_CARD or SCARD_EJECT_CARD
         """
         Observable.setChanged(self)
         Observable.notifyObservers(self, CardConnectionEvent('connect'))
diff --git a/smartcard/Examples/framework/sample_ATR.py b/smartcard/Examples/framework/sample_ATR.py
old mode 100644
new mode 100755
index 4af20d1..2b2456a
--- a/smartcard/Examples/framework/sample_ATR.py
+++ b/smartcard/Examples/framework/sample_ATR.py
@@ -28,8 +28,8 @@ from smartcard.ATR import ATR
 from smartcard.util import toHexString
 
 atr = ATR([0x3B, 0x9E, 0x95, 0x80, 0x1F, 0xC3, 0x80, 0x31, 0xA0, 0x73,
-                 0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,
-                 0xCD, 0xB9])
+           0xBE, 0x21, 0x13, 0x67, 0x29, 0x02, 0x01, 0x01, 0x81,
+           0xCD, 0xB9])
 
 print(atr)
 print('historical bytes: ', toHexString(atr.getHistoricalBytes()))
diff --git a/smartcard/Examples/framework/sample_CardConnectionDecorator.py b/smartcard/Examples/framework/sample_CardConnectionDecorator.py
index a43a5fa..8835a5e 100755
--- a/smartcard/Examples/framework/sample_CardConnectionDecorator.py
+++ b/smartcard/Examples/framework/sample_CardConnectionDecorator.py
@@ -27,7 +27,6 @@ from __future__ import print_function
 from smartcard.CardType import AnyCardType
 from smartcard.CardRequest import CardRequest
 from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
-from smartcard.CardConnection import CardConnection
 from smartcard.CardConnectionDecorator import CardConnectionDecorator
 from smartcard.util import toHexString
 
diff --git a/smartcard/Examples/framework/sample_ExclusiveCardConnection.py b/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
index 5caa624..629b56d 100755
--- a/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
+++ b/smartcard/Examples/framework/sample_ExclusiveCardConnection.py
@@ -27,7 +27,6 @@ from __future__ import print_function
 from smartcard.CardType import AnyCardType
 from smartcard.CardRequest import CardRequest
 from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
-from smartcard.CardConnection import CardConnection
 from smartcard.util import toHexString
 
 from smartcard.ExclusiveConnectCardConnection import \
@@ -60,6 +59,7 @@ cardservice.connection.connect()
 print('ATR', toHexString(cardservice.connection.getATR()))
 
 try:
+    # lock for initiating transaction
     cardservice.connection.lock()
 
     apdu = SELECT + DF_TELECOM
@@ -69,6 +69,7 @@ try:
         apdu = GET_RESPONSE + [sw2]
         response, sw1, sw2 = cardservice.connection.transmit(apdu)
 finally:
+    # unlock connection at the end of the transaction
     cardservice.connection.unlock()
 
 import sys
diff --git a/smartcard/Examples/framework/sample_MonitorCards.py b/smartcard/Examples/framework/sample_MonitorCards.py
index fc7a079..ea1f815 100755
--- a/smartcard/Examples/framework/sample_MonitorCards.py
+++ b/smartcard/Examples/framework/sample_MonitorCards.py
@@ -28,11 +28,11 @@ from __future__ import print_function
 from time import sleep
 
 from smartcard.CardMonitoring import CardMonitor, CardObserver
-from smartcard.util import *
+from smartcard.util import toHexString
 
 
 # a simple card observer that prints inserted/removed cards
-class printobserver(CardObserver):
+class PrintObserver(CardObserver):
     """A simple card observer that is notified
     when cards are inserted/removed from the system and
     prints the list of cards
@@ -50,7 +50,7 @@ if __name__ == '__main__':
     print("This program will exit in 10 seconds")
     print("")
     cardmonitor = CardMonitor()
-    cardobserver = printobserver()
+    cardobserver = PrintObserver()
     cardmonitor.addObserver(cardobserver)
 
     sleep(10)
diff --git a/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py b/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
index 7a1bbd1..e24670e 100755
--- a/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
+++ b/smartcard/Examples/framework/sample_MonitorCardsAndTransmit.py
@@ -30,7 +30,7 @@ from time import sleep
 
 from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
 from smartcard.CardMonitoring import CardMonitor, CardObserver
-from smartcard.util import *
+from smartcard.util import toHexString
 
 # define the apdus used in this script
 GET_RESPONSE = [0XA0, 0XC0, 00, 00]
diff --git a/smartcard/Examples/framework/sample_apduTracerInterpreter.py b/smartcard/Examples/framework/sample_apduTracerInterpreter.py
index 25c19dd..d5d556d 100755
--- a/smartcard/Examples/framework/sample_apduTracerInterpreter.py
+++ b/smartcard/Examples/framework/sample_apduTracerInterpreter.py
@@ -53,8 +53,8 @@ class TracerAndSELECTInterpreter(CardConnectionObserver):
                 print('<  []', "%-2X %-2X" % tuple(ccevent.args[-2:]))
             else:
                 print('<',
-                toHexString(ccevent.args[0]),
-                "%-2X %-2X" % tuple(ccevent.args[-2:]))
+                      toHexString(ccevent.args[0]),
+                      "%-2X %-2X" % tuple(ccevent.args[-2:]))
 
 
 # define the apdus used in this script
diff --git a/smartcard/Examples/framework/sample_toHexString.py b/smartcard/Examples/framework/sample_toHexString.py
index 3cb1da5..82fe3f5 100755
--- a/smartcard/Examples/framework/sample_toHexString.py
+++ b/smartcard/Examples/framework/sample_toHexString.py
@@ -37,9 +37,9 @@ print('toHexString(bytes, PACK) =', toHexString(bytes, PACK))
 print('toHexString(bytes, HEX) =', toHexString(bytes, HEX))
 print('toHexString(bytes, HEX | COMMA) =', toHexString(bytes, HEX | COMMA))
 print('toHexString(bytes, HEX | UPPERCASE) =',
-    toHexString(bytes, HEX | UPPERCASE))
+      toHexString(bytes, HEX | UPPERCASE))
 print('toHexString(bytes, HEX | UPPERCASE | COMMA) =',
-    toHexString(bytes, HEX | UPPERCASE | COMMA))
+      toHexString(bytes, HEX | UPPERCASE | COMMA))
 
 
 print(40 * '-')
@@ -51,9 +51,9 @@ print('toHexString(bytes, PACK) =', toHexString(bytes, PACK))
 print('toHexString(bytes, HEX) =', toHexString(bytes, HEX))
 print('toHexString(bytes, HEX | COMMA) =', toHexString(bytes, HEX | COMMA))
 print('toHexString(bytes, HEX | UPPERCASE) =',
-    toHexString(bytes, HEX | UPPERCASE))
+      toHexString(bytes, HEX | UPPERCASE))
 print('toHexString(bytes, HEX | UPPERCASE | COMMA) =',
-    toHexString(bytes, HEX | UPPERCASE | COMMA))
+      toHexString(bytes, HEX | UPPERCASE | COMMA))
 
 
 import sys
diff --git a/smartcard/util/__init__.py b/smartcard/util/__init__.py
index f20cd72..242d1c3 100644
--- a/smartcard/util/__init__.py
+++ b/smartcard/util/__init__.py
@@ -97,7 +97,7 @@ def toBytes(bytestring):
     >>> toBytes("3B6500   009C1101  0103")
     [59, 101, 0, 0, 156, 17, 1, 1, 3]
     """
-    packedstring = bytestring.replace(' ', '').replace('	','')
+    packedstring = bytestring.replace(' ', '').replace('	','').replace('\n', '')
     try:
         return list(map(lambda x: int(''.join(x), 16), zip(*[iter(packedstring)] * 2)))
     except KeyError:
diff --git a/test/test_util.py b/test/test_util.py
index 6980d09..da6b5c9 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -21,6 +21,12 @@ class TestUtil(unittest.TestCase):
         data_in = "3B6500   009C1101  0103"
         self.assertEqual(toBytes(data_in), data_out)
 
+        data_in = '''
+                    3B 65 00
+                    00 9C 11 01
+                    01 03
+                  '''
+        self.assertEqual(toBytes(data_in), data_out)
 
     def test_padd(self):
         data_in = toBytes("3B 65 00 00 9C 11 01 01 03")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pyscard.git



More information about the Python-modules-commits mailing list