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

python312Packages.pyscard: 2.1.1 -> 2.2.0 #353230

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
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
53 changes: 24 additions & 29 deletions pkgs/development/python-modules/pyscard/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ in

buildPythonPackage rec {
pname = "pyscard";
version = "2.1.1";
version = "2.2.0";
pyproject = true;

src = fetchFromGitHub {
owner = "LudovicRousseau";
repo = "pyscard";
rev = "refs/tags/${version}";
hash = "sha256-wlw2QL1vfhXba8ok/URcd9M+F7Sa+ZtekV1w5X24owE=";
hash = "sha256-yZeP4Tcxnwb2My+XOsMtj+H8mNIf6JYf5tpOVUYjev0=";
};

build-system = [ setuptools ];
Expand All @@ -37,36 +37,31 @@ buildPythonPackage rec {
nativeCheckInputs = [ pytestCheckHook ];

postPatch =
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}"
'';
''
substituteInPlace pyproject.toml \
--replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]'
''
Comment on lines +40 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did make a python swig package, we could use that instead of this replace, although both will work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That package is mostly unnecessary, since pyscard only runs the swig binary to generate the bindings and does not actually depend on the python package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, that's why I made it using the replace originally

+ (
if withApplePCSC then
''
substituteInPlace src/smartcard/scard/winscarddll.c \
--replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \
"${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
''
else
''
substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG"
substituteInPlace src/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; {
meta = {
description = "Smartcard library for python";
homepage = "https://pyscard.sourceforge.io/";
changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ layus ];
license = lib.licenses.lgpl21Plus;
maintainers = with lib.maintainers; [ layus ];
};
}