Skip to content

Commit

Permalink
Merge branch 'refi64-flatpak' into flatpak-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
somas95 committed Apr 20, 2019
2 parents c2b5116 + 3d26dc2 commit 9bf3014
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 92 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ debian/uberwriter/DEBIAN
debian/uberwriter/opt
debian/uberwriter/usr
flatpak/*
!flatpak/fonts-download
!flatpak/pandoc-download
!flatpak/pip-download
!flatpak/uberwriter.json
!flatpak/de.wolfvollprecht.UberWriter.*
!flatpak/flatpak_texlive.json
!flatpak/texlive_install.sh
!flatpak/python3-enchant.json
!flatpak/python3-packages.json
*.py~
data/ui/shortcut_handlers
*.ui~
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
all:
python3 ./setup.py build
.PHONY: flatpak-user-install flatpak-generate-python-modules

install:
python3 ./setup.py install --prefix=/app --skip-build --optimize=1
flatpak-user-install:
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`
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

- cd to the flatpak dir of the repo
- `flatpak-builder --install --force-clean some_folder_name uberwriter.json` (this installs and cleans the build folder)
- `make flatpak-user-install` (this installs the Flatpak)
- `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:
Expand All @@ -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`

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`
1 change: 0 additions & 1 deletion autogen.sh

This file was deleted.

1 change: 0 additions & 1 deletion configure

This file was deleted.

87 changes: 49 additions & 38 deletions flatpak/uberwriter.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"runtime": "org.gnome.Platform",
"runtime-version": "3.32",
"sdk": "org.gnome.Sdk",
"command": "uberwriter",
"command": "start-uberwriter",
"finish-args": [
"--socket=x11",
"--socket=wayland",
Expand All @@ -13,14 +13,8 @@
"--filesystem=xdg-run/dconf",
"--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.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"
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"build-options" : {
"env": {
"PYTHON": "python3"
}
},
"add-extensions": {
"de.wolfvollprecht.UberWriter.Plugin": {
"directory": "extensions",
Expand All @@ -33,7 +27,7 @@
"modules": [
{
"name": "enchant",
"config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/hunspell"],
"config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/myspell"],
"cleanup": [
"/bin"
],
Expand All @@ -46,15 +40,29 @@
]
},
{
"name": "fonts",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share/fonts/",
"cp ttf/* /app/share/fonts/"
],
"sources": [
{
"type": "git",
"url": "https://github.com/mozilla/Fira",
"tag": "4.202"
}
]
},
{
"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"
"install -Dm 755 bin/pandoc /app/bin/pandoc",
"install -Dm 755 bin/pandoc-citeproc /app/bin/pandoc-citeproc"
],
"sources": [
{
Expand All @@ -66,36 +74,39 @@
},
"de.wolfvollprecht.UberWriter.pipdeps.json",
{
"name": "fonts",
"buildsystem": "simple",
"build-commands": [
"mkdir -p /app/share/fonts/",
"cp ttf/* /app/share/fonts/"
],
"sources": [
"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": "git",
"url": "https://github.com/mozilla/Fira",
"tag": "4.202"
"type" : "dir",
"path" : "../"
}
],
"post-install": [
"install -d /app/extensions",
"glib-compile-schemas /app/share/glib-2.0/schemas"
]
},
{
"name": "uberwriter",
"sources": [
{
"type" : "git",
"url" : "../",
"branch" : "various-improvements"
}
],
"build-commands": [
"install -Dm644 data/de.wolfvollprecht.UberWriter.appdata.xml /app/share/appdata/de.wolfvollprecht.UberWriter.appdata.xml "
],
"post-install": [
"glib-compile-schemas /app/share/glib-2.0/schemas",
"install -d /app/extensions"
]
"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 \"$@\""
]
}
]
}
]
}
}
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
regex
enchant
python-gtkspellcheck
pypandoc==1.4
pyenchant
pygtkspellcheck
69 changes: 30 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2012, Wolf Vollprecht <[email protected]>
# 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
# 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
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# 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/>.
### END LICENSE

Expand All @@ -22,26 +22,20 @@
from setuptools import setup
import os

def package_files(directory):
paths = []
for (path, directories, filenames) in os.walk(directory):
def data_files(basename):
data = os.path.join('.', 'data')
root = os.path.join(data, basename)
extra_files = []
for path, directories, filenames in os.walk(root):
paths = []
for filename in filenames:
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_media_css = package_files('./data/media/css')
extra_files_media_fonts = package_files('./data/media/fonts')
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/'
extra_files_ui = data_files('ui')
extra_files_media = data_files('media')
extra_files_scripts = data_files('lua')

setup(
name='uberwriter',
Expand All @@ -51,10 +45,10 @@ def package_files(directory):
author_email='[email protected]',
description='A beautiful, simple and distraction free markdown editor.',
long_description="""UberWriter, beautiful distraction free writing
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
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
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
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
is also required that you choose to install the texlive-luatex package.""",
url='https://github.com/wolfv/uberwriter/',
# cmdclass={'install': InstallAndUpdateDataDirectory},
Expand All @@ -76,15 +70,12 @@ def package_files(directory):
'uberwriter.pylocales' : ['locales.db'],
},
data_files=[
(app_prefix + 'bin', ['bin/uberwriter']),
(app_prefix + 'share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']),
(app_prefix + 'share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']),
(app_prefix + 'share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']),
(app_prefix + 'share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']),
(app_prefix + 'share/uberwriter/data/media', ['data/media/uberwriter_markdown.md']),
(app_prefix + 'share/uberwriter/data/ui', extra_files_ui),
(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)
('bin', ['uberwriter.in']),
('share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']),
('share/metainfo', ['data/de.wolfvollprecht.UberWriter.appdata.xml']),
('share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']),
('share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']),
('share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']),
*(extra_files_ui + extra_files_media + extra_files_scripts)
]
)
1 change: 0 additions & 1 deletion uberwriter/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def get_data_path():
"""

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

Expand Down

0 comments on commit 9bf3014

Please sign in to comment.