diff --git a/native_client/Makefile b/native_client/Makefile index 32a65ca4..5e3d3d41 100644 --- a/native_client/Makefile +++ b/native_client/Makefile @@ -35,7 +35,7 @@ MANIFEST.in: bindings-package: MANIFEST.in cat MANIFEST.in - $(NUMPY_INCLUDE) python ./setup.py bdist_wheel $(PYTHON_PLATFORM_NAME) + $(NUMPY_INCLUDE) python ./setup.py bdist_wheel $(PYTHON_PLATFORM_NAME) $(SETUP_FLAGS) bindings: bindings-build bindings-package diff --git a/native_client/setup.py b/native_client/setup.py index 9afe1f76..1aeba658 100755 --- a/native_client/setup.py +++ b/native_client/setup.py @@ -5,6 +5,7 @@ from distutils.command.build import build import os import subprocess +import sys try: import numpy @@ -18,6 +19,13 @@ except ImportError: numpy_include = os.getenv('NUMPY_INCLUDE', numpy_include) +project_name = 'deepspeech' +if '--project_name' in sys.argv: + project_name_idx = sys.argv.index('--project_name') + project_name = sys.argv[project_name_idx + 1] + sys.argv.remove('--project_name') + sys.argv.pop(project_name_idx) + class BuildExtFirst(build): sub_commands = [('build_ext', build.has_ext_modules), ('build_py', build.has_pure_modules), @@ -34,7 +42,7 @@ utils = Extension('_utils', include_dirs = [numpy_include], libraries = ['deepspeech_utils']) -setup(name = 'deepspeech', +setup(name = project_name, description = 'A library for running inference on a DeepSpeech model', author = 'Chris Lord', author_email='chrislord.net@gmail.com', diff --git a/taskcluster/cuda-build.sh b/taskcluster/cuda-build.sh index cd780acc..e02ef71e 100755 --- a/taskcluster/cuda-build.sh +++ b/taskcluster/cuda-build.sh @@ -23,6 +23,6 @@ do_bazel_build do_deepspeech_binary_build -do_deepspeech_python_build +do_deepspeech_python_build rename_to_gpu -do_deepspeech_nodejs_build +do_deepspeech_nodejs_build rename_to_gpu diff --git a/tc-tests-utils.sh b/tc-tests-utils.sh index cfc90892..0c776f88 100755 --- a/tc-tests-utils.sh +++ b/tc-tests-utils.sh @@ -245,6 +245,8 @@ do_deepspeech_binary_build() do_deepspeech_python_build() { + rename_to_gpu=$1 + unset PYTHON_BIN_PATH unset PYTHONPATH export PYENV_ROOT="${DS_ROOT_TASK}/DeepSpeech/.pyenv" @@ -255,6 +257,11 @@ do_deepspeech_python_build() mkdir -p wheels + SETUP_FLAGS="" + if [ "${rename_to_gpu}" ]; then + SETUP_FLAGS="--project_name deepspeech-gpu" + fi + for pyver in ${SUPPORTED_PYTHON_VERSIONS}; do pyenv install ${pyver} pyenv virtualenv ${pyver} deepspeech @@ -264,9 +271,10 @@ do_deepspeech_python_build() TARGET=${SYSTEM_TARGET} \ RASPBIAN=/tmp/multistrap-raspbian-jessie \ TFDIR=${DS_TFDIR} \ + SETUP_FLAGS="${SETUP_FLAGS}" \ bindings-clean bindings - cp native_client/dist/deepspeech-*.whl wheels + cp native_client/dist/*.whl wheels make -C native_client/ bindings-clean @@ -277,6 +285,8 @@ do_deepspeech_python_build() do_deepspeech_nodejs_build() { + rename_to_gpu=$1 + npm update && npm install node-gyp node-pre-gyp export PATH="$(npm root)/.bin/:$PATH" @@ -291,6 +301,11 @@ do_deepspeech_nodejs_build() done; make -C native_client/javascript clean npm-pack + + if [ "${rename_to_gpu}" ]; then + pkg=(native_client/javascript/deepspeech-*.tgz) + mv "${pkg}" "${pkg//deepspeech/deepspeech-gpu}" + fi } package_native_client()