paperwork: 1.3.1 -> 2.0

This commit is contained in:
Symphorien Gibol 2020-10-31 12:00:00 +00:00
parent f269e315ec
commit 74b9066a39
9 changed files with 278 additions and 78 deletions

View File

@ -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 ];
};
}

View File

@ -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 ];
};
}

View File

@ -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 ];
};
}

View File

@ -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 ];
};
}

View File

@ -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 <<EOF
cat - ../AUTHORS.py > src/paperwork_gtk/_version.py <<EOF
# -*- coding: utf-8 -*-
version = "${version}"
authors_code=""
EOF
'';
preBuild = ''
make l10n_compile
'';
ASPELL_CONF = "dict-dir ${buildEnv {
name = "aspell-all-dicts";
paths = lib.collect lib.isDerivation aspellDicts;
@ -56,37 +47,49 @@ python3Packages.buildPythonApplication rec {
postInstall = ''
# paperwork-shell needs to be re-wrapped with access to paperwork
cp ${python3Packages.paperwork-backend}/bin/.paperwork-shell-wrapped $out/bin/paperwork-shell
cp ${python3Packages.paperwork-shell}/bin/.paperwork-cli-wrapped $out/bin/paperwork-cli
# install desktop files and icons
XDG_DATA_HOME=$out/share $out/bin/paperwork-shell install
XDG_DATA_HOME=$out/share $out/bin/paperwork-gtk install --user
'';
checkInputs = [ xvfb_run dbus.daemon ] ++ (with python3Packages; [ paperwork-backend ]);
checkInputs = [ xvfb_run dbus.daemon ];
nativeBuildInputs = [
wrapGAppsHook
gobject-introspection
(lib.getBin gettext)
which
];
buildInputs = [
gnome3.adwaita-icon-theme
libnotify
librsvg
gtk3
cairo
];
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';
# A few parts of chkdeps need to have a display and a dbus session, so we not
# only need to run a virtual X server + dbus but also have a large enough
# resolution, because the Cairo test tries to draw a 200x200 window.
preCheck = ''
xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
--config-file=${dbus.daemon}/share/dbus-1/session.conf \
paperwork-shell chkdeps paperwork
$out/bin/paperwork-gtk chkdeps
'';
propagatedBuildInputs = with python3Packages; [
paperwork-backend
paperwork-shell
openpaperwork-gtk
openpaperwork-core
pypillowfight
gtk3
cairo
pyxdg
dateutil
setuptools

View File

@ -0,0 +1,59 @@
{ buildPythonPackage
, lib
, fetchFromGitLab
, isPy3k
, isPyPy
, openpaperwork-core
, openpaperwork-gtk
, paperwork-backend
, fabulous
, getkey
, pkgs
}:
buildPythonPackage rec {
pname = "paperwork-shell";
inherit (import ./src.nix { inherit fetchFromGitLab; }) version src;
sourceRoot = "source/paperwork-shell";
# Python 2.x is not supported.
disabled = !isPy3k && !isPyPy;
patchPhase = ''
echo 'version = "${version}"' > 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 ];
};
}

View File

@ -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";
};
}

View File

@ -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 { };

View File

@ -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 { };