change directory structure for better DX

This commit is contained in:
Tokuhiro Matsuno
2023-01-06 08:39:52 +09:00
parent 363b4b9dee
commit cfb6f3714d
105 changed files with 48 additions and 26 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ dist/
perf.data
callgrind.*
target/
/.idea/

View File

View File

@ -1 +0,0 @@
/.idea/

View File

@ -1 +0,0 @@
/akaza.xml

View File

@ -1,11 +0,0 @@
Current status: WIP!
## Debugging
cargo build
pkill -f ibus-akaza
ibus engine akaza
if you want to debug `ibus-akaza`, you can use ibus-akaza-debug.sh.
Rewrite /usr/ibus/components/akaza.xml and set path to ibus-akaza.

View File

@ -6,8 +6,8 @@ System dictionary/language model package for Akaza.
## How to build this?
cargo install --path ../akaza-core/bin/akaza-make-binary-dict
cargo install --path ../akaza-core/bin/akaza-make-system-lm
cargo install --path ../bin/akaza-make-binary-dict
cargo install --path ../bin/akaza-make-system-lm
make
## PyPI's size limit

3
ibus-akaza/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/akaza.xml
/akaza-debug.xml

View File

@ -13,17 +13,23 @@ all: akaza.xml
akaza.xml: akaza.xml.in
sed \
-e "s:@DATADIR@:$(DATADIR):g" $< > $@
-e "s:@BINARY@:$(PREFIX)/bin/ibus-akaza:g" \
-e "s:@DATADIR@:$(DATADIR)/ibus-akaza/:g" $< > $@
akaza-debug.xml: akaza.xml.in
sed \
-e "s:@BINARY@:${PWD}/ibus-akaza-debug.sh:g" \
-e "s:@DATADIR@:$(DATADIR)/ibus-akaza/:g" $< > $@
install: ibus_akaza/config.py akaza.xml po/ja.mo
cargo install
install -m 0755 -d $(DESTDIR)$(DATADIR)/ibus-akaza/ibus_akaza $(DESTDIR)$(SYSCONFDIR)/xdg/akaza $(DESTDIR)$(DATADIR)/ibus/component
install -m 0755 -d $(DESTDIR)$(DATADIR)/locale
install: akaza.xml
cargo install --path=. --root=$(PREFIX)
install -m 0644 akaza.svg $(DESTDIR)$(DATADIR)/ibus-akaza
install -m 0644 akaza.xml $(DESTDIR)$(DATADIR)/ibus/component
install-debug: akaza-debug.xml
install -m 0644 akaza-debug.xml $(DESTDIR)$(DATADIR)/ibus/component/akaza.xml
test:
cargo test
@ -33,5 +39,5 @@ uninstall:
clean:
rm -f akaza.xml
.PHONY: all test install uninstall clean
.PHONY: all test install uninstall clean install-debug

16
ibus-akaza/README.md Normal file
View File

@ -0,0 +1,16 @@
# ibus-akaza
akaza の ibus binding です。
開発状態: 一応動きますが、まだ未実装の機能があります。
## install
`make && sudo make install` してください。
## Debugging
`sudo make install-debug` とすると、`../target/debug/ibus-akaza` を利用して起動するように `/usr/share/ibus/component/akaza.xml` が設定されます。
この状態で `./debug.sh` すると、ibus が再起動されて、ログファイルが表示されるようになります。

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -7,7 +7,7 @@
<license>GPL</license>
<author>Tokuhiro Matsuno &lt;tokuhirom@gmail.com&gt;</author>
<homepage>https://github.com/tokuhirom/ibus-akaza</homepage>
<exec>@DATADIR@/ --ibus</exec>
<exec>@BINARY@ --ibus</exec>
<textdomain>ibus-akaza</textdomain>
<engines>
<engine>

View File

@ -0,0 +1,9 @@
python 時代のコード。
akaza の実装は以下のように変遷を辿っている
1. full python
2. UI:python, Logic:C++
3. full Rust
現在は full rust になっているがUIまわりについては、Python時代にはあったが rust に未移植のものがあるため、参考のためにこのディレクトリに残している。

View File

@ -64,7 +64,7 @@ mod tests {
#[test]
fn test_skkdict() -> anyhow::Result<()> {
let dictpath =
env!("CARGO_MANIFEST_DIR").to_string() + "/../../akaza-data/dict/SKK-JISYO.akaza";
env!("CARGO_MANIFEST_DIR").to_string() + "/../akaza-data/dict/SKK-JISYO.akaza";
let file = File::open(&dictpath).with_context(|| format!("path={}", &dictpath))?;
let mut buf = String::new();
BufReader::new(file).read_to_string(&mut buf)?;

View File

@ -10,7 +10,7 @@ mod tests {
}
fn datadir() -> String {
basedir() + "/../../akaza-data/data/"
basedir() + "/../akaza-data/data/"
}
fn load_unigram() -> SystemUnigramLM {

View File

@ -7,7 +7,7 @@ mod tests {
}
fn datadir() -> String {
basedir() + "/../../akaza-data/data/"
basedir() + "/../akaza-data/data/"
}
#[test]

View File

@ -8,7 +8,7 @@ mod tests {
use libakaza::graph::graph_resolver::Candidate;
fn load_akaza() -> Result<Akaza> {
let datadir = env!("CARGO_MANIFEST_DIR").to_string() + "/../../akaza-data/data/";
let datadir = env!("CARGO_MANIFEST_DIR").to_string() + "/../akaza-data/data/";
AkazaBuilder::default()
.system_data_dir(datadir.as_str())
.build()

Some files were not shown because too many files have changed in this diff Show More