From 34b58364e4cef17448544020e2b0923775f46cfc Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 14 Sep 2019 14:00:47 +0200 Subject: [PATCH 1/3] pytest: Add pytest_4 as its own attribute Many packages aren't yet updated to handle the incompatible changes of pytest5 so we still need v4. --- pkgs/top-level/python-packages.nix | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 96885a83ebb..62901ef2052 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1991,15 +1991,17 @@ in { pyhepmc = callPackage ../development/python-modules/pyhepmc { }; - pytest = if isPy3k then - callPackage ../development/python-modules/pytest { - # hypothesis tests require pytest that causes dependency cycle - hypothesis = self.hypothesis.override { doCheck = false; }; - } - else callPackage ../development/python-modules/pytest/2.nix { - # hypothesis tests require pytest that causes dependency cycle - hypothesis = self.hypothesis.override { doCheck = false; }; - }; + pytest = if isPy3k then self.pytest_5 else self.pytest_4; + + pytest_5 = callPackage ../development/python-modules/pytest { + # hypothesis tests require pytest that causes dependency cycle + hypothesis = self.hypothesis.override { doCheck = false; }; + }; + + pytest_4 = callPackage ../development/python-modules/pytest/4.nix { + # hypothesis tests require pytest that causes dependency cycle + hypothesis = self.hypothesis.override { doCheck = false; }; + }; pytest-helpers-namespace = callPackage ../development/python-modules/pytest-helpers-namespace { }; From cbab4663f33f59b1fe347beb66f12d0f73746301 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 14 Sep 2019 14:01:38 +0200 Subject: [PATCH 2/3] paperless: Use pytest_4 in django-crispy-forms Doesn't build with pytest_5 --- .../office/paperless/python-modules/django-crispy-forms.nix | 4 ++-- pkgs/development/python-modules/pytest/{2.nix => 4.nix} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename pkgs/development/python-modules/pytest/{2.nix => 4.nix} (100%) diff --git a/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix b/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix index c1e0f7da30f..465da386247 100644 --- a/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix +++ b/pkgs/applications/office/paperless/python-modules/django-crispy-forms.nix @@ -1,5 +1,5 @@ { lib, buildPythonPackage, fetchFromGitHub -, pytest, pytest-django, django }: +, pytest_4, pytest-django, django }: buildPythonPackage { pname = "django-crispy-forms"; @@ -19,7 +19,7 @@ buildPythonPackage { export sourceRoot=source- ''; - checkInputs = [ pytest pytest-django django ]; + checkInputs = [ pytest_4 pytest-django django ]; checkPhase = '' PYTHONPATH="$(pwd):$PYTHONPATH" \ diff --git a/pkgs/development/python-modules/pytest/2.nix b/pkgs/development/python-modules/pytest/4.nix similarity index 100% rename from pkgs/development/python-modules/pytest/2.nix rename to pkgs/development/python-modules/pytest/4.nix From 0d5806fefd312d904c9f8b49c728a3072678a87e Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 14 Sep 2019 14:59:00 +0200 Subject: [PATCH 3/3] paperless: fix cors header `django-cors-headers` 3.x (which is used in nixpkgs) requires a scheme for allowed hosts. Upstream uses 2.4, however we create the python env with Nix, so the source needs to be patched accordingly. --- pkgs/applications/office/paperless/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/applications/office/paperless/default.nix b/pkgs/applications/office/paperless/default.nix index af2fd82ddb0..97088f36041 100644 --- a/pkgs/applications/office/paperless/default.nix +++ b/pkgs/applications/office/paperless/default.nix @@ -57,6 +57,12 @@ let cp -r --no-preserve=mode $src/src/* $src/LICENSE $srcDir ''; + postPatch = '' + # django-cors-headers 3.x requires a scheme for allowed hosts + substituteInPlace $out/share/paperless/paperless/settings.py \ + --replace "localhost:8080" "http://localhost:8080" + ''; + buildPhase = let # Paperless has explicit runtime checks that expect these binaries to be in PATH extraBin = lib.makeBinPath [ imagemagick7 ghostscript optipng tesseract unpaper ];