flatpak improvements

github/fork/yochananmarqos/patch-1
Manuel Genovés 2019-04-20 18:24:21 +02:00
commit 3d26dc2b25
9 changed files with 99 additions and 99 deletions

5
.gitignore vendored
View File

@ -6,13 +6,12 @@ debian/uberwriter/DEBIAN
debian/uberwriter/opt debian/uberwriter/opt
debian/uberwriter/usr debian/uberwriter/usr
flatpak/* flatpak/*
!flatpak/fonts-download
!flatpak/pandoc-download
!flatpak/pip-download
!flatpak/uberwriter.json !flatpak/uberwriter.json
!flatpak/de.wolfvollprecht.UberWriter.* !flatpak/de.wolfvollprecht.UberWriter.*
!flatpak/flatpak_texlive.json !flatpak/flatpak_texlive.json
!flatpak/texlive_install.sh !flatpak/texlive_install.sh
!flatpak/python3-enchant.json
!flatpak/python3-packages.json
*.py~ *.py~
data/ui/shortcut_handlers data/ui/shortcut_handlers
*.ui~ *.ui~

View File

@ -1,6 +1,9 @@
all: .PHONY: flatpak-user-install flatpak-generate-python-modules
python3 ./setup.py build
install: flatpak-user-install:
python3 ./setup.py install --prefix=/app --skip-build --optimize=1 cd flatpak; flatpak-builder --force-clean --install --user _build uberwriter.json
flatpak-generate-python-modules:
# gtkspellcheck's setup.py wants enchant to already be installed
flatpak-pip-generator --output flatpak/python3-enchant.json pyenchant
flatpak-pip-generator --output flatpak/python3-packages.json `grep -v enchant requirements.txt`

View File

@ -34,8 +34,7 @@ but you'll need to install and compile the schemas before:
It's also possible to build, run and debug a flatpak package. You'll need flatpak-builder for this: It's also possible to build, run and debug a flatpak package. You'll need flatpak-builder for this:
- cd to the flatpak dir of the repo - `make flatpak-user-install` (this installs the Flatpak)
- `flatpak-builder --install --force-clean some_folder_name uberwriter.json` (this installs and cleans the build folder)
- `flatpak run de.wolfvollprecht.UberWriter` - `flatpak run de.wolfvollprecht.UberWriter`
If you can't find Uberwriter after this, it's due to a Flatpak bug. Try to export it to a local repo before installing it: If you can't find Uberwriter after this, it's due to a Flatpak bug. Try to export it to a local repo before installing it:
@ -54,4 +53,4 @@ If you want to update an existing installation, just run
You can also debug it with the following: `flatpak-builder --run --share=network some_folder_name uberwriter.json sh` You can also debug it with the following: `flatpak-builder --run --share=network some_folder_name uberwriter.json sh`
If you want to install it using setuptools, simply run `python3 setup.py build install` If you want to install it using setuptools, simply run `python3 setup.py build install`

View File

@ -1 +0,0 @@

1
configure vendored
View File

@ -1 +0,0 @@

View File

@ -3,7 +3,7 @@
"runtime": "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version": "3.32", "runtime-version": "3.32",
"sdk": "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command": "uberwriter", "command": "start-uberwriter",
"finish-args": [ "finish-args": [
"--socket=x11", "--socket=x11",
"--socket=wayland", "--socket=wayland",
@ -13,14 +13,8 @@
"--filesystem=xdg-run/dconf", "--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro", "--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf", "--talk-name=ca.desrt.dconf",
"--env=DCONF_USER_CONFIG_DIR=.config/dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
"--env=PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/x86_64-linux:/app/bin:/usr/bin"
], ],
"build-options" : {
"env": {
"PYTHON": "python3"
}
},
"add-extensions": { "add-extensions": {
"de.wolfvollprecht.UberWriter.Plugin": { "de.wolfvollprecht.UberWriter.Plugin": {
"directory": "extensions", "directory": "extensions",
@ -33,7 +27,7 @@
"modules": [ "modules": [
{ {
"name": "enchant", "name": "enchant",
"config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/hunspell"], "config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/myspell"],
"cleanup": [ "cleanup": [
"/bin" "/bin"
], ],
@ -46,26 +40,6 @@
] ]
}, },
{ {
"name": "pandoc",
"only-arches": [
"x86_64"
],
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/bin",
"cp bin/pandoc /app/bin/pandoc",
"cp bin/pandoc-citeproc /app/bin/pandoc-citeproc"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz",
"sha256": "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed"
}
]
},
"de.wolfvollprecht.UberWriter.pipdeps.json",
{
"name": "fonts", "name": "fonts",
"buildsystem": "simple", "buildsystem": "simple",
"build-commands": [ "build-commands": [
@ -81,21 +55,58 @@
] ]
}, },
{ {
"name": "uberwriter", "name": "pandoc",
"sources": [ "only-arches": [
{ "x86_64"
"type" : "git", ],
"url" : "../", "buildsystem": "simple",
"branch" : "various-improvements" "build-commands": [
} "install -Dm 755 bin/pandoc /app/bin/pandoc",
], "install -Dm 755 bin/pandoc-citeproc /app/bin/pandoc-citeproc"
"build-commands": [ ],
"install -Dm644 data/de.wolfvollprecht.UberWriter.appdata.xml /app/share/appdata/de.wolfvollprecht.UberWriter.appdata.xml " "sources": [
], {
"post-install": [ "type": "archive",
"glib-compile-schemas /app/share/glib-2.0/schemas", "url": "https://github.com/jgm/pandoc/releases/download/2.2/pandoc-2.2-linux.tar.gz",
"install -d /app/extensions" "sha256": "06ecd882e42ef9b7390b1c82e1e71b3ea48679181289b9b810a8797825bed8ed"
] }
]
},
"de.wolfvollprecht.UberWriter.pipdeps.json",
{
"name": "uberwriter",
"buildsystem": "simple",
"build-commands": [
"desktop-file-edit --set-key=Exec --set-value='uberwriter.in %U' data/de.wolfvollprecht.UberWriter.desktop",
"python3 -m pip install --prefix=/app --install-option=--optimize=1 ."
],
"sources": [
{
"type" : "dir",
"path" : "../"
}
],
"post-install": [
"install -d /app/extensions",
"glib-compile-schemas /app/share/glib-2.0/schemas"
]
},
{
"name": "scripts",
"buildsystem": "simple",
"build-commands": [
"install -Dm 755 start-uberwriter.sh /app/bin/start-uberwriter"
],
"sources": [
{
"type": "script",
"dest-filename": "start-uberwriter.sh",
"commands": [
"export PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/$(uname -a)-linux:$PATH",
"exec uberwriter.in \"$@\""
]
}
]
} }
] ]
} }

View File

@ -1,4 +1,4 @@
regex regex
enchant
python-gtkspellcheck
pypandoc==1.4 pypandoc==1.4
pyenchant
pygtkspellcheck

View File

@ -2,16 +2,16 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE ### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com> # Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
# This program is free software: you can redistribute it and/or modify it # This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published # under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation. # by the Free Software Foundation.
# #
# This program is distributed in the hope that it will be useful, but # This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of # WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details. # PURPOSE. See the GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License along # You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>. # with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE ### END LICENSE
@ -22,26 +22,20 @@
from setuptools import setup from setuptools import setup
import os import os
def package_files(directory): def data_files(basename):
paths = [] data = os.path.join('.', 'data')
for (path, directories, filenames) in os.walk(directory): root = os.path.join(data, basename)
extra_files = []
for path, directories, filenames in os.walk(root):
paths = []
for filename in filenames: for filename in filenames:
paths.append(os.path.join(path, filename)) paths.append(os.path.join(path, filename))
return paths extra_files.append(('share/uberwriter/data/{}'.format(os.path.relpath(path, data)), paths))
return extra_files
extra_files_ui = package_files('./data/ui') extra_files_ui = data_files('ui')
extra_files_media_css = package_files('./data/media/css') extra_files_media = data_files('media')
extra_files_media_fonts = package_files('./data/media/fonts') extra_files_scripts = data_files('lua')
extra_files_scripts = package_files('./data/lua')
from pprint import pprint
pprint(extra_files_ui)
pprint(extra_files_media_css)
pprint(extra_files_media_fonts)
if os.path.isfile("/.flatpak-info"):
app_prefix = '/app/'
else:
app_prefix = '/usr/'
setup( setup(
name='uberwriter', name='uberwriter',
@ -51,10 +45,10 @@ setup(
author_email='w.vollprecht@gmail.com', author_email='w.vollprecht@gmail.com',
description='A beautiful, simple and distraction free markdown editor.', description='A beautiful, simple and distraction free markdown editor.',
long_description="""UberWriter, beautiful distraction free writing long_description="""UberWriter, beautiful distraction free writing
With UberWriter you get only one thing: An empty textbox, that is to With UberWriter you get only one thing: An empty textbox, that is to
fill with your ideas. There are no settings, you don't have to choose a fill with your ideas. There are no settings, you don't have to choose a
font, it is only for writing.You can use markdown for all your markup font, it is only for writing.You can use markdown for all your markup
needs. PDF, RTF and HTML are generated with pandoc. For PDF generation it needs. PDF, RTF and HTML are generated with pandoc. For PDF generation it
is also required that you choose to install the texlive-luatex package.""", is also required that you choose to install the texlive-luatex package.""",
url='https://github.com/wolfv/uberwriter/', url='https://github.com/wolfv/uberwriter/',
# cmdclass={'install': InstallAndUpdateDataDirectory}, # cmdclass={'install': InstallAndUpdateDataDirectory},
@ -76,15 +70,12 @@ setup(
'uberwriter.pylocales' : ['locales.db'], 'uberwriter.pylocales' : ['locales.db'],
}, },
data_files=[ data_files=[
(app_prefix + 'bin', ['bin/uberwriter']), ('bin', ['uberwriter.in']),
(app_prefix + 'share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']), ('share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']),
(app_prefix + 'share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']), ('share/metainfo', ['data/de.wolfvollprecht.UberWriter.appdata.xml']),
(app_prefix + 'share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']), ('share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']),
(app_prefix + 'share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']), ('share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']),
(app_prefix + 'share/uberwriter/data/media', ['data/media/uberwriter_markdown.md']), ('share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']),
(app_prefix + 'share/uberwriter/data/ui', extra_files_ui), *(extra_files_ui + extra_files_media + extra_files_scripts)
(app_prefix + 'share/uberwriter/data/media/css', extra_files_media_css),
(app_prefix + 'share/uberwriter/data/media/fonts', extra_files_media_fonts),
(app_prefix + 'share/uberwriter/data/lua', extra_files_scripts)
] ]
) )

View File

@ -53,7 +53,6 @@ def get_data_path():
""" """
# Get pathname absolute or relative. # Get pathname absolute or relative.
# TODO: Abstract this (the old env IN_FLATPAK)
if os.path.isfile("/.flatpak-info"): if os.path.isfile("/.flatpak-info"):
return '/app/share/uberwriter/data/' return '/app/share/uberwriter/data/'