{
    "app-id": "work.openpaper.Paperwork",
    "branch": "master",
    "runtime": "org.gnome.Platform",
    "runtime-version": "41",
    "sdk": "org.gnome.Sdk",
    "command": "paperwork-gtk",
    "copy-icon": true,
    "sdk-extensions": [
        "org.freedesktop.Sdk.Extension.openjdk11"
    ],
    "finish-args": [
        "--share=ipc",
        "--share=network",
        "--socket=fallback-x11",
        "--socket=wayland",
        "--filesystem=home",
        "--persist=.python-eggs",
        "--talk-name=org.freedesktop.Notifications",
        "--talk-name=org.freedesktop.FileManager1",
        "--talk-name=org.gtk.vfs.*",
        "--filesystem=xdg-run/gvfsd",
        "--own-name=work.openpaper.paperwork",
        "--env=JAVA_HOME=/app/jre",
        "--env=LIBO_FLATPAK=1"
    ],
    "modules": [
        "flatpak/shared-modules/setuptools-59.5.0.json",
        "flatpak/shared-modules/libreoffice-7.2.3.2.json",
        "flatpak/shared-modules/scikit-learn-0.24.0.json",
        "flatpak/shared-modules/sane-backends-1.0.32.json",
        "flatpak/shared-modules/tesseract-4.1.1.json",
        {
            "name": "python-distro",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/ca/e3/78443d739d7efeea86cbbe0216511d29b2f5ca8dbf51a6f2898432738987/distro-1.4.0.tar.gz",
                    "sha256": "362dde65d846d23baee4b5c058c8586f219b5a54be1cf5fc6ff55c4578392f57"
                }
            ]
        },
        {
            "name": "python-Levenshtein",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://pypi.python.org/packages/42/a9/d1785c85ebf9b7dfacd08938dd028209c34a0ea3b1bcdb895208bd40a67d/python-Levenshtein-0.12.0.tar.gz",
                    "sha256": "033a11de5e3d19ea25c9302d11224e1a1898fe5abd23c61c7c360c25195e3eb1"
                }
            ]
        },
        {
            "name": "python-fabulous",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/53/2d/5750798dbb1cd3029c17b6f7456f79948b15f63e4781ffa0be8cf35cfc22/fabulous-0.3.0.tar.gz",
                    "sha256": "54040da01d7ce1e937fc4b61d265e872b007463bea411a3a5762f4d6ee55c312"
                }
            ]
        },
        {
            "name": "python-pillow",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/3c/7e/443be24431324bd34d22dd9d11cc845d995bcd3b500676bcf23142756975/Pillow-5.4.1.tar.gz",
                    "sha256": "5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f"
                }
            ],
            "modules": [
                {
                    "name": "python-olefile",
                    "buildsystem": "simple",
                    "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
                    "sources": [
                        {
                            "type": "archive",
                            "url": "https://files.pythonhosted.org/packages/34/81/e1ac43c6b45b4c5f8d9352396a14144bba52c8fec72a80f425f6a4d653ad/olefile-0.46.zip",
                            "sha256": "133b031eaf8fd2c9399b78b8bc5b8fcbe4c31e85295749bb17a87cba8f3c3964"
                        }
                    ]
                }
            ]
        },
        {
            "name": "python-pycountry",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/87/c7/c2c76c3ae4ac79c74c1871ae775ed97b70d475dd90d1e824b1d2fc0cd54f/pycountry-18.12.8.tar.gz",
                    "sha256": "8ec4020b2b15cd410893d573820d42ee12fe50365332e58c0975c953b60a16de"
                }
            ]
        },
        {
            "name": "python-nose",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://pypi.python.org/packages/58/a5/0dc93c3ec33f4e281849523a5a913fa1eea9a3068acfa754d44d88107a44/nose-1.3.7.tar.gz",
                    "sha256": "f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98"
                }
            ]
        },
        {
            "name": "python-pyxdg",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/47/6e/311d5f22e2b76381719b5d0c6e9dc39cd33999adae67db71d7279a6d70f4/pyxdg-0.26.tar.gz",
                    "sha256": "fe2928d3f532ed32b39c32a482b54136fe766d19936afc96c8f00645f9da1a06"
                }
            ]
        },
        {
            "name": "python-pydbus",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/58/56/3e84f2c1f2e39b9ea132460183f123af41e3b9c8befe222a35636baa6a5a/pydbus-0.6.0.tar.gz",
                    "sha256": "4207162eff54223822c185da06c1ba8a34137a9602f3da5a528eedf3f78d0f2c"
                }
            ]
        },
        {
            "name": "python-whoosh",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/25/2b/6beed2107b148edc1321da0d489afc4617b9ed317ef7b72d4993cad9b684/Whoosh-2.7.4.tar.gz",
                    "sha256": "7ca5633dbfa9e0e0fa400d3151a8a0c4bec53bd2ecedc0a67705b17565c31a83"
                }
            ]
        },
        {
            "name": "python-psutil",
            "buildsystem": "simple",
            "build-commands": ["python3 setup.py install --prefix=/app --root=/"],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://files.pythonhosted.org/packages/e1/b0/7276de53321c12981717490516b7e612364f2cb372ee8901bd4a66a000d7/psutil-5.8.0.tar.gz",
                    "sha256": "0c9ccb99ab76025f2f0bbecf341d4656e9c1351db8cc8a03ccd62e318ab4b5c6"
                }
            ]
        },
        {
            "name": "poppler-data",
            "buildsystem": "cmake-ninja",
            "sources": [
                {
                    "type": "archive",
                    "url": "https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz",
                    "sha256": "2cec05cd1bb03af98a8b06a1e22f6e6e1a65b1e2f3816cb3069bb0874825f08c"
                }
            ]
        },
        {
            "name": "poppler",
            "buildsystem": "cmake-ninja",
            "config-opts": [
                "-DENABLE_QT5=OFF",
                "-DENABLE_QT6=OFF",
                "-DENABLE_BOOST=OFF",
                "-DENABLE_LIBOPENJPEG:STRING=none"
            ],
            "sources": [
                {
                    "type": "archive",
                    "url": "https://poppler.freedesktop.org/poppler-21.12.0.tar.xz",
                    "sha256": "acb840c2c1ec07d07e53c57c4b3a1ff3e3ee2d888d44e1e9f2f01aaf16814de7"
                }
            ]
        },
        {
            "name" : "libhandy",
            "buildsystem" : "meson",
            "builddir" : true,
            "config-opts": [
                "-Dexamples=false",
                "-Dtests=false"
            ],
            "sources" : [
                {
                    "type" : "git",
                    "url" : "https://gitlab.gnome.org/GNOME/libhandy.git",
                    "tag": "1.2.2",
                    "commit": "09f36006b26f41a2bb383b0c853e954c5792cfe1"
                }
            ]
        },
        {
            "name": "libinsane",
            "buildsystem": "meson",
            "sources": [
                {
                    "type": "git",
                    "url": "https://gitlab.gnome.org/World/OpenPaperwork/libinsane.git",
                    "branch": "master",
                    "disable-shallow-clone": true
                }
            ]
        },
        {
            "name": "python-pyocr",
            "buildsystem": "simple",
            "build-options": {
                "env": {
                    "ENABLE_SETUPTOOLS_SCM": "0"
                }
            },
            "build-commands": ["python3 ./setup.py install --prefix=/app --root=/"],
            "ensure-writable": [
                "/lib/python*/site-packages/easy-install.pth",
                "/lib/python*/site-packages/setuptools.pth"
            ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://gitlab.gnome.org/World/OpenPaperwork/pyocr.git",
                    "branch": "master",
                    "disable-shallow-clone": true
                }
            ]
        },
        {
            "name": "python-pypillowfight",
            "make-install-args": ["PIP_ARGS=--prefix=/app --root=/"],
            "no-autogen": true,
            "ensure-writable": [
                    "/lib/python*/site-packages/easy-install.pth",
                    "/lib/python*/site-packages/setuptools.pth"
            ],
            "sources": [
                {
                    "type": "git",
                    "url": "https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight.git",
                    "branch": "master",
                    "disable-shallow-clone": true
                },
                {
                    "type": "file",
                    "path": "flatpak/pypillowfight-Makefile",
                    "dest-filename": "Makefile"
                }
            ]
        },

        {
            "name": "python-paperwork",
            "make-install-args": ["PIP_ARGS=--prefix=/app --root=/"],
            "no-autogen": true,
            "ensure-writable": ["/lib/python*/site-packages/easy-install.pth","/lib/python*/site-packages/setuptools.pth"],
            "post-install": ["paperwork-gtk install --icon_base_dir=/app/share/icons --data_base_dir=/app/share"],
            "sources": [
                {
                    "type": "git",
                    "path": ".",
                    "branch": "master",
                    "disable-shallow-clone": true
                },
                {
                    "type": "file",
                    "path": "data.tar.gz"
                }
            ]
        }

    ]
}
