Skip to content

Commit 9bf3014

Browse files
committed
Merge branch 'refi64-flatpak' into flatpak-improvements
2 parents c2b5116 + 3d26dc2 commit 9bf3014

File tree

9 files changed

+92
-92
lines changed

9 files changed

+92
-92
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ debian/uberwriter/DEBIAN
66
debian/uberwriter/opt
77
debian/uberwriter/usr
88
flatpak/*
9-
!flatpak/fonts-download
10-
!flatpak/pandoc-download
11-
!flatpak/pip-download
129
!flatpak/uberwriter.json
1310
!flatpak/de.wolfvollprecht.UberWriter.*
1411
!flatpak/flatpak_texlive.json
1512
!flatpak/texlive_install.sh
13+
!flatpak/python3-enchant.json
14+
!flatpak/python3-packages.json
1615
*.py~
1716
data/ui/shortcut_handlers
1817
*.ui~

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
all:
2-
python3 ./setup.py build
1+
.PHONY: flatpak-user-install flatpak-generate-python-modules
32

4-
install:
5-
python3 ./setup.py install --prefix=/app --skip-build --optimize=1
3+
flatpak-user-install:
4+
cd flatpak; flatpak-builder --force-clean --install --user _build uberwriter.json
65

6+
flatpak-generate-python-modules:
7+
# gtkspellcheck's setup.py wants enchant to already be installed
8+
flatpak-pip-generator --output flatpak/python3-enchant.json pyenchant
9+
flatpak-pip-generator --output flatpak/python3-packages.json `grep -v enchant requirements.txt`

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ but you'll need to install and compile the schemas before:
3434

3535
It's also possible to build, run and debug a flatpak package. You'll need flatpak-builder for this:
3636

37-
- cd to the flatpak dir of the repo
38-
- `flatpak-builder --install --force-clean some_folder_name uberwriter.json` (this installs and cleans the build folder)
37+
- `make flatpak-user-install` (this installs the Flatpak)
3938
- `flatpak run de.wolfvollprecht.UberWriter`
4039

4140
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
5453

5554
You can also debug it with the following: `flatpak-builder --run --share=network some_folder_name uberwriter.json sh`
5655

57-
If you want to install it using setuptools, simply run `python3 setup.py build install`
56+
If you want to install it using setuptools, simply run `python3 setup.py build install`

autogen.sh

Lines changed: 0 additions & 1 deletion
This file was deleted.

configure

Lines changed: 0 additions & 1 deletion
This file was deleted.

flatpak/uberwriter.json

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"runtime": "org.gnome.Platform",
44
"runtime-version": "3.32",
55
"sdk": "org.gnome.Sdk",
6-
"command": "uberwriter",
6+
"command": "start-uberwriter",
77
"finish-args": [
88
"--socket=x11",
99
"--socket=wayland",
@@ -13,14 +13,8 @@
1313
"--filesystem=xdg-run/dconf",
1414
"--filesystem=~/.config/dconf:ro",
1515
"--talk-name=ca.desrt.dconf",
16-
"--env=DCONF_USER_CONFIG_DIR=.config/dconf",
17-
"--env=PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/x86_64-linux:/app/bin:/usr/bin"
16+
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
1817
],
19-
"build-options" : {
20-
"env": {
21-
"PYTHON": "python3"
22-
}
23-
},
2418
"add-extensions": {
2519
"de.wolfvollprecht.UberWriter.Plugin": {
2620
"directory": "extensions",
@@ -33,7 +27,7 @@
3327
"modules": [
3428
{
3529
"name": "enchant",
36-
"config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/hunspell"],
30+
"config-opts": ["--disable-static", "--with-myspell-dir=/usr/share/myspell"],
3731
"cleanup": [
3832
"/bin"
3933
],
@@ -46,15 +40,29 @@
4640
]
4741
},
4842
{
43+
"name": "fonts",
44+
"buildsystem": "simple",
45+
"build-commands": [
46+
"mkdir -p /app/share/fonts/",
47+
"cp ttf/* /app/share/fonts/"
48+
],
49+
"sources": [
50+
{
51+
"type": "git",
52+
"url": "https://github.com/mozilla/Fira",
53+
"tag": "4.202"
54+
}
55+
]
56+
},
57+
{
4958
"name": "pandoc",
5059
"only-arches": [
5160
"x86_64"
5261
],
5362
"buildsystem": "simple",
5463
"build-commands": [
55-
"mkdir -p /app/bin",
56-
"cp bin/pandoc /app/bin/pandoc",
57-
"cp bin/pandoc-citeproc /app/bin/pandoc-citeproc"
64+
"install -Dm 755 bin/pandoc /app/bin/pandoc",
65+
"install -Dm 755 bin/pandoc-citeproc /app/bin/pandoc-citeproc"
5866
],
5967
"sources": [
6068
{
@@ -66,36 +74,39 @@
6674
},
6775
"de.wolfvollprecht.UberWriter.pipdeps.json",
6876
{
69-
"name": "fonts",
70-
"buildsystem": "simple",
71-
"build-commands": [
72-
"mkdir -p /app/share/fonts/",
73-
"cp ttf/* /app/share/fonts/"
74-
],
75-
"sources": [
77+
"name": "uberwriter",
78+
"buildsystem": "simple",
79+
"build-commands": [
80+
"desktop-file-edit --set-key=Exec --set-value='uberwriter.in %U' data/de.wolfvollprecht.UberWriter.desktop",
81+
"python3 -m pip install --prefix=/app --install-option=--optimize=1 ."
82+
],
83+
"sources": [
7684
{
77-
"type": "git",
78-
"url": "https://github.com/mozilla/Fira",
79-
"tag": "4.202"
85+
"type" : "dir",
86+
"path" : "../"
8087
}
88+
],
89+
"post-install": [
90+
"install -d /app/extensions",
91+
"glib-compile-schemas /app/share/glib-2.0/schemas"
8192
]
8293
},
8394
{
84-
"name": "uberwriter",
85-
"sources": [
86-
{
87-
"type" : "git",
88-
"url" : "../",
89-
"branch" : "various-improvements"
90-
}
91-
],
92-
"build-commands": [
93-
"install -Dm644 data/de.wolfvollprecht.UberWriter.appdata.xml /app/share/appdata/de.wolfvollprecht.UberWriter.appdata.xml "
94-
],
95-
"post-install": [
96-
"glib-compile-schemas /app/share/glib-2.0/schemas",
97-
"install -d /app/extensions"
98-
]
95+
"name": "scripts",
96+
"buildsystem": "simple",
97+
"build-commands": [
98+
"install -Dm 755 start-uberwriter.sh /app/bin/start-uberwriter"
99+
],
100+
"sources": [
101+
{
102+
"type": "script",
103+
"dest-filename": "start-uberwriter.sh",
104+
"commands": [
105+
"export PATH=/app/extensions/TexLive/bin:/app/extensions/TexLive/2018/bin/$(uname -a)-linux:$PATH",
106+
"exec uberwriter.in \"$@\""
107+
]
108+
}
109+
]
99110
}
100111
]
101-
}
112+
}

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
regex
2-
enchant
3-
python-gtkspellcheck
42
pypandoc==1.4
3+
pyenchant
4+
pygtkspellcheck

setup.py

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
33
### BEGIN LICENSE
44
# Copyright (C) 2012, Wolf Vollprecht <w.vollprecht@gmail.com>
5-
# This program is free software: you can redistribute it and/or modify it
6-
# under the terms of the GNU General Public License version 3, as published
5+
# This program is free software: you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 3, as published
77
# by the Free Software Foundation.
8-
#
9-
# This program is distributed in the hope that it will be useful, but
10-
# WITHOUT ANY WARRANTY; without even the implied warranties of
11-
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
8+
#
9+
# This program is distributed in the hope that it will be useful, but
10+
# WITHOUT ANY WARRANTY; without even the implied warranties of
11+
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1212
# PURPOSE. See the GNU General Public License for more details.
13-
#
14-
# You should have received a copy of the GNU General Public License along
13+
#
14+
# You should have received a copy of the GNU General Public License along
1515
# with this program. If not, see <http://www.gnu.org/licenses/>.
1616
### END LICENSE
1717

@@ -22,26 +22,20 @@
2222
from setuptools import setup
2323
import os
2424

25-
def package_files(directory):
26-
paths = []
27-
for (path, directories, filenames) in os.walk(directory):
25+
def data_files(basename):
26+
data = os.path.join('.', 'data')
27+
root = os.path.join(data, basename)
28+
extra_files = []
29+
for path, directories, filenames in os.walk(root):
30+
paths = []
2831
for filename in filenames:
2932
paths.append(os.path.join(path, filename))
30-
return paths
33+
extra_files.append(('share/uberwriter/data/{}'.format(os.path.relpath(path, data)), paths))
34+
return extra_files
3135

32-
extra_files_ui = package_files('./data/ui')
33-
extra_files_media_css = package_files('./data/media/css')
34-
extra_files_media_fonts = package_files('./data/media/fonts')
35-
extra_files_scripts = package_files('./data/lua')
36-
from pprint import pprint
37-
pprint(extra_files_ui)
38-
pprint(extra_files_media_css)
39-
pprint(extra_files_media_fonts)
40-
41-
if os.path.isfile("/.flatpak-info"):
42-
app_prefix = '/app/'
43-
else:
44-
app_prefix = '/usr/'
36+
extra_files_ui = data_files('ui')
37+
extra_files_media = data_files('media')
38+
extra_files_scripts = data_files('lua')
4539

4640
setup(
4741
name='uberwriter',
@@ -51,10 +45,10 @@ def package_files(directory):
5145
author_email='w.vollprecht@gmail.com',
5246
description='A beautiful, simple and distraction free markdown editor.',
5347
long_description="""UberWriter, beautiful distraction free writing
54-
With UberWriter you get only one thing: An empty textbox, that is to
55-
fill with your ideas. There are no settings, you don't have to choose a
56-
font, it is only for writing.You can use markdown for all your markup
57-
needs. PDF, RTF and HTML are generated with pandoc. For PDF generation it
48+
With UberWriter you get only one thing: An empty textbox, that is to
49+
fill with your ideas. There are no settings, you don't have to choose a
50+
font, it is only for writing.You can use markdown for all your markup
51+
needs. PDF, RTF and HTML are generated with pandoc. For PDF generation it
5852
is also required that you choose to install the texlive-luatex package.""",
5953
url='https://github.com/wolfv/uberwriter/',
6054
# cmdclass={'install': InstallAndUpdateDataDirectory},
@@ -76,15 +70,12 @@ def package_files(directory):
7670
'uberwriter.pylocales' : ['locales.db'],
7771
},
7872
data_files=[
79-
(app_prefix + 'bin', ['bin/uberwriter']),
80-
(app_prefix + 'share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']),
81-
(app_prefix + 'share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']),
82-
(app_prefix + 'share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']),
83-
(app_prefix + 'share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']),
84-
(app_prefix + 'share/uberwriter/data/media', ['data/media/uberwriter_markdown.md']),
85-
(app_prefix + 'share/uberwriter/data/ui', extra_files_ui),
86-
(app_prefix + 'share/uberwriter/data/media/css', extra_files_media_css),
87-
(app_prefix + 'share/uberwriter/data/media/fonts', extra_files_media_fonts),
88-
(app_prefix + 'share/uberwriter/data/lua', extra_files_scripts)
73+
('bin', ['uberwriter.in']),
74+
('share/applications', ['data/de.wolfvollprecht.UberWriter.desktop']),
75+
('share/metainfo', ['data/de.wolfvollprecht.UberWriter.appdata.xml']),
76+
('share/icons/hicolor/scalable/apps', ['data/media/de.wolfvollprecht.UberWriter.svg']),
77+
('share/icons/hicolor/symbolic/apps', ['data/media/de.wolfvollprecht.UberWriter-symbolic.svg']),
78+
('share/glib-2.0/schemas', ['data/de.wolfvollprecht.UberWriter.gschema.xml']),
79+
*(extra_files_ui + extra_files_media + extra_files_scripts)
8980
]
9081
)

uberwriter/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def get_data_path():
5353
"""
5454

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

0 commit comments

Comments
 (0)