diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index bc2a15124275..7375dd9d2a62 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -363,6 +363,8 @@ - `services.outline` can now be configured to use local filesystem storage instead of S3 storage using [services.outline.storage.storageType](#opt-services.outline.storage.storageType). +- `paperwork` was updated to version 2.2. Documents scanned with this version will not be visible to previous versions if you downgrade. See the [upstream announcement](https://forum.openpaper.work/t/paperwork-2-2-testing-phase/316#important-switch-from-jpeg-to-png-for-new-pages-2) for details and workarounds. + - `buildGoModule` `go-modules` attrs have been renamed to `goModules`. - The `fonts.fonts` and `fonts.enableDefaultFonts` options have been renamed to `fonts.packages` and `fonts.enableDefaultPackages` respectively. diff --git a/pkgs/applications/office/paperwork/openpaperwork-core.nix b/pkgs/applications/office/paperwork/openpaperwork-core.nix index ee4fe040bfa2..d434e000da5e 100644 --- a/pkgs/applications/office/paperwork/openpaperwork-core.nix +++ b/pkgs/applications/office/paperwork/openpaperwork-core.nix @@ -1,8 +1,15 @@ -{ buildPythonPackage, lib, fetchFromGitLab +{ buildPythonPackage +, lib +, fetchFromGitLab -, isPy3k, isPyPy +, isPy3k +, isPyPy -, distro, setuptools, psutil +, distro +, setuptools +, psutil +, certifi +, setuptools-scm , pkgs }: @@ -10,6 +17,7 @@ buildPythonPackage rec { pname = "openpaperwork-core"; inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + format = "pyproject"; sourceRoot = "${src.name}/openpaperwork-core"; @@ -17,23 +25,33 @@ buildPythonPackage rec { disabled = !isPy3k && !isPyPy; patchPhase = '' - echo 'version = "${version}"' > src/openpaperwork_core/_version.py chmod a+w -R .. patchShebangs ../tools ''; + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + propagatedBuildInputs = [ distro setuptools psutil + certifi ]; - nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + nativeBuildInputs = [ + pkgs.gettext + pkgs.which + setuptools-scm + ]; preBuild = '' make l10n_compile ''; + preCheck = '' + export HOME=$(mktemp -d) + ''; + meta = { description = "Backend part of Paperwork (Python API, no UI)"; homepage = "https://openpaper.work/"; diff --git a/pkgs/applications/office/paperwork/openpaperwork-gtk.nix b/pkgs/applications/office/paperwork/openpaperwork-gtk.nix index 9566a6010635..cd0290f08746 100644 --- a/pkgs/applications/office/paperwork/openpaperwork-gtk.nix +++ b/pkgs/applications/office/paperwork/openpaperwork-gtk.nix @@ -9,6 +9,7 @@ , pillow , pygobject3 , distro +, setuptools-scm , pkgs }: @@ -16,6 +17,7 @@ buildPythonPackage rec { pname = "openpaperwork-gtk"; inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + format = "pyproject"; sourceRoot = "${src.name}/openpaperwork-gtk"; @@ -23,12 +25,18 @@ buildPythonPackage rec { disabled = !isPy3k && !isPyPy; patchPhase = '' - echo 'version = "${version}"' > src/openpaperwork_gtk/_version.py chmod a+w -R .. patchShebangs ../tools ''; - nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + + nativeBuildInputs = [ + pkgs.gettext + pkgs.which + setuptools-scm + ]; + preBuild = '' make l10n_compile ''; diff --git a/pkgs/applications/office/paperwork/paperwork-backend.nix b/pkgs/applications/office/paperwork/paperwork-backend.nix index cbb57496427c..95608b26e2fe 100644 --- a/pkgs/applications/office/paperwork/paperwork-backend.nix +++ b/pkgs/applications/office/paperwork/paperwork-backend.nix @@ -1,6 +1,5 @@ { buildPythonPackage , lib -, fetchpatch , fetchFromGitLab , pyenchant , scikit-learn @@ -8,7 +7,6 @@ , pycountry , whoosh , termcolor -, levenshtein , pygobject3 , pyocr , natsort @@ -24,34 +22,30 @@ , shared-mime-info , libreoffice , unittestCheckHook +, setuptools-scm }: buildPythonPackage rec { pname = "paperwork-backend"; inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + format = "pyproject"; sourceRoot = "${src.name}/paperwork-backend"; patches = [ # disables a flaky test https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/issues/1035#note_1493700 ./flaky_test.patch - (fetchpatch { - url = "https://gitlab.gnome.org/World/OpenPaperwork/paperwork/-/commit/0f5cf0fe7ef223000e02c28e4c7576f74a778fe6.patch"; - hash = "sha256-NIK3j2TdydfeK3/udS/Pc+tJa/pPkfAmSPPeaYuaCq4="; - }) ]; patchFlags = [ "-p2" ]; postPatch = '' - substituteInPlace setup.py \ - --replace python-Levenshtein Levenshtein - - echo 'version = "${version}"' > src/paperwork_backend/_version.py chmod a+w -R .. patchShebangs ../tools ''; + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + propagatedBuildInputs = [ distro gtk3 @@ -63,7 +57,6 @@ buildPythonPackage rec { pygobject3 pyocr pypillowfight - levenshtein poppler_gi scikit-learn termcolor @@ -74,6 +67,7 @@ buildPythonPackage rec { gettext shared-mime-info which + setuptools-scm ]; preBuild = '' diff --git a/pkgs/applications/office/paperwork/paperwork-gtk.nix b/pkgs/applications/office/paperwork/paperwork-gtk.nix index d4ae3070d9af..a43546ee8e0d 100644 --- a/pkgs/applications/office/paperwork/paperwork-gtk.nix +++ b/pkgs/applications/office/paperwork/paperwork-gtk.nix @@ -34,6 +34,7 @@ in python3Packages.buildPythonApplication rec { inherit src version; pname = "paperwork"; + format = "pyproject"; sample_docs = sample_documents // { # a trick for the update script @@ -43,21 +44,13 @@ python3Packages.buildPythonApplication rec { sourceRoot = "${src.name}/paperwork-gtk"; - # Patch out a few paths that assume that we're using the FHS: - postPatch = '' - substituteInPlace setup.py \ - --replace python-Levenshtein Levenshtein + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; + postPatch = '' chmod a+w -R .. patchShebangs ../tools export HOME=$(mktemp -d) - - cat - ../AUTHORS.py > src/paperwork_gtk/_version.py < src/paperwork_shell/_version.py chmod a+w -R .. patchShebangs ../tools ''; + env.SETUPTOOLS_SCM_PRETEND_VERSION = version; propagatedBuildInputs = [ openpaperwork-core @@ -37,6 +40,7 @@ buildPythonPackage rec { fabulous getkey psutil + rich ]; nativeCheckInputs = [ @@ -44,7 +48,12 @@ buildPythonPackage rec { openpaperwork-gtk ]; - nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + nativeBuildInputs = [ + pkgs.gettext + pkgs.which + setuptools-scm + ]; + preBuild = '' make l10n_compile ''; diff --git a/pkgs/applications/office/paperwork/src.nix b/pkgs/applications/office/paperwork/src.nix index 6323c2c417b8..ad0a071bd4e1 100644 --- a/pkgs/applications/office/paperwork/src.nix +++ b/pkgs/applications/office/paperwork/src.nix @@ -1,13 +1,13 @@ {fetchFromGitLab}: rec { - version = "2.1.2"; + version = "2.2.1"; src = fetchFromGitLab { domain = "gitlab.gnome.org"; repo = "paperwork"; group = "World"; owner = "OpenPaperwork"; rev = version; - sha256 = "/5k+zUtTE+Dr879xbHDCAYrqlEJLsbkcRSG3GbA/PCg="; + sha256 = "sha256-OFVj9INDiOpGd5N3ziMBWt3/IdmpInc+jEAxW3GcvOA="; }; sample_documents = fetchFromGitLab { domain = "gitlab.gnome.org";