@@ -0,0 +1,38 @@
1+{ lib, buildPythonPackage, fetchFromGitHub, fetchpatch, amazon-ion, six, pytestCheckHook }:
2+
3+buildPythonPackage rec {
4+ pname = "ionhash";
5+ version = "1.2.1";
6+
7+ src = fetchFromGitHub {
8+ owner = "amzn";
9+ repo = "ion-hash-python";
10+ rev = "v${version}";
11+ sha256 = "sha256-mXOLKXauWwwIA/LnF4qyZsBiF/QM+rF9MmE2ewmozYo=";
12+ fetchSubmodules = true;
13+ };
14+
15+ patches = [
16+ (fetchpatch {
17+ url = "https://github.com/amzn/ion-hash-python/commit/5cab56d694ecc176e394bb455c2d726ba1514ce0.patch";
18+ sha256 = "sha256-P5QByNafgxI//e3m+b0oG00+rVymCsT/J4dOZSk3354=";
19+ })
20+ ];
21+
22+ postPatch = ''
23+ substituteInPlace setup.py --replace "'pytest-runner'," ""
24+ '';
25+
26+ propagatedBuildInputs = [ amazon-ion six ];
27+
28+ checkInputs = [ pytestCheckHook ];
29+
30+ pythonImportsCheck = [ "ionhash" ];
31+
32+ meta = with lib; {
33+ description = "Python implementation of Amazon Ion Hash";
34+ homepage = "https://github.com/amzn/ion-hash-python";
35+ license = licenses.asl20;
36+ maintainers = [ maintainers.terlar ];
37+ };
38+}