Merge pull request #102235 from symphorien/paperwork2

Paperwork 2.0
This commit is contained in:
Guillaume Girol 2020-11-20 21:30:08 +00:00 committed by GitHub
commit 01083f116d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 389 additions and 78 deletions

View File

@ -126,6 +126,13 @@
to <literal>/run/pdns-recursor</literal> to match upstream.
</para>
</listitem>
<listitem>
<para>
Paperwork was updated to version 2. The on-disk format slightly changed,
and it is not possible to downgrade from Paperwork 2 back to Paperwork
1.3. Back your documents up before upgrading. See <link xlink:href="https://forum.openpaper.work/t/paperwork-2-0/112/5">this thread</link> for more details.
</para>
</listitem>
<listitem>
<para>
PowerDNS has been updated from <literal>4.2.x</literal> to <literal>4.3.x</literal>. Please

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.1";
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
repo = "paperwork";
group = "World";
owner = "OpenPaperwork";
rev = version;
sha256 = "16pc4drwpjl4937wdavs6wk0j1qs474b072wplhs8ywxfgqip1h4";
};
}

View File

@ -0,0 +1,39 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pillow
, python
}:
buildPythonPackage rec {
pname = "fabulous";
version = "0.3.0";
src = fetchFromGitHub {
owner = "jart";
repo = pname;
rev = version;
sha256 = "0yxdaz6yayp1a57kdb2i8q7kwwdlwy4a3d0lr012h2ji9m89c8q7";
};
patches = [
./relative_import.patch
];
propagatedBuildInputs = [
pillow
];
checkPhase = ''
for i in tests/*.py; do
${python.interpreter} $i
done
'';
meta = with lib; {
description = "Make the output of terminal applications look fabulous";
homepage = "https://jart.github.io/fabulous";
license = licenses.asl20;
maintainers = [ maintainers.symphorien ];
};
}

View File

@ -0,0 +1,27 @@
diff --git a/fabulous/prompt.py b/fabulous/prompt.py
index 531176f..e395ab4 100644
--- a/fabulous/prompt.py
+++ b/fabulous/prompt.py
@@ -18,8 +18,7 @@
import sys
import os
import os.path
-import term
-from term import stdout, stderr, display
+from .term import stdout, stderr, display
__all__ = ["input_object","query","file_chooser"]
diff --git a/fabulous/widget.py b/fabulous/widget.py
index 31a2547..7ad889a 100644
--- a/fabulous/widget.py
+++ b/fabulous/widget.py
@@ -24,7 +24,7 @@ import os
import math
from datetime import datetime
# import textwrap
-from term import stdout, display
+from .term import stdout, display
class ProgressBar(object):
"""A 3-line progress bar, which looks like::

View File

@ -0,0 +1,34 @@
{ lib
, buildPythonPackage
, fetchPypi
, pytestCheckHook
, flake8
}:
buildPythonPackage rec {
pname = "getkey";
version = "0.6.5";
src = fetchPypi {
inherit pname version;
sha256 = "0ng0ihfagh9g8hral0bq5nhjlp3csqghyv3z8b7ylkdkqc1cgiv8";
};
# disable coverage, because we don't care and python-coveralls is not in nixpkgs
postPatch = ''
sed -e '/python-coveralls/d' -e '/pytest-cov/d' -i setup.py
rm setup.cfg
'';
checkInputs = [
flake8
pytestCheckHook
];
meta = with lib; {
description = "Read single characters and key-strokes";
homepage = "https://github.com/kcsaff/getkey";
license = licenses.mit;
maintainers = [ maintainers.symphorien ];
};
}

View File

@ -6299,7 +6299,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

@ -1989,6 +1989,8 @@ in {
Fabric = callPackage ../development/python-modules/Fabric { };
fabulous = callPackage ../development/python-modules/fabulous { };
facebook-sdk = callPackage ../development/python-modules/facebook-sdk { };
face = callPackage ../development/python-modules/face { };
@ -2369,6 +2371,8 @@ in {
getmac = callPackage ../development/python-modules/getmac { };
getkey = callPackage ../development/python-modules/getkey { };
gevent = callPackage ../development/python-modules/gevent { };
geventhttpclient = callPackage ../development/python-modules/geventhttpclient { };
@ -4356,7 +4360,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 { };