Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / oscrypto / default.nix
blob92edbdf84eb9e955ed1cac8ceff28eb653f04c16
1 { lib
2 , stdenv
3 , asn1crypto
4 , buildPythonPackage
5 , fetchFromGitHub
6 , openssl
7 , pytestCheckHook
8 , pythonOlder
9 }:
11 buildPythonPackage rec {
12   pname = "oscrypto";
13   version = "1.3.0";
14   format = "setuptools";
16   disabled = pythonOlder "3.7";
18   src = fetchFromGitHub {
19     owner = "wbond";
20     repo = pname;
21     rev = version;
22     hash = "sha256-CmDypmlc/kb6ONCUggjT1Iqd29xNSLRaGh5Hz36dvOw=";
23   };
25   patches = [
26     ./support-openssl-3.0.10.patch
27   ];
29   postPatch = ''
30     for file in oscrypto/_openssl/_lib{crypto,ssl}_c{ffi,types}.py; do
31       substituteInPlace $file \
32         --replace "get_library('crypto', 'libcrypto.dylib', '42')" "'${openssl.out}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}'" \
33         --replace "get_library('ssl', 'libssl', '44')" "'${openssl.out}/lib/libssl${stdenv.hostPlatform.extensions.sharedLibrary}'"
34     done
35   '';
37   propagatedBuildInputs = [
38     asn1crypto
39   ];
41   nativeCheckInputs = [
42     pytestCheckHook
43   ];
45   pythonImportsCheck = [
46     "oscrypto"
47   ];
49   doCheck = !stdenv.isDarwin;
51   disabledTests = [
52     # Tests require network access
53     "TLSTests"
54     "TrustListTests"
55   ];
57   meta = with lib; {
58     description = "Encryption library for Python";
59     homepage = "https://github.com/wbond/oscrypto";
60     license = licenses.mit;
61     maintainers = with maintainers; [ ];
62   };