2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonAtLeast,
|
|
|
|
pythonOlder,
|
|
|
|
pytest,
|
|
|
|
safe-pysha3,
|
|
|
|
pycryptodome,
|
2021-04-26 19:14:03 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "eth-hash";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "0.5.2";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2022-06-16 17:23:12 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ethereum";
|
|
|
|
repo = "eth-hash";
|
|
|
|
rev = "v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-6UN+kvLjjAtkmLgUaovjZC/6n3FZtXCwyXZH7ijQObU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs =
|
|
|
|
[ pytest ]
|
|
|
|
++ passthru.optional-dependencies.pycryptodome
|
|
|
|
# eth-hash can use either safe-pysha3 or pycryptodome;
|
|
|
|
# safe-pysha3 requires Python 3.9+ while pycryptodome does not.
|
|
|
|
# https://github.com/ethereum/eth-hash/issues/46#issuecomment-1314029211
|
|
|
|
++ lib.optional (pythonAtLeast "3.9") passthru.optional-dependencies.pysha3;
|
2021-04-26 19:14:03 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
checkPhase =
|
|
|
|
''
|
|
|
|
pytest tests/backends/pycryptodome/
|
|
|
|
''
|
|
|
|
+ lib.optionalString (pythonAtLeast "3.9") ''
|
|
|
|
pytest tests/backends/pysha3/
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
pycryptodome = [ pycryptodome ];
|
2023-05-24 13:37:59 +00:00
|
|
|
pysha3 = [ safe-pysha3 ];
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Ethereum hashing function keccak256";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ethereum/eth-hash";
|
2022-06-16 17:23:12 +00:00
|
|
|
license = licenses.mit;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|