Skip to content

Commit

Permalink
Convert from DOS to Unix format
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicRousseau committed Nov 27, 2017
1 parent af88236 commit da31fdd
Show file tree
Hide file tree
Showing 9 changed files with 318 additions and 318 deletions.
104 changes: 52 additions & 52 deletions smartcard/ClassLoader.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
"""ClassLoader allows you to load modules from packages without
hard-coding their class names in code; instead, they might be
specified in a configuration file, as command-line parameters,
or within an interface.
Source: Robert Brewer at the Python Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223972
License: PSF license (http://docs.python.org/license.html).
"""


def get_mod(modulePath):
"""Import a module."""
return __import__(modulePath, globals(), locals(), [''])


def get_func(fullFuncName):
"""Retrieve a function object from a full dotted-package name."""

# Parse out the path, module, and function
lastDot = fullFuncName.rfind(u".")
funcName = fullFuncName[lastDot + 1:]
modPath = fullFuncName[:lastDot]

aMod = get_mod(modPath)
aFunc = getattr(aMod, funcName)

# Assert that the function is a *callable* attribute.
assert callable(aFunc), u"%s is not callable." % fullFuncName

# Return a reference to the function itself,
# not the results of the function.
return aFunc


def get_class(fullClassName, parentClass=None):
"""Load a module and retrieve a class (NOT an instance).
If the parentClass is supplied, className must be of parentClass
or a subclass of parentClass (or None is returned).
"""
aClass = get_func(fullClassName)

# Assert that the class is a subclass of parentClass.
if parentClass is not None:
if not issubclass(aClass, parentClass):
raise TypeError(u"%s is not a subclass of %s" %
(fullClassName, parentClass))

# Return a reference to the class itself, not an instantiated object.
return aClass
"""ClassLoader allows you to load modules from packages without
hard-coding their class names in code; instead, they might be
specified in a configuration file, as command-line parameters,
or within an interface.
Source: Robert Brewer at the Python Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223972
License: PSF license (http://docs.python.org/license.html).
"""


def get_mod(modulePath):
"""Import a module."""
return __import__(modulePath, globals(), locals(), [''])


def get_func(fullFuncName):
"""Retrieve a function object from a full dotted-package name."""

# Parse out the path, module, and function
lastDot = fullFuncName.rfind(u".")
funcName = fullFuncName[lastDot + 1:]
modPath = fullFuncName[:lastDot]

aMod = get_mod(modPath)
aFunc = getattr(aMod, funcName)

# Assert that the function is a *callable* attribute.
assert callable(aFunc), u"%s is not callable." % fullFuncName

# Return a reference to the function itself,
# not the results of the function.
return aFunc


def get_class(fullClassName, parentClass=None):
"""Load a module and retrieve a class (NOT an instance).
If the parentClass is supplied, className must be of parentClass
or a subclass of parentClass (or None is returned).
"""
aClass = get_func(fullClassName)

# Assert that the class is a subclass of parentClass.
if parentClass is not None:
if not issubclass(aClass, parentClass):
raise TypeError(u"%s is not a subclass of %s" %
(fullClassName, parentClass))

# Return a reference to the class itself, not an instantiated object.
return aClass
82 changes: 41 additions & 41 deletions smartcard/Examples/wx/apdumanager/setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#! /usr/bin/env python
"""
Setup script to build a standalone apdumanager.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/mysmartcard.ico',
ICO_SMARTCARD, ICO_READER])]


setup(windows=['apdumanager.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
#! /usr/bin/env python
"""
Setup script to build a standalone apdumanager.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/mysmartcard.ico',
ICO_SMARTCARD, ICO_READER])]


setup(windows=['apdumanager.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
80 changes: 40 additions & 40 deletions smartcard/Examples/wx/cardmonitor/setup.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
#! /usr/bin/env python
"""
Setup script to build a standalone cardmonitor.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/mysmartcard.ico',
ICO_SMARTCARD, ICO_READER])]

setup(windows=['cardmonitor.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
#! /usr/bin/env python
"""
Setup script to build a standalone cardmonitor.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/mysmartcard.ico',
ICO_SMARTCARD, ICO_READER])]

setup(windows=['cardmonitor.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
82 changes: 41 additions & 41 deletions smartcard/Examples/wx/readerviewer/setup.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
#! /usr/bin/env python
"""
Setup script to build a standalone readerviewer.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/readerviewer.ico',
ICO_SMARTCARD, ICO_READER])]


setup(windows=['readerviewer.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
#! /usr/bin/env python
"""
Setup script to build a standalone readerviewer.exe executable on windows
using py2exe. Run: python.exe setup.py py2exe, to build executable file.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

from distutils.core import setup
import py2exe

from smartcard.wx import ICO_SMARTCARD, ICO_READER

Mydata_files = [('images',
['images/readerviewer.ico',
ICO_SMARTCARD, ICO_READER])]


setup(windows=['readerviewer.py'],
data_files=Mydata_files,
options={"py2exe": {"dll_excludes": ["MSVCP90.dll"]}}
)
46 changes: 23 additions & 23 deletions smartcard/pyro/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
"""pyro (remote python) utility module.
__author__ = "http://www.gemalto.com"
Copyright 2011 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
"""pyro (remote python) utility module.
__author__ = "http://www.gemalto.com"
Copyright 2011 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""

0 comments on commit da31fdd

Please sign in to comment.