nixpkgs/pkgs/development/python-modules/oscrypto/default.nix
Robert Schütz 1a04744f74 treewide: remove superfluous disabled
There is no need to disable Python packages for Python versions that are
no longer in Nixpkgs.
This change was generated using the following script:

    pattern='^\s*disabled\s*=\s*pythonOlder\s*"3\.\([0-9]\|10\)"\s*;\s*$'
    for f in $(find -name '*.nix'); do
        grep -q "$pattern" "$f" || continue
        sed -i "/$pattern/d" "$f"
        if [ $(grep -c pythonOlder "$f") == 1 ]; then
            sed -i '/^\s*pythonOlder,\s*$/d' "$f"
        fi
        nixfmt "$f"
    done
2026-01-11 09:34:20 -08:00

62 lines
1.5 KiB
Nix

{
lib,
stdenv,
asn1crypto,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
openssl,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "oscrypto";
version = "1.3.0";
format = "setuptools";
src = fetchFromGitHub {
owner = "wbond";
repo = "oscrypto";
rev = version;
hash = "sha256-CmDypmlc/kb6ONCUggjT1Iqd29xNSLRaGh5Hz36dvOw=";
};
patches = [
./support-openssl-3.0.10.patch
(fetchpatch {
# backport removal of imp module usage
url = "https://github.com/wbond/oscrypto/commit/3865f5d528740aa1205d16ddbee84c5b48aeb078.patch";
hash = "sha256-lQGoPM7EicwCPWapEDkqWEqMqXk4tijiImxndcDFqY4=";
})
];
postPatch = ''
for file in oscrypto/_openssl/_lib{crypto,ssl}_c{ffi,types}.py; do
substituteInPlace $file \
--replace "get_library('crypto', 'libcrypto.dylib', '42')" "'${openssl.out}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}'" \
--replace "get_library('ssl', 'libssl', '44')" "'${openssl.out}/lib/libssl${stdenv.hostPlatform.extensions.sharedLibrary}'"
done
'';
propagatedBuildInputs = [ asn1crypto ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "oscrypto" ];
doCheck = !stdenv.hostPlatform.isDarwin;
disabledTests = [
# Tests require network access
"TLSTests"
"TrustListTests"
];
meta = {
description = "Encryption library for Python";
homepage = "https://github.com/wbond/oscrypto";
license = lib.licenses.mit;
maintainers = [ ];
};
}