diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0f45b89..2f58ab6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,10 +27,32 @@ 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: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + run: | + pip3 install -r requirements.dev.txt + pip3 install . + - name: Run tests + run: python3 -m pytest + mactest: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + run: | + pip3 install -r requirements.dev.txt + pip3 install . + - name: Run tests + run: python3 -m pytest nodetest: runs-on: ubuntu-latest steps: 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/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... 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 diff --git a/src/decoder.c b/src/decoder.c index 9b3a125..892549c 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 @@ -124,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; @@ -138,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; }