From 74b9066a3949f673f37d6a39bafabff707c121d0 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Sat, 31 Oct 2020 12:00:00 +0000 Subject: [PATCH] paperwork: 1.3.1 -> 2.0 --- .../applications/office/paperwork/backend.nix | 48 ------------ .../office/paperwork/openpaperwork-core.nix | 42 ++++++++++ .../office/paperwork/openpaperwork-gtk.nix | 52 +++++++++++++ .../office/paperwork/paperwork-backend.nix | 77 +++++++++++++++++++ .../{default.nix => paperwork-gtk.nix} | 59 +++++++------- .../office/paperwork/paperwork-shell.nix | 59 ++++++++++++++ pkgs/applications/office/paperwork/src.nix | 12 +++ pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/python-packages.nix | 5 +- 9 files changed, 278 insertions(+), 78 deletions(-) delete mode 100644 pkgs/applications/office/paperwork/backend.nix create mode 100644 pkgs/applications/office/paperwork/openpaperwork-core.nix create mode 100644 pkgs/applications/office/paperwork/openpaperwork-gtk.nix create mode 100644 pkgs/applications/office/paperwork/paperwork-backend.nix rename pkgs/applications/office/paperwork/{default.nix => paperwork-gtk.nix} (57%) create mode 100644 pkgs/applications/office/paperwork/paperwork-shell.nix create mode 100644 pkgs/applications/office/paperwork/src.nix diff --git a/pkgs/applications/office/paperwork/backend.nix b/pkgs/applications/office/paperwork/backend.nix deleted file mode 100644 index af0d4c430590..000000000000 --- a/pkgs/applications/office/paperwork/backend.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ buildPythonPackage, lib, fetchFromGitLab - -, isPy3k, isPyPy - -, pyenchant, simplebayes, pillow, pycountry, whoosh, termcolor -, python-Levenshtein, pygobject3, pyocr, natsort, libinsane -, distro - -, pkgs -}: - -buildPythonPackage rec { - pname = "paperwork-backend"; - version = "1.3.1"; - - src = fetchFromGitLab { - domain = "gitlab.gnome.org"; - repo = "paperwork"; - group = "World"; - owner = "OpenPaperwork"; - rev = version; - sha256 = "1219yz8z4r1yn6miq8zc2z1m1lnhf3dmkhwfw23n05bg842nvg65"; - }; - - sourceRoot = "source/paperwork-backend"; - - # Python 2.x is not supported. - disabled = !isPy3k && !isPyPy; - - patchPhase = '' - echo 'version = "${version}"' > paperwork_backend/_version.py - ''; - - preCheck = "\"$out/bin/paperwork-shell\" chkdeps paperwork_backend"; - - propagatedBuildInputs = [ - pyenchant simplebayes pillow pycountry whoosh termcolor - python-Levenshtein libinsane pygobject3 pyocr natsort - pkgs.poppler_gi pkgs.gtk3 distro - ]; - - meta = { - description = "Backend part of Paperwork (Python API, no UI)"; - homepage = "https://openpaper.work/"; - license = lib.licenses.gpl3Plus; - maintainers = with lib.maintainers; [ aszlig symphorien ]; - }; -} diff --git a/pkgs/applications/office/paperwork/openpaperwork-core.nix b/pkgs/applications/office/paperwork/openpaperwork-core.nix new file mode 100644 index 000000000000..cae55ae95f1c --- /dev/null +++ b/pkgs/applications/office/paperwork/openpaperwork-core.nix @@ -0,0 +1,42 @@ +{ buildPythonPackage, lib, fetchFromGitLab + +, isPy3k, isPyPy + +, distro, setuptools + +, pkgs +}: + +buildPythonPackage rec { + pname = "openpaperwork-core"; + inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + + sourceRoot = "source/openpaperwork-core"; + + # Python 2.x is not supported. + disabled = !isPy3k && !isPyPy; + + patchPhase = '' + echo 'version = "${version}"' > src/openpaperwork_core/_version.py + chmod a+w -R .. + patchShebangs ../tools + ''; + + propagatedBuildInputs = [ + distro + setuptools + ]; + + nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + + preBuild = '' + make l10n_compile + ''; + + meta = { + description = "Backend part of Paperwork (Python API, no UI)"; + homepage = "https://openpaper.work/"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ aszlig symphorien ]; + }; +} diff --git a/pkgs/applications/office/paperwork/openpaperwork-gtk.nix b/pkgs/applications/office/paperwork/openpaperwork-gtk.nix new file mode 100644 index 000000000000..5dae745ce2eb --- /dev/null +++ b/pkgs/applications/office/paperwork/openpaperwork-gtk.nix @@ -0,0 +1,52 @@ +{ buildPythonPackage +, lib +, fetchFromGitLab + +, isPy3k +, isPyPy + +, openpaperwork-core +, pillow +, pygobject3 +, distro + +, pkgs +}: + +buildPythonPackage rec { + pname = "openpaperwork-gtk"; + inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + + sourceRoot = "source/openpaperwork-gtk"; + + # Python 2.x is not supported. + disabled = !isPy3k && !isPyPy; + + patchPhase = '' + echo 'version = "${version}"' > src/openpaperwork_gtk/_version.py + chmod a+w -R .. + patchShebangs ../tools + ''; + + nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + preBuild = '' + make l10n_compile + ''; + + propagatedBuildInputs = [ + pillow + pygobject3 + pkgs.poppler_gi + pkgs.gtk3 + distro + pkgs.pango + openpaperwork-core + ]; + + meta = { + description = "Reusable GTK components of Paperwork"; + homepage = "https://openpaper.work/"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ aszlig symphorien ]; + }; +} diff --git a/pkgs/applications/office/paperwork/paperwork-backend.nix b/pkgs/applications/office/paperwork/paperwork-backend.nix new file mode 100644 index 000000000000..a033bd695db6 --- /dev/null +++ b/pkgs/applications/office/paperwork/paperwork-backend.nix @@ -0,0 +1,77 @@ +{ buildPythonPackage +, lib +, fetchFromGitLab + +, isPy3k +, isPyPy + +, pyenchant +, simplebayes +, pypillowfight +, pycountry +, whoosh +, termcolor +, python-Levenshtein +, pygobject3 +, pyocr +, natsort +, libinsane +, distro +, openpaperwork-core +, openpaperwork-gtk +, psutil + +, pkgs +}: + +buildPythonPackage rec { + pname = "paperwork-backend"; + inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; + + sourceRoot = "source/paperwork-backend"; + + # Python 2.x is not supported. + disabled = !isPy3k && !isPyPy; + + patchPhase = '' + echo 'version = "${version}"' > src/paperwork_backend/_version.py + chmod a+w -R .. + patchShebangs ../tools + ''; + + propagatedBuildInputs = [ + pyenchant + simplebayes + pypillowfight + pycountry + whoosh + termcolor + python-Levenshtein + libinsane + pygobject3 + pyocr + natsort + pkgs.poppler_gi + pkgs.gtk3 + distro + openpaperwork-core + ]; + + preCheck = '' + export HOME=$(mktemp -d) + ''; + + nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + preBuild = '' + make l10n_compile + ''; + + checkInputs = [ openpaperwork-gtk psutil ]; + + meta = { + description = "Backend part of Paperwork (Python API, no UI)"; + homepage = "https://openpaper.work/"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ aszlig symphorien ]; + }; +} diff --git a/pkgs/applications/office/paperwork/default.nix b/pkgs/applications/office/paperwork/paperwork-gtk.nix similarity index 57% rename from pkgs/applications/office/paperwork/default.nix rename to pkgs/applications/office/paperwork/paperwork-gtk.nix index 102c3cd2564c..c493421dd11b 100644 --- a/pkgs/applications/office/paperwork/default.nix +++ b/pkgs/applications/office/paperwork/paperwork-gtk.nix @@ -10,45 +10,36 @@ , dbus , libnotify , wrapGAppsHook +, fetchFromGitLab +, which +, gettext +, gobject-introspection }: python3Packages.buildPythonApplication rec { - inherit (python3Packages.paperwork-backend) version src; + inherit (import ./src.nix { inherit fetchFromGitLab; }) version src; pname = "paperwork"; sourceRoot = "source/paperwork-gtk"; # Patch out a few paths that assume that we're using the FHS: postPatch = '' - themeDir="$(echo "${gnome3.adwaita-icon-theme}/share/icons/"*)" - sed -i -e "s,/usr/share/icons/gnome,$themeDir," src/paperwork/deps.py + chmod a+w -R .. + patchShebangs ../tools - sed -i -e 's,sys\.prefix,"",g' \ - src/paperwork/frontend/aboutdialog/__init__.py \ - src/paperwork/frontend/mainwindow/__init__.py \ - setup.py + export HOME=$(mktemp -d) - sed -i -e '/^UI_FILES_DIRS = \[/,/^\]$/ { - c UI_FILES_DIRS = ["'"$out/share/paperwork"'"] - }' src/paperwork/frontend/util/__init__.py - - sed -i -e '/^LOCALE_PATHS = \[/,/^\]$/ { - c LOCALE_PATHS = ["'"$out/share"'"] - }' src/paperwork/paperwork.py - - sed -i -e 's/"icon"/"icon-name"/g' \ - src/paperwork/frontend/mainwindow/mainwindow.glade - - sed -i -e 's/"logo"/"logo-icon-name"/g' \ - src/paperwork/frontend/aboutdialog/aboutdialog.glade - - cat - ../AUTHORS.py > src/paperwork/_version.py < src/paperwork_gtk/_version.py < src/paperwork_shell/_version.py + chmod a+w -R .. + patchShebangs ../tools + ''; + + propagatedBuildInputs = [ + openpaperwork-core + paperwork-backend + fabulous + getkey + ]; + + checkInputs = [ + openpaperwork-gtk + ]; + + nativeBuildInputs = [ pkgs.gettext pkgs.which ]; + preBuild = '' + make l10n_compile + ''; + + preCheck = '' + export HOME=$(mktemp -d) + "$out/bin/paperwork-cli" chkdeps + ''; + + meta = { + description = "CLI for Paperwork"; + homepage = "https://openpaper.work/"; + license = lib.licenses.gpl3Plus; + maintainers = with lib.maintainers; [ aszlig symphorien ]; + }; +} diff --git a/pkgs/applications/office/paperwork/src.nix b/pkgs/applications/office/paperwork/src.nix new file mode 100644 index 000000000000..d77e8bc043e7 --- /dev/null +++ b/pkgs/applications/office/paperwork/src.nix @@ -0,0 +1,12 @@ +{fetchFromGitLab}: +rec { + version = "2.0"; + src = fetchFromGitLab { + domain = "gitlab.gnome.org"; + repo = "paperwork"; + group = "World"; + owner = "OpenPaperwork"; + rev = version; + sha256 = "0879wvl3hk74kwnaa64q6prfg2kjaa7nrzahaw2zcipdpf5h2mkm"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1b04ab9e25b5..a45d46ee14c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6143,7 +6143,7 @@ in paperless = callPackage ../applications/office/paperless { }; - paperwork = callPackage ../applications/office/paperwork { }; + paperwork = callPackage ../applications/office/paperwork/paperwork-gtk.nix { }; papertrail = callPackage ../tools/text/papertrail { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 62eb91840377..d4757bd2792d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4306,7 +4306,10 @@ in { paperspace = callPackage ../development/python-modules/paperspace { }; - paperwork-backend = callPackage ../applications/office/paperwork/backend.nix { }; + openpaperwork-core = callPackage ../applications/office/paperwork/openpaperwork-core.nix { }; + openpaperwork-gtk = callPackage ../applications/office/paperwork/openpaperwork-gtk.nix { }; + paperwork-backend = callPackage ../applications/office/paperwork/paperwork-backend.nix { }; + paperwork-shell = callPackage ../applications/office/paperwork/paperwork-shell.nix { }; papis = callPackage ../development/python-modules/papis { };