Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other cleanup #4

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
565db70
Remove support for Python releases older than 2.6
moreati Jun 19, 2015
ac3eb31
Consolidate build platform logic
moreati Jun 19, 2015
3bca937
Standardise Trove classifiers, declare OS & Python support
moreati Jun 19, 2015
119b0f2
Correct package declarations, include smartcard.pyro
moreati Jun 19, 2015
a72aa55
Switch from distutils to setuptools
moreati Jun 19, 2015
20c77ff
Add gitignore for build artefacts
moreati Jun 19, 2015
7d36645
Initial attempt at CI builds on Windows, using appveyor.com
moreati Jun 19, 2015
7b0005e
Missing comment
moreati Jun 19, 2015
88c556c
Download and install Swig in CI build
moreati Jun 19, 2015
1375471
Merge branch 'master' of github.com:moreati/pyscard
moreati Jun 20, 2015
af2c0e0
First attempt at Travis CI
moreati Jun 20, 2015
31241d9
Correct travis dependcy installation
moreati Jun 20, 2015
17feb6c
sudo helps when running apt-get
moreati Jun 20, 2015
cae9467
gitignore the config generated by the test suite
moreati Jun 22, 2015
370427c
Remove all but two uses of 'except:' & 'except Exception:'
moreati Jun 22, 2015
bedaf68
Commit convert docstring examples to doctest syntax
moreati Jun 22, 2015
7479bf1
Add default pylint config
moreati Jun 22, 2015
7b25b21
Customize pylintrc
moreati Jun 22, 2015
e1bba4b
Fix most major pylint errors and warnings
moreati Jun 22, 2015
173d961
Merge branch 'master' of github.com:LudovicRousseau/pyscard
moreati Jun 22, 2015
568d577
Consolidate Changelog, LICENSE, README etc into root dir. Delete PKG-…
moreati Jun 23, 2015
5c50b3f
Remove code supporting OS X Tiger
moreati Jun 23, 2015
fdadf6e
Reformat functions/attributes supported by `smartcard.scard` as tables
moreati Jun 23, 2015
2fb346a
Consolidate the project version in setup.py, bump to 1.7.0
moreati Jun 23, 2015
c6c442f
Merge branch 'master' of github.com:LudovicRousseau/pyscard
moreati Jun 26, 2015
2d0018b
Build Windows .exe and .msi installers
moreati Jun 28, 2015
4b639d3
README.md: Add a Continuous Integration status
LudovicRousseau Jun 26, 2015
86589a9
README.md: Add AppVeyor icon
LudovicRousseau Jun 26, 2015
907ffa2
README.md: Update travis-ci link
LudovicRousseau Jun 26, 2015
0897480
README.md: Correct Travis CI capitalisation
LudovicRousseau Jun 26, 2015
d0b7415
README.md: fix typo in Travis name
LudovicRousseau Jun 26, 2015
d552dba
configcheck.py: close file after use
LudovicRousseau Jun 27, 2015
734c8e6
Release 1.7.0
LudovicRousseau Jun 27, 2015
e30f9f8
ChangeLog: fix typos and reformat
LudovicRousseau Jun 27, 2015
cd82b30
setup.py: fix classifiers to conform to pypi
Jun 28, 2015
06a3a92
Remove support for Python releases older than 2.6
moreati Jun 19, 2015
7eee767
Consolidate build platform logic
moreati Jun 19, 2015
578da23
Standardise Trove classifiers, declare OS & Python support
moreati Jun 19, 2015
bb11fd6
Add gitignore for build artefacts
moreati Jun 19, 2015
4baa14d
Remove all but two uses of 'except:' & 'except Exception:'
moreati Jun 22, 2015
b64ec04
Fix most major pylint errors and warnings
moreati Jun 22, 2015
c9fa486
Merge branch 'master' of github.com:moreati/pyscard
moreati Jun 29, 2015
3e2f200
Revert differences to upstream@81bfc15
moreati Jun 29, 2015
b01c51d
Fix undefined variable errors found by pylint
moreati Jun 29, 2015
68f5f42
Fix missing usage of raw string
moreati Jun 29, 2015
b0f49f6
Remove no-effect loop
moreati Jun 29, 2015
9ec8fae
Fix name clash between PyroDaemonThread and threading.Thread
moreati Jun 29, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert differences to upstream@81bfc15
  • Loading branch information
moreati committed Jun 29, 2015
commit 3e2f200b54d20ba03a769acf9b442fe261043e72
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ smartcard/scard/scard_wrap.c

# Generated by test suite
smartcard/test/local_config.py

