From a994674155376824be793d62825e503274fa9934 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:02:19 -0500 Subject: [PATCH 1/7] fix: windows junk (backslashes) --- src/decoder.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/decoder.c b/src/decoder.c index 9b3a125..6ab8349 100644 --- a/src/decoder.c +++ b/src/decoder.c @@ -71,6 +71,11 @@ expand_file_config(config_t *config, const char *arg, } } #else +#ifdef WIN32 +#define PATHSEP "\\" +#else +#define PATHSEP "/" +#endif static int file_exists(const char *path) { @@ -87,7 +92,7 @@ expand_file_config(config_t *config, const char *arg, { const char *val; if ((val = config_str(config, arg)) == NULL) { - char *tmp = string_join(hmmdir, "/", file, NULL); + char *tmp = string_join(hmmdir, PATHSEP, file, NULL); if (file_exists(tmp)) config_set_str(config, arg, tmp); else From e72cbdf759343e96cbca10d59564ce11b4b46b9b Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:21:24 -0500 Subject: [PATCH 2/7] build: also build python 3.9 (for anaconda) --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 35c54b5..7a26a44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,12 +9,12 @@ requires = [ ] build-backend = "setuptools.build_meta" [tool.cibuildwheel] -# Build the versions found in Ubuntu LTS, the stable PyPy, and 3.10 -# everywhere else +# Build the versions found in Ubuntu LTS, the stable PyPy, Anaconda on Windows build = [ "pp38*", "cp36-manylinux_*", "cp38-manylinux_*", + "cp39-win*", "cp310-*" ] # PyPy 3.8 will choke on CPython 3.8 build leftovers... From dc733daa4d640fb8dab7b87581a558fb63ae18d8 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:21:52 -0500 Subject: [PATCH 3/7] fix: actually fix hideous windows awfulness --- src/decoder.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/decoder.c b/src/decoder.c index 6ab8349..892549c 100644 --- a/src/decoder.c +++ b/src/decoder.c @@ -129,9 +129,10 @@ config_expand(config_t *config) #else /* Look for feat_params.json in acoustic model dir. */ if ((featparams = config_str(config, "featparams")) != NULL) { - FILE *json = fopen(featparams, "rt"); + /* Open in binary mode so fread() matches ftell() on Windows */ + FILE *json = fopen(featparams, "rb"); char *jsontxt; - size_t len; + size_t len, rv; if (json == NULL) return; @@ -143,8 +144,9 @@ config_expand(config_t *config) } jsontxt = malloc(len + 1); jsontxt[len] = '\0'; - if (fread(jsontxt, 1, len, json) != len) { - E_ERROR_SYSTEM("Failed to read %s", featparams); + if ((rv = fread(jsontxt, 1, len, json)) != len) { + E_ERROR_SYSTEM("Failed to read %s (got %zu not %zu)", + featparams, rv, len); ckd_free(jsontxt); return; } From 83e09deb6ee3a54ca8699dc8b1cfb9abeda4a36b Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:22:34 -0500 Subject: [PATCH 4/7] chore: update version for new python/C release --- CMakeLists.txt | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c06a20..67e1ef4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ include(CheckSymbolExists) include(CheckLibraryExists) include(TestBigEndian) -project(soundswallower VERSION 0.4.0 +project(soundswallower VERSION 0.4.1 DESCRIPTION "An even smaller speech recognizer") if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) diff --git a/setup.cfg b/setup.cfg index 9bda161..21a110b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = soundswallower -version = 0.4.0 +version = 0.4.1 description = An even smaller speech recognizer long_description = file: README.md long_description_content_type = text/markdown From 8801d6cc2e92ede99b7e70a37e9801d795d1110d Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:29:13 -0500 Subject: [PATCH 5/7] build: run tests on lesser platforms --- .github/workflows/tests.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f45b89..5c0d452 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,6 +31,28 @@ jobs: pip install . - name: Run tests run: pytest + wintest: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + run: | + pip install -r requirements.dev.txt + pip install . + - name: Run tests + run: pytest + mactest: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + run: | + pip install -r requirements.dev.txt + pip install . + - name: Run tests + run: pytest nodetest: runs-on: ubuntu-latest steps: From d272c4d1167ee0f803814b906aea5fb4b716df74 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:32:05 -0500 Subject: [PATCH 6/7] build: maybe it's called python3 on mac? --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5c0d452..6a7426a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,8 +49,8 @@ jobs: uses: actions/checkout@v3 - name: Install run: | - pip install -r requirements.dev.txt - pip install . + pip3 install -r requirements.dev.txt + pip3 install . - name: Run tests run: pytest nodetest: From 8ae0fe39336a35dae964eb771199742ebcdd56d6 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Wed, 9 Nov 2022 09:35:57 -0500 Subject: [PATCH 7/7] test: maybe pytest script not always available?!?!? --- .github/workflows/tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6a7426a..2f58ab6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,10 +27,10 @@ jobs: uses: actions/checkout@v3 - name: Install run: | - pip install -r requirements.dev.txt - pip install . + pip3 install -r requirements.dev.txt + pip3 install . - name: Run tests - run: pytest + run: python3 -m pytest wintest: runs-on: windows-latest steps: @@ -38,10 +38,10 @@ jobs: uses: actions/checkout@v3 - name: Install run: | - pip install -r requirements.dev.txt - pip install . + pip3 install -r requirements.dev.txt + pip3 install . - name: Run tests - run: pytest + run: python3 -m pytest mactest: runs-on: macos-latest steps: @@ -52,7 +52,7 @@ jobs: pip3 install -r requirements.dev.txt pip3 install . - name: Run tests - run: pytest + run: python3 -m pytest nodetest: runs-on: ubuntu-latest steps: