at master 1.4 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 setuptools, 6 isPyPy, 7 # nativeCheckInputs 8 pytest, 9 pytest-xdist, 10 # optional dependencies 11 pycryptodome, 12 safe-pysha3, 13}: 14 15buildPythonPackage rec { 16 pname = "eth-hash"; 17 version = "0.7.1"; 18 pyproject = true; 19 20 src = fetchFromGitHub { 21 owner = "ethereum"; 22 repo = "eth-hash"; 23 tag = "v${version}"; 24 hash = "sha256-91jWZDqrd7ZZlM0D/3sDokJ26NiAQ3gdeBebTV1Lq8s="; 25 }; 26 27 build-system = [ setuptools ]; 28 29 nativeCheckInputs = [ 30 pytest 31 pytest-xdist 32 ] 33 ++ optional-dependencies.pycryptodome 34 # safe-pysha3 is not available on pypy 35 ++ lib.optional (!isPyPy) optional-dependencies.pysha3; 36 37 # Backends need to be tested separately and can not use hook 38 checkPhase = '' 39 runHook preCheck 40 pytest tests/core tests/backends/pycryptodome 41 '' 42 + lib.optionalString (!isPyPy) '' 43 pytest tests/backends/pysha3 44 '' 45 + '' 46 runHook postCheck 47 ''; 48 49 optional-dependencies = { 50 pycryptodome = [ pycryptodome ]; 51 pysha3 = [ safe-pysha3 ]; 52 }; 53 54 meta = { 55 description = "Ethereum hashing function keccak256"; 56 homepage = "https://github.com/ethereum/eth-hash"; 57 changelog = "https://github.com/ethereum/eth-hash/blob/v${version}/docs/release_notes.rst"; 58 license = lib.licenses.mit; 59 maintainers = with lib.maintainers; [ hellwolf ]; 60 }; 61}