1 change: 1 addition & 0 deletions smartcard/Card.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from smartcard.Exceptions import CardConnectionException, NoCardException
from smartcard.reader.Reader import Reader
from smartcard.System import readers
from smartcard.util import toHexString
Expand Down
2 changes: 2 additions & 0 deletions smartcard/CardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"""

from smartcard.CardConnectionEvent import CardConnectionEvent
from smartcard.Exceptions import SmartcardException
from smartcard.Observer import Observer
from smartcard.Observer import Observable


Expand Down
16 changes: 13 additions & 3 deletions smartcard/CardMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from sys import exc_info
from threading import Thread, Event
from time import sleep
import traceback

from smartcard.System import readers
from smartcard.Exceptions import CardRequestTimeoutException
from smartcard.Observer import Observer
from smartcard.Observer import Observable

from smartcard.CardType import AnyCardType
from smartcard.CardRequest import CardRequest

_START_ON_DEMAND_ = False
Expand Down Expand Up @@ -183,9 +186,15 @@ def run(self):
pass
except AttributeError:
pass

except:
# FIXME Tighten the exceptions caught by this block
traceback.print_exc()
try:
import sys
print sys.exc_info()[1]
print sys.exc_info()[2]
print sys.exc_info()[0]
except:
pass

# stop the thread by signaling stopEvent
def stop(self):
Expand Down Expand Up @@ -213,6 +222,7 @@ def __getattr__(self, name):


if __name__ == "__main__":
from smartcard.CardMonitoring import CardMonitor
print 'insert or remove cards in the next 10 seconds'

# a simple card observer that prints added/removed cards
Expand Down
1 change: 1 addition & 0 deletions smartcard/CardService.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from smartcard.Exceptions import SmartcardException
from smartcard.scard import *


Expand Down
1 change: 0 additions & 1 deletion smartcard/CardType.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from smartcard.Exceptions import InvalidATRMaskLengthException
from smartcard.System import readers
from smartcard.util import toHexString

Expand Down
4 changes: 4 additions & 0 deletions smartcard/ClassLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
License: PSF license (http:https://docs.python.org/license.html).
"""

import sys
import types


def get_mod(modulePath):
"""Import a module."""
return __import__(modulePath, globals(), locals(), [''])
Expand Down
8 changes: 6 additions & 2 deletions smartcard/Examples/framework/sample_MonitorCards.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import sys
from sys import stdin, exc_info
from time import sleep

from smartcard.CardMonitoring import CardMonitor, CardObserver
Expand All @@ -44,7 +44,7 @@ def update(self, observable, (addedcards, removedcards)):
for card in removedcards:
print "-Removed: ", toHexString(card.atr)

if __name__ == '__main__':
try:
print "Insert or remove a smartcard in the system."
print "This program will exit in 10 seconds"
print ""
Expand All @@ -58,6 +58,10 @@ def update(self, observable, (addedcards, removedcards)):
# monitor will poll forever...
cardmonitor.deleteObserver(cardobserver)

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)

except:
print exc_info()[0], ':', exc_info()[1]
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import sys
from sys import stdin, exc_info
from time import sleep

from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver
Expand Down Expand Up @@ -63,7 +63,7 @@ def update(self, observable, (addedcards, removedcards)):
for card in removedcards:
print "-Removed: ", toHexString(card.atr)

if __name__ == '__main__':
try:
print "Insert or remove a SIM card in the system."
print "This program will exit in 60 seconds"
print ""
Expand All @@ -77,6 +77,10 @@ def update(self, observable, (addedcards, removedcards)):
# monitor will poll forever...
cardmonitor.deleteObserver(selectobserver)

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)

except:
print exc_info()[0], ':', exc_info()[1]
8 changes: 6 additions & 2 deletions smartcard/Examples/framework/sample_MonitorReaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import sys
from sys import stdin, exc_info
from time import sleep

from smartcard.ReaderMonitoring import ReaderMonitor, ReaderObserver
Expand All @@ -40,7 +40,7 @@ def update(self, observable, (addedreaders, removedreaders)):
print "Added readers", addedreaders
print "Removed readers", removedreaders

if __name__ == '__main__':
try:
print "Add or remove a smartcard reader to the system."
print "This program will exit in 10 seconds"
print ""
Expand All @@ -54,6 +54,10 @@ def update(self, observable, (addedreaders, removedreaders)):
# monitor will poll forever...
readermonitor.deleteObserver(readerobserver)

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)

except:
print exc_info()[0], ':', exc_info()[1]
6 changes: 5 additions & 1 deletion smartcard/Examples/framework/sample_TransmitCardObserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from sys import stdin, exc_info
from time import sleep

from smartcard.CardMonitoring import CardMonitor, CardObserver
Expand Down Expand Up @@ -56,7 +57,7 @@ def update(self, observable, (addedcards, removedcards)):
if card in self.cards:
self.cards.remove(card)

if __name__ == '__main__':
try:
print "Insert or remove a smartcard in the system."
print "This program will exit in 100 seconds"
print ""
Expand All @@ -65,3 +66,6 @@ def update(self, observable, (addedcards, removedcards)):
cardmonitor.addObserver(cardobserver)

