1{ lib, fetchPypi, buildPythonPackage, pythonOlder, pytest, pysha3, pycrypto
2, pycryptodome
3}:
4
5buildPythonPackage rec {
6 pname = "eth-hash";
7 version = "0.3.2";
8
9 src = fetchPypi {
10 inherit pname version;
11 sha256 = "3f40cecd5ead88184aa9550afc19d057f103728108c5102f592f8415949b5a76";
12 };
13
14 checkInputs = [ pytest ];
15
16 propagatedBuildInputs = [
17 pysha3
18 pycrypto
19 pycryptodome
20 ];
21
22 pipInstallFlags = [
23 # Circular dependency on eth-utils
24 "--no-dependencies"
25 ];
26
27 # setuptools-markdown uses pypandoc which is broken at the moment
28 preConfigure = ''
29 substituteInPlace setup.py --replace \'setuptools-markdown\' ""
30 '';
31
32 # Run tests separately because we don't want to run tests on tests/backends/
33 # but only on its selected subdirectories. Also, the directories under
34 # tests/backends/ must be run separately because they have identically named
35 # test files so pytest would raise errors because of that.
36 #
37 # Also, tests in tests/core/test_import.py are broken so just ignore them:
38 # https://github.com/ethereum/eth-hash/issues/25
39 # There is a pull request to fix the tests:
40 # https://github.com/ethereum/eth-hash/pull/26
41 checkPhase = ''
42 pytest tests/backends/pycryptodome/
43 pytest tests/backends/pysha3/
44 # pytest tests/core/
45 '';
46
47 disabled = pythonOlder "3.5";
48
49 meta = {
50 description = "The Ethereum hashing function keccak256";
51 homepage = "https://github.com/ethereum/eth-hash";
52 license = lib.licenses.mit;
53 maintainers = with lib.maintainers; [ jluttine ];
54 };
55}