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