Skip to content

Commit

Permalink
Merge pull request #31 from ReadAlongs/fix_windows_junk
Browse files Browse the repository at this point in the history
Work around Windows damage, run CI on lesser platforms
  • Loading branch information
dhdaines committed Nov 9, 2022
2 parents 9bbfdf3 + 8ae0fe3 commit b25c75d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 12 additions & 5 deletions src/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit b25c75d

Please sign in to comment.