Skip to content

Commit

Permalink
* Update INSTALL.md for Debian 12
Browse files Browse the repository at this point in the history
* Make error output of geo-transcript-srv.py more specific and visible in systemd yournal (closes #27)
  • Loading branch information
giggls committed Aug 26, 2023
1 parent 8a32693 commit 3053b30
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
18 changes: 10 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Currently Openstreetmap l10n uses the **Python** as well as **Lua**
programming language which unfortunatelly somewhat complicates the
installation procedure.

On Debian/Ubuntu (Currently tested on Debian 11) the most easy path for
On Debian/Ubuntu (Currently tested on Debian 12) the most easy path for
installation is as follows:

## Prerequisites
Expand All @@ -25,28 +25,30 @@ them with native Lua patterns.
### Python

```
apt install python3-icu python3-shapely python3-pip python3-sdnotify python3-requests
apt install python3-icu python3-shapely python3-pip python3-sdnotify python3-requests python3-sklearn
pip install pykakasi
pip install tltk
pip install pinyin_jyutping_sentence
pip install pykakasi -U --break-system-packages
pip install tltk -U --break-system-packages
pip install pinyin_jyutping_sentence -U --break-system-packages
```

Might need to use ``pip3`` instead of ``pip`` in older versions of Debin/Ubuntu.
I will need to find out how to get rid of this somewhat missleading
"break-system-packages" option. It won't break anything because these
packages are not available as Debian packages.

Unfortunately these libraries (especially tltk) seem to be a somewhat
moving target. Here are the versions this code has been tested with:

* pykakasi 2.2.1
* tltk 1.6.3
* tltk 1.6.8
* pinyin_jyutping_sentence 1.3

Thus if this stuff does not work try the following instead of the above pip
calls:

```
pip install pykakasi==2.2.1
pip install tltk==1.6.3
pip install tltk==1.6.8
pip install pinyin_jyutping_sentence==1.3
```

Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
osml10n (1.0.2) unstable; urgency=medium

* Make error messages of python daemon even more visible and also show them in
systemd yournal

-- Sven Geggus <[email protected]> Sat, 26 Aug 2023 13:42:47 +0200

osml10n (1.0.1) unstable; urgency=medium

* Remove stderr redirect hack from pyton daemon
Expand Down
4 changes: 2 additions & 2 deletions lua_osml10/tests/runtests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ checkoutput(osml10n.geo_transcript,"geo_transcript","běi jīng",'42','北京',{

-- Thailand
checkoutput(osml10n.geo_transcript,"geo_transcript","hongsamut prachachon",'42','ห้องสมุดประชาชน',{100, 14, 101, 15})
checkoutput(osml10n.geo_transcript,"geo_transcript","thai thanon khaosara 100",'42','thai ถนนข้าวสาร 100',{100, 14, 101, 15})
checkoutput(osml10n.geo_transcript,"geo_transcript","anusawari phraya rat da nu pradit",'42','อนุสาวรีย์พระยารัษฎาณุประดิษฐ์',{100, 14, 101, 15})
checkoutput(osml10n.geo_transcript,"geo_transcript","thai thanon khaosan 100",'42','thai ถนนข้าวสาร 100',{100, 14, 101, 15})
checkoutput(osml10n.geo_transcript,"geo_transcript","anusawari phraya ratsa da nu pradit",'42','อนุสาวรีย์พระยารัษฎาณุประดิษฐ์',{100, 14, 101, 15})

-- Macau
checkoutput(osml10n.geo_transcript,"geo_transcript","hōeng góng",'42',"香港",{113.54, 22.16, 113.58, 22.2})
Expand Down
19 changes: 16 additions & 3 deletions transcription-daemon/geo-transcript-srv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,28 @@ def vout(msg):
try:
# Kanji in JP
import pykakasi
except Exception as ex:
sys.stderr.write("\nERROR: unable to load python module pykakasi! Probably the following command will work:\n")
sys.stderr.write("pip install pykakasi\n\n")
sys.stderr.write("Error message was:\n%s\n" % ex)
sys.exit(1)

try:
# thai language in TH
import tltk
except Exception as ex:
sys.stderr.write("\nERROR: unable to load python module tltk! Probably the following command will work:\n")
sys.stderr.write("pip install tltk\n\n")
sys.stderr.write("Error message was:\n%s\n" % ex)
sys.exit(1)

try:
# Cantonese transcription
import pinyin_jyutping_sentence
except:
sys.stderr.write("\nERROR: unable to load required python modules, please install them as follows:\n")
sys.stderr.write("pip install pykakasi\npip install tltk\npip install pinyin_jyutping_sentence\n\n")
except Exception as ex:
sys.stderr.write("\nERROR: unable to load python module pinyin_jyutping_sentence! Probably the following command will work:\n")
sys.stderr.write("pip install pinyin_jyutping_sentence\n\n")
sys.stderr.write("Error message was:\n%s\n" % ex)
sys.exit(1)

def split_by_alphabet(str):
Expand Down
1 change: 0 additions & 1 deletion transcription-daemon/geo-transcript-srv.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Type=notify
NotifyAccess=all
User=nobody
Group=nogroup
StandardError=null

ExecStart=/usr/local/bin/geo-transcript-srv.py -s -g /usr/local/share/osml10n/boundaries
# Max number of open files
Expand Down

0 comments on commit 3053b30

Please sign in to comment.