Unverified Commit 7b784c1f authored by Luke Granger-Brown's avatar Luke Granger-Brown Committed by GitHub
Browse files

python3Packages.emv: refactored code (#509273)

parents 9f3b0a34 003406ee
Loading
Loading
Loading
Loading
+18 −16
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchFromCodeberg,
  click,
  pyscard,
  pycountry,
@@ -10,27 +10,29 @@
  setuptools,
}:

buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "emv";
  version = "1.0.14";
  pyproject = true;

  src = fetchFromGitHub {
  src = fetchFromCodeberg {
    owner = "russss";
    repo = "python-emv";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-MnaeQZ0rA3i0CoUA6HgJQpwk5yo4rm9e+pc5XzRd1eg=";
  };

  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"
  '';
  pythonRelaxDeps = [
    "click"
    "pyscard"
    "pycountry"
    "terminaltables"
  ];

  pythonRemoveDeps = [
    "enum-compat"
    "argparse"
  ];

  build-system = [ setuptools ];

@@ -47,10 +49,10 @@ buildPythonPackage rec {

  meta = {
    description = "Implementation of the EMV chip-and-pin smartcard protocol";
    homepage = "https://github.com/russss/python-emv";
    changelog = "https://github.com/russss/python-emv/releases/tag/v${version}";
    homepage = "https://codeberg.org/russss/python-emv/";
    changelog = "https://codeberg.org/russss/python-emv/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ lukegb ];
    mainProgram = "emvtool";
  };
}
})