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
Fix most major pylint errors and warnings
5 undefined variables remain unfixed, they appear to be missing
`smartcard.scard.scard` exports
```
************* Module smartcard.pcsc.PCSCReader
E: 67,22: Undefined variable 'SCardIntroduceReader' (undefined-variable)
E: 70,22: Undefined variable 'SCardAddReaderToGroup' (undefined-
variable)
E: 85,22: Undefined variable 'SCardRemoveReaderFromGroup' (undefined-
variable)
************* Module smartcard.pcsc.PCSCReaderGroups
E: 66,22: Undefined variable 'SCardIntroduceReaderGroup' (undefined-
variable)
E: 90,22: Undefined variable 'SCardForgetReaderGroup' (undefined-
variable)
```
  • Loading branch information
moreati committed Jun 22, 2015
commit e1bba4b5cc6c700dc52f15078b559eb49df161ba
1 change: 0 additions & 1 deletion smartcard/Card.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 CardConnectionException, NoCardException
from smartcard.reader.Reader import Reader
from smartcard.System import readers
from smartcard.util import toHexString
Expand Down
2 changes: 0 additions & 2 deletions smartcard/CardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
"""

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


Expand Down
4 changes: 0 additions & 4 deletions smartcard/CardMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
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 @@ -216,7 +213,6 @@ 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: 0 additions & 1 deletion smartcard/CardService.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
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: 1 addition & 0 deletions smartcard/CardType.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 InvalidATRMaskLengthException
from smartcard.System import readers
from smartcard.util import toHexString

Expand Down
4 changes: 0 additions & 4 deletions smartcard/ClassLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
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
1 change: 0 additions & 1 deletion smartcard/ExclusiveConnectCardConnection.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.CardConnection import CardConnection
from smartcard.CardConnectionDecorator import CardConnectionDecorator
from smartcard.Exceptions import CardConnectionException
from smartcard.scard import SCardConnect, SCardDisconnect
Expand Down
2 changes: 0 additions & 2 deletions smartcard/ExclusiveTransmitCardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
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(observable, arg):
def update(self, 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: 0 additions & 1 deletion smartcard/PassThruCardService.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ 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
4 changes: 1 addition & 3 deletions smartcard/ReaderMonitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from threading import Thread, Event, enumerate
from threading import Thread, Event
from time import sleep
import traceback

import smartcard.System
from smartcard.Exceptions import ListReadersException
from smartcard.Observer import Observer
from smartcard.Observer import Observable
from smartcard.Synchronization import *
Expand Down Expand Up @@ -196,7 +195,6 @@ def stop(self):
self.join()

if __name__ == "__main__":
from smartcard.ReaderMonitoring import ReaderMonitor
print 'insert or remove readers in the next 20 seconds'

# a simple reader observer that prints added/removed readers
Expand Down
6 changes: 0 additions & 6 deletions smartcard/Session.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"""

from smartcard.Exceptions import InvalidReaderException, NoReadersException
from smartcard.CardConnection import CardConnection
from smartcard.PassThruCardService import PassThruCardService
from smartcard.System import readers

Expand Down Expand Up @@ -110,8 +109,3 @@ def getATR(self):
def __repr__(self):
"""Returns a string representation of the session."""
return "<Session instance: readerName=%s>" % self.readerName


if __name__ == '__main__':
"""Small sample illustrating the use of Session.py."""
pass
1 change: 0 additions & 1 deletion smartcard/guid.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def GUIDToStr(g):

if __name__ == "__main__":
"""Small sample illustrating the use of guid.py."""
import smartcard.guid
dummycardguid1 = strToGUID('{AD4F1667-EA75-4124-84D4-641B3B197C65}')
print dummycardguid1
print GUIDToStr(dummycardguid1)
5 changes: 2 additions & 3 deletions smartcard/pcsc/PCSCCardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from smartcard.CardConnection import CardConnection
from smartcard.Exceptions import (CardConnectionException,
NoCardException, SmartcardException)
from smartcard.Observer import Observable

from smartcard.scard import *

Expand Down Expand Up @@ -240,8 +239,8 @@ def doGetAttrib(self, attribId):
"""Small sample illustrating the use of CardConnection."""
SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
DF_TELECOM = [0x7F, 0x10]
from smartcard.pcsc.PCSCReader import readers
cc = readers()[0].createConnection()
from smartcard.pcsc.PCSCReader import PCSCReader
cc = PCSCReader.readers()[0].createConnection()
cc.connect()
print "%r %x %x" % cc.transmit(SELECT + DF_TELECOM)

Expand Down
4 changes: 2 additions & 2 deletions smartcard/pcsc/PCSCPart10.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def getTlvProperties(cardConnection, featureList=None, controlCode=None):

if __name__ == '__main__':
"""Small sample illustrating the use of PCSCPart10."""
from smartcard.pcsc.PCSCReader import readers
cc = readers()[0].createConnection()
from smartcard.pcsc.PCSCReader import PCSCReader
cc = PCSCReader.readers()[0].createConnection()
cc.connect(mode=SCARD_SHARE_DIRECT)

#print cc.control( CM_IOCTL_GET_FEATURE_REQUEST )
Expand Down
3 changes: 1 addition & 2 deletions smartcard/pyro/PyroReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
import Pyro.core
import Pyro.naming