sleep(100)

except:
print exc_info()[0], ':', exc_info()[1]
14 changes: 8 additions & 6 deletions smartcard/Examples/scard-api/sample_getATR.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import sys

from smartcard.scard import *
import smartcard.util

if __name__ == '__main__':
try:
hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
if hresult != SCARD_S_SUCCESS:
raise error(
Expand Down Expand Up @@ -88,6 +86,10 @@
SCardGetErrorMessage(hresult))
print 'Released context.'

if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
except Exception, e:
print e

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
14 changes: 8 additions & 6 deletions smartcard/Examples/scard-api/sample_getAttrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
"""

import struct
import sys

from smartcard.scard import *
import smartcard.util

Expand Down Expand Up @@ -92,7 +90,7 @@ def printAttribute(attrib, value):
print apply(struct.pack, ['<' + 'B' * len(value)] + value)


if __name__ == '__main__':
try:
hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
if hresult != SCARD_S_SUCCESS:
raise error(
Expand Down Expand Up @@ -151,6 +149,10 @@ def printAttribute(attrib, value):
SCardGetErrorMessage(hresult))
print 'Released context.'

if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
except Exception, e:
print e

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
20 changes: 10 additions & 10 deletions smartcard/Examples/scard-api/sample_listInterfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

import sys

import platform
from smartcard.scard import *
import smartcard.guid
Expand All @@ -44,7 +42,7 @@
znewcardSecGuid = \
smartcard.guid.strToGUID('{EB7F69EA-BA20-47d0-8C50-11CFDEB63BBE}')

def main():
try:
hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
if hresult != SCARD_S_SUCCESS:
raise scard.error(
Expand Down Expand Up @@ -110,13 +108,15 @@ def main():
SCardGetErrorMessage(hresult))
print 'Released context.'

except error:
import sys
print sys.exc_info()[0], ':', sys.exc_info()[1]

elif 'pcsclite' == resourceManager:
def main():
print 'SCardListInterfaces not supported by pcsc lite'
print 'SCardListInterfaces not supported by pcsc lite'


if __name__ == '__main__':
main()
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
sys.stdin.read(1)
4 changes: 4 additions & 0 deletions smartcard/Examples/simple/selectDF_TELECOM.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
except CardRequestTimeoutException:
print 'time-out: no card inserted during last 10s'

except:
import sys
print sys.exc_info()[1]

import sys
if 'win32' == sys.platform:
print 'press Enter to continue'
Expand Down
5 changes: 4 additions & 1 deletion smartcard/Examples/simple/simpleAPDU.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
0x18, 0xFF]
GET_TIME = [0x80, 0x38, 0x00, 0xA0]

if __name__ == '__main__':
try:
# get all the available readers
r = readers()
print "Available readers: ", r
Expand All @@ -51,3 +51,6 @@

data, sw1, sw2 = connection.transmit(GET_TIME)
print "Get Time: %02X %02X" % (sw1, sw2)

except:
print sys.exc_info()[1]
2 changes: 1 addition & 1 deletion smartcard/Examples/wx/pcscdiag/pcscdiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# wxPython GUI modules (http:https://www.wxpython.org)
try:
import wx
except ImportError:
except:
print 'You need wxpython (http:https://www.wxpython.org) ' + \
'to run this sample from the source code!'
print 'press a key to continue'
Expand Down
1 change: 1 addition & 0 deletions smartcard/ExclusiveConnectCardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from smartcard.CardConnection import CardConnection
from smartcard.CardConnectionDecorator import CardConnectionDecorator
from smartcard.Exceptions import CardConnectionException
from smartcard.scard import SCardConnect, SCardDisconnect
Expand Down
2 changes: 2 additions & 0 deletions smartcard/ExclusiveTransmitCardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from smartcard.CardConnection import CardConnection
from smartcard.CardConnectionDecorator import CardConnectionDecorator
from smartcard.Exceptions import CardConnectionException
from smartcard.scard import SCardBeginTransaction, SCardEndTransaction
from smartcard.scard import SCARD_LEAVE_CARD
from smartcard.scard import SCardGetErrorMessage
from smartcard.pcsc import PCSCCardConnection
import smartcard.pcsc


Expand Down
2 changes: 1 addition & 1 deletion smartcard/Observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class Observer(object):

def update(self, observable, arg):
def update(observable, arg):
'''Called when the observed object is
modified. You call an Observable object's
notifyObservers method to notify all the
Expand Down
1 change: 1 addition & 0 deletions smartcard/PassThruCardService.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def supports(cardname):
SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
DF_TELECOM = [0x7F, 0x10]
from smartcard.System import readers
from smartcard.CardConnection import CardConnection
cc = readers()[0].createConnection()
cs = PassThruCardService(cc)
cs.connection.connect()
Expand Down
Loading