Unverified Commit aa2c7963 authored by Ivan Mincik's avatar Ivan Mincik Committed by GitHub
Browse files

pdfding: 1.5.1 -> 1.7.1 (#496164)

parents db026e54 9e035fef
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@

      # create admin
      machine.wait_for_unit("multi-user.target")
      machine.wait_for_open_port(${toString port})
      machine.succeed("DJANGO_SUPERUSER_PASSWORD=admin pdfding-manage createsuperuser --no-input --username admin --email admin@localhost")

      cookie_jar = "/tmp/cookies.txt"
+3 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@
  testScript =
    { nodes, ... }:
    let
      inherit (nodes.machine.services.pdfding) port;
      stateDir = "/var/lib/pdfding";
    in
    # py
@@ -41,6 +42,7 @@

      # create admin
      machine.wait_for_unit("multi-user.target")
      machine.wait_for_open_port(${toString port})

      machine.succeed("DJANGO_SUPERUSER_PASSWORD=admin pdfding-manage createsuperuser --no-input --username admin --email admin@localhost")

@@ -74,7 +76,7 @@
  interactive.nodes.machine =
    { config, ... }:
    let
      port = config.services.pdfding.port;
      inherit (config.services.pdfding) port;
    in
    {
      # not needed, only for manual interactive debugging
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ in

      # create admin
      machine.wait_for_unit("multi-user.target")
      machine.wait_for_open_port(${toString port})
      machine.succeed("DJANGO_SUPERUSER_PASSWORD=admin pdfding-manage createsuperuser --no-input --username admin --email admin@localhost")

      # login
+5 −6
Original line number Diff line number Diff line
{
  stdenv,
  fetchpatch2,
  fetchNpmDeps,
  fetchzip,
  fetchFromGitHub,
@@ -10,8 +9,8 @@
  nodejs,
}:
let
  pdfjsVersion = "5.4.394"; # see update script
  pdfjsHash = "sha256-pd7xwfvR9U1bHT5eblszYU3YJQwQwhuyDDiNj+fnyaQ=";
  pdfjsVersion = "5.5.207"; # see update script
  pdfjsHash = "sha256-HikisEa6L+BqsG6imgWhV+4J46BluU5zqU1nFZAG0eM=";
  pdfjs = fetchzip {
    url = "https://github.com/mozilla/pdf.js/releases/download/v${pdfjsVersion}/pdfjs-${pdfjsVersion}-dist.zip";
    hash = pdfjsHash;
@@ -28,18 +27,18 @@ let
in
stdenv.mkDerivation (finalAttrs: {
  pname = "pdfding-frontend";
  version = "1.5.1";
  version = "1.7.1";
  src = fetchFromGitHub {
    owner = "mrmn2";
    repo = "PdfDing";
    tag = "v${finalAttrs.version}";
    hash = "sha256-PXkD+2k8/LmMWzZAj8qEK4mLoOKS4mDWcqe8AgoCdBU=";
    hash = "sha256-T3Y9eWwBVxGPISZ3EZndAR6mwsq4g67RRCPpoZPuh+0=";
  };

  npmDeps = fetchNpmDeps {
    inherit (finalAttrs) src;
    name = "pdfding-frontend-${finalAttrs.version}-npm-deps";
    hash = "sha256-SgL8QhRGONGhJBu6b8HSVqZPzJ+NojhVClBEH5ajCcc=";
    hash = "sha256-an4KKKx65ehCm1YAlwLWYAW8pQMgB4HdDERqC/hfQi0=";
  };

  nativeBuildInputs = [
+17 −33
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  callPackage,
  fetchFromGitHub,
  fetchpatch2,
  makeWrapper,
  nixosTests,

@@ -13,30 +12,18 @@ let
in
python.pkgs.buildPythonPackage (finalAttrs: {
  pname = "pdfding";
  version = "1.5.1";
  version = "1.7.1";
  src = fetchFromGitHub {
    owner = "mrmn2";
    repo = "PdfDing";
    tag = "v${finalAttrs.version}";
    hash = "sha256-PXkD+2k8/LmMWzZAj8qEK4mLoOKS4mDWcqe8AgoCdBU=";
    hash = "sha256-T3Y9eWwBVxGPISZ3EZndAR6mwsq4g67RRCPpoZPuh+0=";
  };
  pyproject = true;

  patches = [
    # fixes two tests, remove patch in the next version
    # https://github.com/mrmn2/PdfDing/pull/248
    (fetchpatch2 {
      url = "https://github.com/mrmn2/PdfDing/commit/24df5a82ffb1d60162978791b716f67d20128a22.patch?full_index=1";
      hash = "sha256-N3FtPQGSOFeUbVcinXK9kJM6hZOn4YdJJVWe4VXb8pE=";
    })
  ];

  # remove supervisor from dependencies
  postPatch = ''
    sed -i 's/supervisor.*$//' pyproject.toml

    substituteInPlace pdfding/backup/tests/test_management.py pdfding/backup/tests/test_tasks.py \
      --replace-fail "Path(__file__).parents[2]" "Path('$PDFDING_OUT_DIR')"
  '';

  dependencies =
@@ -68,6 +55,7 @@ python.pkgs.buildPythonPackage (finalAttrs: {
      requests
    ]
    ++ qrcode.optional-dependencies.pil
    ++ django-allauth.optional-dependencies.mfa
    ++ django-allauth.optional-dependencies.socialaccount;

  build-system = with python.pkgs; [ poetry-core ];
@@ -139,36 +127,31 @@ python.pkgs.buildPythonPackage (finalAttrs: {
  pythonRelaxDeps = [
    "django"
    "django-allauth"
    "django-htmx"
    "gunicorn"
    "markdown"
    "nh3"
    "pypdf"
    "ruamel-yaml"
    "whitenoise"
  ];

  nativeCheckInputs = with python.pkgs; [
  checkInputs = with python.pkgs; [
    fido2
    pytest-django
    pytestCheckHook
  ];

  # from .github/workflows/tests.yaml
  pytestFlags = [
    "--ignore=e2e"
  nativeCheckInputs = with python.pkgs; [
    pytestCheckHook
  ];

  disabledTests = [
    # broken tests in 1.5.0
    "test_adjust_file_paths_to_ws_collection"
    "test_oidc_callback" # AssertionError: 200 != 401
  ];
  # from .github/workflows/tests.yaml
  pytestFlags = [ "--ignore=e2e" ];

  /*
    fix two breaking tests by providing full out path
    AssertionError: Calls not found
    AssertionError: 'add_file_to_minio' does not contain all of ...
  */
  preCheck = ''
    # dev.py is required for tests, restore it
    mv dev.py.bak $PDFDING_OUT_DIR/core/settings/dev.py

    export DATA_DIR=$PWD/pdfding

    # tests should run in pdfding directory
    pushd pdfding
  '';
@@ -177,6 +160,8 @@ python.pkgs.buildPythonPackage (finalAttrs: {
    # come out of the pdfding directory
    popd

    unset DATA_DIR

    # remove dev.py
    rm $PDFDING_OUT_DIR/core/settings/dev.py
  '';
@@ -199,7 +184,6 @@ python.pkgs.buildPythonPackage (finalAttrs: {
    homepage = "https://pdfding.com";
    license = lib.licenses.agpl3Only;
    mainProgram = "pdfding-manage";
    maintainers = with lib.maintainers; [ phanirithvij ];
    platforms = lib.platforms.unix;
    teams = with lib.teams; [ ngi ];
  };