[Python-modules-commits] [pyscard] 01/03: Imported Upstream version 1.9.3

Ludovic Rousseau rousseau at moszumanska.debian.org
Sun Mar 27 16:25:52 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 1f537488568ca44c97fd9c5be4a2a2a164aa07c5
Author: Ludovic Rousseau <rousseau at debian.org>
Date:   Sun Mar 27 17:31:50 2016 +0200

    Imported Upstream version 1.9.3
---
 ChangeLog                 |  6 ++++++
 PKG-INFO                  |  4 ++--
 pyscard.egg-info/PKG-INFO |  4 ++--
 setup.py                  | 44 ++++++++++++++++++++++++++++++++++++++++++-
 smartcard/scard/scard.i   | 48 +++++++++++++++++++++++------------------------
 5 files changed, 77 insertions(+), 29 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 22733ae..02d5b86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
+1.9.3 (March 2016)
+==================
+       * Fix SCardControl() on Windows 7
+       * Fix installation using pip and easy_install
+
 1.9.2 (February 2016)
+=====================
        * Fix toBytes regression
        * Fix installation using pip
        * improve pydoc documentation
diff --git a/PKG-INFO b/PKG-INFO
index ac6168c..eccf328 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: pyscard
-Version: 1.9.2
+Version: 1.9.3
 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.2/pyscard-1.9.2.tar.gz/download
+Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.3/pyscard-1.9.3.tar.gz/download
 Description: Smartcard package for Python
 Platform: linux
 Platform: win32
diff --git a/pyscard.egg-info/PKG-INFO b/pyscard.egg-info/PKG-INFO
index ac6168c..eccf328 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.2
+Version: 1.9.3
 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.2/pyscard-1.9.2.tar.gz/download
+Download-URL: http://sourceforge.net/projects/pyscard/files/pyscard/pyscard%201.9.3/pyscard-1.9.3.tar.gz/download
 Description: Smartcard package for Python
 Platform: linux
 Platform: win32
diff --git a/setup.py b/setup.py
index 0787f50..97f260a 100755
--- a/setup.py
+++ b/setup.py
@@ -24,9 +24,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 """
 
 from distutils.util import get_platform
+import distutils.command.install as install_orig
+import inspect
 import sys
 
 from setuptools import setup, Extension
+from setuptools.command.bdist_egg import bdist_egg
+from setuptools.command.install import install
 
 
 if sys.version_info[0:2] < (2, 6):
@@ -78,11 +82,45 @@ else:
     platform_extra_link_args = []   # ['-ggdb']
 
 
-VERSION_INFO = (1, 9, 2, 0)
+VERSION_INFO = (1, 9, 3, 0)
 VERSION_STR = '%i.%i.%i' % VERSION_INFO[:3]
 VERSION_ALT = '%i,%01i,%01i,%04i' % VERSION_INFO
 
 
+# Workaround for `pip install` and direct `setup.py install`
+class InstallBuildExtFirst(install):
+    """Workaround substitute `install` command"""
+    def run(self):
+        # Run built_ext first so that SWIG generated files are included
+        self.run_command("build_ext")
+        # Copy the rest of the logic from setuptools install so that the
+        # stack frame logic is preserved
+
+        # Explicit request for old-style install?  Just do it
+        if self.old_and_unmanageable or self.single_version_externally_managed:
+            return install_orig.install.run(self)
+
+        try:
+            have_called_from_setup = self._called_from_setup is not None
+        except AttributeError:
+            have_called_from_setup = False
+
+        if not have_called_from_setup or not self._called_from_setup(inspect.currentframe()):
+            # Run in backward-compatibility mode to support bdist_* commands.
+            install_orig.install.run(self)
+        else:
+            self.do_egg_install()
+
+
+# Workaround for `easy_install`
+class BdistEggBuildExtFirst(bdist_egg):
+    """Workaround substitute `bdist_egg` command"""
+    def run(self):
+        # Run build_ext first so that SWIG generated files are included
+        self.run_command("build_ext")
+        return bdist_egg.run(self)
+
+
 kw = {'name': "pyscard",
       'version': VERSION_STR,
       'description': "Smartcard module for Python.",
@@ -106,6 +144,10 @@ kw = {'name': "pyscard",
                          "smartcard/wx": ["resources/*.ico"],
                        },
 
+      'cmdclass': {
+          'install': InstallBuildExtFirst,
+          'bdist_egg': BdistEggBuildExtFirst,
+      },
       # the _scard.pyd extension to build
       'ext_modules': [Extension("smartcard.scard._scard",
                              define_macros=[
diff --git a/smartcard/scard/scard.i b/smartcard/scard/scard.i
index 32050b9..74c6104 100644
--- a/smartcard/scard/scard.i
+++ b/smartcard/scard/scard.i
@@ -152,7 +152,9 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 #else // !PCSCLITE
 // SCARD_CTL_CODE defined in WinSmCrd.h included by Win32 winscard.h
 // MAX_BUFFER_SIZE_EXTENDED is pcsc-lite specific
-#define MAX_BUFFER_SIZE_EXTENDED    (4 + 3 + (1<<16) + 3 + 2)
+// Windows 7 does not support more than 65544 bytes for SCardControl()
+// See https://github.com/LudovicRousseau/pyscard/issues/19
+#define MAX_BUFFER_SIZE_EXTENDED   65544 
 #endif //PCSCLITE
 
 #include "pcsctypes.h"
@@ -372,31 +374,29 @@ static SCARDRETCODE _SetAttrib(SCARDHANDLE hcard, SCARDDWORDARG dwAttrId, BYTELI
     return lRetCode;
 }
 
+///////////////////////////////////////////////////////////////////////////////
+static SCARDRETCODE _Control(
+  SCARDHANDLE hcard,
+  SCARDDWORDARG controlCode,
+  BYTELIST* pblSendBuffer,
+  BYTELIST* pblRecvBuffer
+)
+{
+    SCARDRETCODE lRet;
 
+    pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*sizeof(unsigned char));
+    pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED;
 
-    ///////////////////////////////////////////////////////////////////////////////
-    static SCARDRETCODE _Control(
-      SCARDHANDLE hcard,
-      SCARDDWORDARG controlCode,
-      BYTELIST* pblSendBuffer,
-      BYTELIST* pblRecvBuffer
-   )
-    {
-        SCARDRETCODE lRet;
-
-        pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*sizeof(unsigned char));
-        pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED;
-
-        lRet = (mySCardControl)(
-                    hcard,
-                    controlCode,
-                    pblSendBuffer->ab,
-                    pblSendBuffer->cBytes,
-                    pblRecvBuffer->ab,
-                    pblRecvBuffer->cBytes,
-                    &pblRecvBuffer->cBytes);
-        return lRet;
-    }
+    lRet = (mySCardControl)(
+                hcard,
+                controlCode,
+                pblSendBuffer->ab,
+                pblSendBuffer->cBytes,
+                pblRecvBuffer->ab,
+                pblRecvBuffer->cBytes,
+                &pblRecvBuffer->cBytes);
+    return lRet;
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 static SCARDRETCODE _BeginTransaction(SCARDHANDLE hcard)

-- 
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