from smartcard.Exceptions import CardConnectionException, NoCardException
from smartcard.Exceptions import NoCardException
from smartcard.reader.Reader import Reader
from smartcard.reader.ReaderFactory import ReaderFactory


class PyroReader(Reader):
Expand Down
4 changes: 2 additions & 2 deletions smartcard/pyro/server/PyroDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def __init__(self):
Thread.__init__(self)
self.setDaemon(True)
self.setName('smartcard.pyro.server.PyroDaemonThread')
self.daemon = PyroDaemon()
self._daemon = PyroDaemon()

def run(self):
"""Starts Pyro daemon."""
self.daemon.start()
self._daemon.start()
1 change: 0 additions & 1 deletion smartcard/pyro/server/PyroEventServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def __call__(self, signame, sf):


if __name__ == '__main__':
import sys
from smartcard.pyro.server.PyroNameServer import PyroNameServer
pn = PyroNameServer(sys.argv[1:])
pn.start()
Expand Down
3 changes: 0 additions & 3 deletions smartcard/pyro/server/RemoteCardConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import Pyro.core
import Pyro.naming

from smartcard.CardConnection import CardConnection
from smartcard.CardConnectionDecorator import CardConnectionDecorator
from smartcard.Exceptions import CardConnectionException, NoCardException
from smartcard.Observer import Observable


class RemoteCardConnection(CardConnectionDecorator, Pyro.core.ObjBase):
Expand Down
4 changes: 0 additions & 4 deletions smartcard/pyro/server/RemoteReaderServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
import sys
sys.exit()

import signal
import time

import smartcard.System
from smartcard.reader.Reader import Reader
from smartcard.ReaderMonitoring import ReaderMonitor, ReaderObserver
from smartcard.pyro.server.RemoteCardConnection import RemoteCardConnection
Expand Down
3 changes: 0 additions & 3 deletions smartcard/reader/ReaderGroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ def __onremoveitem__(self, item):
def __iter__(self):
return ulist.__iter__(self)

def next(self):
return ulist.__next__(self)

#
# abstract methods implemented in subclasses
#
Expand Down
2 changes: 1 addition & 1 deletion smartcard/sw/ErrorChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ErrorChecker(object):
pattern.
"""

def __call__(data, sw1, sw2):
def __call__(self, data, sw1, sw2):
"""Called to test data, sw1 and sw2 for error.

@param data: apdu response data
Expand Down
5 changes: 1 addition & 4 deletions smartcard/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def toBytes(bytestring):
"""
import struct
import re
packedstring = ''.join(re.split('\W+', bytestring))
packedstring = ''.join(re.split(r'\W+', bytestring))
try:
return reduce(lambda x, y: x + [int(y, 16)],
struct.unpack('2s' * (len(packedstring) / 2),
Expand Down Expand Up @@ -204,9 +204,6 @@ def toHexString(bytes=[], format=0):

from string import rstrip

for byte in tuple(bytes):
pass

if type(bytes) is not list:
raise TypeError('not a list of bytes')

Expand Down
2 changes: 1 addition & 1 deletion smartcard/wx/APDUHexValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def Clone(self):

def Validate(self, win):
tc = self.GetWindow()
val = tc.GetValue()
value = tc.GetValue()

if not apduregexp.match(value):
return False
Expand Down
4 changes: 2 additions & 2 deletions smartcard/wx/CardAndReaderTreePanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ def __init__(self, parent, appstyle, clientpanel):
def OnDestroy(self, event):
"""Called on panel destruction."""
# deregister observers
if hasattr(self, cardmonitor):
if hasattr(self, 'cardmonitor'):
self.cardmonitor.deleteObserver(self.cardtreecardobserver)
if hasattr(self, readermonitor):
if hasattr(self, 'readermonitor'):
self.readermonitor.deleteObserver(self.readertreereaderobserver)
self.cardmonitor.deleteObserver(self.readertreecardobserver)
event.Skip()
4 changes: 2 additions & 2 deletions smartcard/wx/ReaderToolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def __init__(self, parent):
bmpReader = wx.Bitmap(ICO_READER, wx.BITMAP_TYPE_ICO)
else:
bmpReader = wx.ArtProvider_GetBitmap(
wx.ART_HELP_BOOK, wx.ART_OTHER, isz)
wx.ART_HELP_BOOK, wx.ART_OTHER, tsize)
if None != ICO_SMARTCARD:
bmpCard = wx.Bitmap(ICO_SMARTCARD, wx.BITMAP_TYPE_ICO)
else:
bmpCard = wx.ArtProvider_GetBitmap(
wx.ART_HELP_BOOK, wx.ART_OTHER, isz)
wx.ART_HELP_BOOK, wx.ART_OTHER, tsize)
self.readercombobox = ReaderComboBox(self)

# create and add controls
Expand Down
7 changes: 4 additions & 3 deletions smartcard/wx/SimpleSCardAppFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@

import os.path
import wx

import smartcard.wx
import APDUTracerPanel
import CardAndReaderTreePanel
import ReaderToolbar
from smartcard.wx import APDUTracerPanel
from smartcard.wx import CardAndReaderTreePanel
from smartcard.wx import ReaderToolbar

import smartcard
from smartcard.wx.SimpleSCardAppEventObserver import \
Expand Down