Fangjun Kuang
Committed by GitHub

Fix building wheels for macOS (#2192)

... ... @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest]
os: [macos-13]
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313"]
steps:
... ... @@ -88,7 +88,13 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m pip install --break-system-packages --upgrade pip
python3 -m pip install --break-system-packages wheel twine==5.0.0 setuptools
opts='--break-system-packages'
v=${{ matrix.python-version }}
if [[ $v == cp38 || $v == cp39 ]]; then
opts=''
fi
python3 -m pip install $opts --upgrade pip
python3 -m pip install $opts wheel twine==5.0.0 setuptools
twine upload ./wheelhouse/*.whl
... ...
... ... @@ -35,7 +35,7 @@ std::vector<char> ReadFile(AAssetManager *mgr, const std::string &filename) {
AAsset *asset = AAssetManager_open(mgr, filename.c_str(), AASSET_MODE_BUFFER);
if (!asset) {
__android_log_print(ANDROID_LOG_FATAL, "sherpa-onnx",
"Read binary file: Load %s failed", filename.c_str());
"Read binary file: Load '%s' failed", filename.c_str());
exit(-1);
}
... ...
... ... @@ -123,9 +123,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
if (!EncodeKeywords(is, sym_, &current_ids, &current_kws, &current_scores,
&current_thresholds)) {
#if __OHOS__
SHERPA_ONNX_LOGE("Encode keywords %{public}s failed.", keywords.c_str());
SHERPA_ONNX_LOGE("Encode keywords '%{public}s' failed.",
keywords.c_str());
#else
SHERPA_ONNX_LOGE("Encode keywords %s failed.", keywords.c_str());
SHERPA_ONNX_LOGE("Encode keywords '%s' failed.", keywords.c_str());
#endif
return nullptr;
}
... ... @@ -303,10 +304,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
std::ifstream is(config_.keywords_file);
if (!is) {
#if __OHOS__
SHERPA_ONNX_LOGE("Open keywords file failed: %{public}s",
SHERPA_ONNX_LOGE("Open keywords file failed: '%{public}s'",
config_.keywords_file.c_str());
#else
SHERPA_ONNX_LOGE("Open keywords file failed: %s",
SHERPA_ONNX_LOGE("Open keywords file failed: '%s'",
config_.keywords_file.c_str());
#endif
exit(-1);
... ... @@ -325,10 +326,10 @@ class KeywordSpotterTransducerImpl : public KeywordSpotterImpl {
if (!is) {
#if __OHOS__
SHERPA_ONNX_LOGE("Open keywords file failed: %{public}s",
SHERPA_ONNX_LOGE("Open keywords file failed: '%{public}s'",
config_.keywords_file.c_str());
#else
SHERPA_ONNX_LOGE("Open keywords file failed: %s",
SHERPA_ONNX_LOGE("Open keywords file failed: '%s'",
config_.keywords_file.c_str());
#endif
exit(-1);
... ...
... ... @@ -156,7 +156,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std::vector<float> current_scores;
if (!EncodeHotwords(is, config_.model_config.modeling_unit, symbol_table_,
bpe_encoder_.get(), &current, &current_scores)) {
SHERPA_ONNX_LOGE("Encode hotwords failed, skipping, hotwords are : %s",
SHERPA_ONNX_LOGE("Encode hotwords failed, skipping, hotwords are : '%s'",
hotwords.c_str());
}
... ... @@ -252,7 +252,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std::ifstream is(config_.hotwords_file);
if (!is) {
SHERPA_ONNX_LOGE("Open hotwords file failed: %s",
SHERPA_ONNX_LOGE("Open hotwords file failed: '%s'",
config_.hotwords_file.c_str());
exit(-1);
}
... ... @@ -276,7 +276,7 @@ class OfflineRecognizerTransducerImpl : public OfflineRecognizerImpl {
std::istringstream is(std::string(buf.begin(), buf.end()));
if (!is) {
SHERPA_ONNX_LOGE("Open hotwords file failed: %s",
SHERPA_ONNX_LOGE("Open hotwords file failed: '%s'",
config_.hotwords_file.c_str());
exit(-1);
}
... ...
... ... @@ -78,12 +78,12 @@ bool WriteWave(const std::string &filename, int32_t sampling_rate,
WriteWave(buffer.data(), sampling_rate, samples, n);
std::ofstream os(filename, std::ios::binary);
if (!os) {
SHERPA_ONNX_LOGE("Failed to create %s", filename.c_str());
SHERPA_ONNX_LOGE("Failed to create '%s'", filename.c_str());
return false;
}
os << buffer;
if (!os) {
SHERPA_ONNX_LOGE("Write %s failed", filename.c_str());
SHERPA_ONNX_LOGE("Write '%s' failed", filename.c_str());
return false;
}
return true;
... ...