Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
sudo: false
cache:
directories:
- $HOME/miniconda
- $HOME/kaldi
timeout: 1000
branches:
only:
- master
language: python
matrix:
include:
- python: 2.7
before_install:
- # Setup Python environment with BLAS libraries
- export SKIP=1
- function skip_rest { export SKIP=0; }
- function skip { return $SKIP; }
- ./install/install_conda.sh || skip_rest
- export PATH=$HOME/miniconda/bin:$PATH
- conda update -q --yes conda
- conda install -q --yes python=$TRAVIS_PYTHON_VERSION gcc pip
- conda install -q --yes boost
- (skip || ./install/install_kaldi_deps.sh) || skip_rest
- skip || ./install/install_kaldi.sh || skip_rest
- export KALDI_ROOT=$HOME/kaldi/
install:
- skip || conda install --yes numpy
script:
- pip install --upgrade --force-reinstall -v . # Tests setup.py
- ls /home/travis/miniconda/lib/python2.7/site-packages/kaldi_io/
- ls $HOME/kaldi/src/decoder
- python -c "import kaldi_io"
- python -c "import kaldi_io.kaldi_io_internal"
17 changes: 17 additions & 0 deletions install/install_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ -f $HOME/miniconda/CONDA_INSTALLED ]; then
echo "miniconda is installed"
exit 0
fi

rm -r $HOME/miniconda

if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then
wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
else
wget -q http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
fi
chmod +x miniconda.sh
./miniconda.sh -b -p $HOME/miniconda
touch $HOME/miniconda/CONDA_INSTALLED
exit 1
13 changes: 13 additions & 0 deletions install/install_kaldi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh
if [ -f $HOME/kaldi/KALDI_INSTALLED ]; then
echo "kaldi dir is not empty"
exit 0
fi
cd $HOME/kaldi/src
export CXXFLAGS="-fPIC":$CXXFLAGS
export CFLAGS="-fPIC":$CFLAGS
./configure --static --use-cuda=no --openblas-root=$HOME/kaldi/tools/OpenBLAS/install
make depend
make -j 4
touch $HOME/kaldi/KALDI_INSTALLED
exit 1
13 changes: 13 additions & 0 deletions install/install_kaldi_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh
if [ -f $HOME/kaldi/KALDI_DEPS_INSTALLED ]; then
echo "kaldi deps are installed"
exit 0
fi
git clone https://github.com/kaldi-asr/kaldi.git $HOME/kaldi
cd $HOME/kaldi/tools
./extras/check_dependencies.sh
make
cd $HOME/kaldi/tools
./extras/install_openblas.sh
touch $HOME/kaldi/KALDI_DEPS_INSTALLED
exit 1
3 changes: 2 additions & 1 deletion kaldi_io/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

all:
EXTRA_CXXFLAGS = -Wno-sign-compare
CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD) -shared -fPIC

KALDI_SRC = $(KALDI_ROOT)/src

Expand Down Expand Up @@ -28,7 +29,7 @@ PYLIBS = kaldi_io_internal.so
#include $(KALDI_SRC)/makefiles/default_rules.mk

%.so: %.cpp
g++ -shared -o $@ -Wall -fPIC -I$(KALDI_SRC) $(PYINC) $(NPINC) $(CXXFLAGS) $< $(ADDLIBS) $(LDFLAGS) -L$(PYLIB) $(LOADLIBES) $(LDLIBS) -lpython2.7 -lboost_python -lboost_system
g++ -o $@ -I$(KALDI_SRC) $(PYINC) $(NPINC) $< $(ADDLIBS) $(LDFLAGS) $(PYLIB) $(LOADLIBES) $(LDLIBS) -lboost_python -lboost_system

clean:
-rm -f *.o *.a *.so $(TESTFILES) $(BINFILES) $(TESTOUTPUTS) tmp* *.tmp
Expand Down
2 changes: 1 addition & 1 deletion kaldi_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@


import numpy as np
from kaldi_io_internal import *
from .kaldi_io_internal import *

if KALDI_BASE_FLOAT()==np.float64:
RandomAccessBaseFloatMatrixReader = RandomAccessFloat64MatrixReader
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

class Make(build):
def run(self):
os.system("make")
exit_code = os.system("make")
if exit_code != 0:
raise Exception(
"make returned: {}".format(exit_code))
build.run(self)

setup(name='kaldi-python',
Expand Down