summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorAlbert Peschar <albert@peschar.net>2017-05-03 18:47:56 +0200
committerAlbert Peschar <albert@peschar.net>2017-05-04 20:51:31 +0200
commit10abea9eccead7908f525f978ba1ad62ade03cda (patch)
tree73535b8f767cf6d986b268245f19f27ad5b4fd03 /pkgs/development/python-modules
parent8f71273a2c496250198395b119754d69aae24606 (diff)
downloadnixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar.gz
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar.bz2
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar.lz
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar.xz
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.tar.zst
nixpkgs-10abea9eccead7908f525f978ba1ad62ade03cda.zip
pythonPackages.PyLD: init at 0.7.2
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/PyLD/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/PyLD/default.nix b/pkgs/development/python-modules/PyLD/default.nix
new file mode 100644
index 00000000000..e4edaf83a25
--- /dev/null
+++ b/pkgs/development/python-modules/PyLD/default.nix
@@ -0,0 +1,56 @@
+{ stdenv, fetchPypi, buildPythonPackage, fetchFromGitHub, python, gnugrep }:
+
+let
+
+  json-ld = fetchFromGitHub {
+    owner = "json-ld";
+    repo = "json-ld.org";
+    rev = "843a70e4523d7cd2a4d3f5325586e726eb1b123f";
+    sha256 = "05j0nq6vafclyypxjj30iw898ig0m32nvz0rjdlslx6lawkiwb2a";
+  };
+
+  normalization = fetchFromGitHub {
+    owner = "json-ld";
+    repo = "normalization";
+    rev = "aceeaf224b64d6880189d795bd99c3ffadb5d79e";
+    sha256 = "125q5rllfm8vg9mz8hn7bhvhv2vqpd86kx2kxlk84smh33l8kbyl";
+  };
+
+in
+
+buildPythonPackage rec {
+  pname = "PyLD";
+  version = "0.7.2";
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "digitalbazaar";
+    repo = "pyld";
+    rev = "652473f828e9a396d4c1db9addbd294fb7db1797";
+    sha256 = "1bmpz4s6j7by6l45wwxy7dn7hmrhxc26kbx2hbfy41x29vbjg6j9";
+  };
+
+  # Unfortunately PyLD does not pass all testcases in the JSON-LD corpus. We
+  # check for at least a minimum amount of successful tests so we know it's not
+  # getting worse, at least.
+  checkPhase = ''
+    ok_min=401
+
+    if ! ${python.interpreter} tests/runtests.py -d ${json-ld}/test-suite 2>&1 | tee test.out; then
+      ok_count=$(${gnugrep}/bin/grep -F '... ok' test.out | wc -l)
+      if [[ $ok_count -lt $ok_min ]]; then
+        echo "Less than $ok_min tests passed ($ok_count). Failing the build."
+        exit 1
+      fi
+    fi
+
+    ${python.interpreter} tests/runtests.py -d ${normalization}/tests
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Python implementation of the JSON-LD API";
+    homepage = "https://github.com/digitalbazaar/pyld";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ apeschar ];
+  };
+}