diff --git a/pkgs/development/python-modules/emv/default.nix b/pkgs/development/python-modules/emv/default.nix index c7be7ba9e7fa..69d3a9ef910e 100644 --- a/pkgs/development/python-modules/emv/default.nix +++ b/pkgs/development/python-modules/emv/default.nix @@ -1,58 +1,59 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, click -, pyscard -, pycountry -, terminaltables -, pytestCheckHook -, pythonOlder +{ + lib, + buildPythonPackage, + fetchFromGitHub, + click, + pyscard, + pycountry, + terminaltables, + pytestCheckHook, + setuptools, + pythonOlder, }: buildPythonPackage rec { pname = "emv"; version = "1.0.14"; - format = "setuptools"; + pyproject = true; - disabled = pythonOlder "3.4"; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "russss"; repo = "python-emv"; - rev = "v${version}"; + rev = "refs/tags/v${version}"; hash = "sha256-MnaeQZ0rA3i0CoUA6HgJQpwk5yo4rm9e+pc5XzRd1eg="; }; - propagatedBuildInputs = [ + postPatch = '' + substituteInPlace setup.py \ + --replace-fail '"enum-compat==0.0.3",' "" \ + --replace-fail '"argparse==1.4.0",' "" \ + --replace-fail "click==7.1.2" "click" \ + --replace-fail "pyscard==2.0.0" "pyscard" \ + --replace-fail "pycountry==20.7.3" "pycountry" \ + --replace-fail "terminaltables==3.1.0" "terminaltables" + ''; + + build-system = [ setuptools ]; + + dependencies = [ click pyscard pycountry terminaltables ]; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; - postPatch = '' - substituteInPlace setup.py \ - --replace '"enum-compat==0.0.3",' "" \ - --replace '"argparse==1.4.0",' "" \ - --replace "click==7.1.2" "click" \ - --replace "pyscard==2.0.0" "pyscard" \ - --replace "pycountry==20.7.3" "pycountry" \ - --replace "terminaltables==3.1.0" "terminaltables" - ''; - - pythonImportsCheck = [ - "emv" - ]; + pythonImportsCheck = [ "emv" ]; meta = with lib; { description = "Implementation of the EMV chip-and-pin smartcard protocol"; - mainProgram = "emvtool"; homepage = "https://github.com/russss/python-emv"; + changelog = "https://github.com/russss/python-emv/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ lukegb ]; + mainProgram = "emvtool"; }; } diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix index 5fa9e60ae5c6..3fd9d3c2fbd4 100644 --- a/pkgs/development/python-modules/pyscard/default.nix +++ b/pkgs/development/python-modules/pyscard/default.nix @@ -1,13 +1,14 @@ -{ lib -, stdenv -, fetchFromGitHub -, buildPythonPackage -, setuptools -, pkg-config -, swig -, pcsclite -, PCSC -, pytestCheckHook +{ + lib, + buildPythonPackage, + fetchFromGitHub, + PCSC, + pcsclite, + pkg-config, + pytestCheckHook, + setuptools, + stdenv, + swig, }: let @@ -16,8 +17,8 @@ let in buildPythonPackage rec { - version = "2.0.9"; pname = "pyscard"; + version = "2.0.9"; pyproject = true; src = fetchFromGitHub { @@ -27,40 +28,45 @@ buildPythonPackage rec { hash = "sha256-DO4Ea+mlrWPpOLI8Eki+03UnsOXEhN2PAl0+gdN5sTo="; }; - nativeBuildInputs = [ - setuptools - swig - ] ++ lib.optionals (!withApplePCSC) [ - pkg-config - ]; + build-system = [ setuptools ]; + + nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config ]; buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; postPatch = - if withApplePCSC then '' - substituteInPlace smartcard/scard/winscarddll.c \ - --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \ - "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" - '' else '' - substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" - substituteInPlace smartcard/scard/winscarddll.c \ - --replace "libpcsclite.so.1" \ - "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" - ''; + if withApplePCSC then + '' + substituteInPlace smartcard/scard/winscarddll.c \ + --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ + "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" + '' + else + '' + substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" + substituteInPlace smartcard/scard/winscarddll.c \ + --replace-fail "libpcsclite.so.1" \ + "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" + ''; preCheck = '' # remove src module, so tests use the installed module instead rm -r smartcard ''; + disabledTests = [ + # AssertionError + "test_hresult" + "test_low_level" + ]; + meta = with lib; { - homepage = "https://pyscard.sourceforge.io/"; description = "Smartcard library for python"; - license = licenses.lgpl21; + homepage = "https://pyscard.sourceforge.io/"; + changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}"; + license = licenses.lgpl21Plus; maintainers = with maintainers; [ layus ]; }; }