2021-06-04 09:07:49 +00:00
|
|
|
{ lib
|
2022-02-10 20:34:41 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, asn1crypto
|
2022-05-18 14:49:53 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, openssl
|
2022-05-18 14:49:53 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "oscrypto";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "1.3.0";
|
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "wbond";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
|
|
|
hash = "sha256-CmDypmlc/kb6ONCUggjT1Iqd29xNSLRaGh5Hz36dvOw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2021-06-04 09:07:49 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
asn1crypto
|
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"oscrypto"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Tests require network access
|
|
|
|
"TLSTests"
|
|
|
|
"TrustListTests"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2021-06-04 09:07:49 +00:00
|
|
|
description = "Encryption library for Python";
|
|
|
|
homepage = "https://github.com/wbond/oscrypto";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2022-05-18 14:49:53 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|