python3Packages.pyscard: clean up apple_sdk stubs

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka
2025-04-17 21:43:56 -04:00
parent bda426255c
commit d4ef6cf4b9
2 changed files with 9 additions and 26 deletions

View File

@@ -2,7 +2,6 @@
lib,
buildPythonPackage,
fetchFromGitHub,
PCSC,
pcsclite,
pkg-config,
pytestCheckHook,
@@ -11,11 +10,6 @@
swig,
}:
let
# Package does not support configuring the pcsc library.
withApplePCSC = stdenv.hostPlatform.isDarwin;
in
buildPythonPackage rec {
pname = "pyscard";
version = "2.2.1";
@@ -30,9 +24,9 @@ buildPythonPackage rec {
build-system = [ setuptools ];
nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config ];
nativeBuildInputs = [ swig ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pkg-config ];
buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ pcsclite ];
nativeCheckInputs = [ pytestCheckHook ];
@@ -41,21 +35,12 @@ buildPythonPackage rec {
substituteInPlace pyproject.toml \
--replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]'
''
+ (
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}"
''
);
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
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}"
'';
meta = {
description = "Smartcard library for python";

View File

@@ -13200,9 +13200,7 @@ self: super: with self; {
pyscaffoldext-travis = callPackage ../development/python-modules/pyscaffoldext-travis { };
pyscard = callPackage ../development/python-modules/pyscard {
inherit (pkgs.darwin.apple_sdk.frameworks) PCSC;
};
pyscard = callPackage ../development/python-modules/pyscard { };
pyscf = callPackage ../development/python-modules/pyscf { };