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 perf.data
callgrind.* callgrind.*
target/ 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? ## How to build this?
cargo install --path ../akaza-core/bin/akaza-make-binary-dict cargo install --path ../bin/akaza-make-binary-dict
cargo install --path ../akaza-core/bin/akaza-make-system-lm cargo install --path ../bin/akaza-make-system-lm
make make
## PyPI's size limit ## 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 akaza.xml: akaza.xml.in
sed \ 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 install: akaza.xml
cargo install cargo install --path=. --root=$(PREFIX)
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 -m 0644 akaza.svg $(DESTDIR)$(DATADIR)/ibus-akaza install -m 0644 akaza.svg $(DESTDIR)$(DATADIR)/ibus-akaza
install -m 0644 akaza.xml $(DESTDIR)$(DATADIR)/ibus/component 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: test:
cargo test cargo test
@@ -33,5 +39,5 @@ uninstall:
clean: clean:
rm -f akaza.xml 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> <license>GPL</license>
<author>Tokuhiro Matsuno &lt;tokuhirom@gmail.com&gt;</author> <author>Tokuhiro Matsuno &lt;tokuhirom@gmail.com&gt;</author>
<homepage>https://github.com/tokuhirom/ibus-akaza</homepage> <homepage>https://github.com/tokuhirom/ibus-akaza</homepage>
<exec>@DATADIR@/ --ibus</exec> <exec>@BINARY@ --ibus</exec>
<textdomain>ibus-akaza</textdomain> <textdomain>ibus-akaza</textdomain>
<engines> <engines>
<engine> <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] #[test]
fn test_skkdict() -> anyhow::Result<()> { fn test_skkdict() -> anyhow::Result<()> {
let dictpath = 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 file = File::open(&dictpath).with_context(|| format!("path={}", &dictpath))?;
let mut buf = String::new(); let mut buf = String::new();
BufReader::new(file).read_to_string(&mut buf)?; BufReader::new(file).read_to_string(&mut buf)?;

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ mod tests {
use libakaza::graph::graph_resolver::Candidate; use libakaza::graph::graph_resolver::Candidate;
fn load_akaza() -> Result<Akaza> { 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() AkazaBuilder::default()
.system_data_dir(datadir.as_str()) .system_data_dir(datadir.as_str())
.build() .build()

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