Fetch ds_ctcdecoder from VERSION-based URL by default

Fixes #1801
This commit is contained in:
Alexandre Lissy 2018-12-19 13:22:40 +01:00
Родитель b976032416
Коммит 0e617ea6f1
3 изменённых файлов: 37 добавлений и 2 удалений

Просмотреть файл

@ -373,6 +373,28 @@ verify_bazel_rebuild()
fi;
}
# Should be called from context where Python virtualenv is set
verify_ctcdecoder_url()
{
default_url=$(python util/taskcluster.py --decoder)
echo "${default_url}" | grep -F "deepspeech.native_client.v${DS_VERSION}"
rc_default_url=$?
tag_url=$(python util/taskcluster.py --decoder --branch 'v1.2.3')
echo "${tag_url}" | grep -F "deepspeech.native_client.v1.2.3"
rc_tag_url=$?
master_url=$(python util/taskcluster.py --decoder --branch 'master')
echo "${master_url}" | grep -F "deepspeech.native_client.master"
rc_master_url=$?
if [ ${rc_default_url} -eq 0 -a ${rc_tag_url} -eq 0 -a ${rc_master_url} -eq 0 ]; then
return 0
else
return 1
fi;
}
do_bazel_build()
{
cd ${DS_ROOT_TASK}/DeepSpeech/tf

Просмотреть файл

@ -43,6 +43,10 @@ source ${PYENV_ROOT}/versions/${pyver}/envs/${PYENV_NAME}/bin/activate
pip install --upgrade -r ${HOME}/DeepSpeech/ds/requirements.txt | cat
pushd ${HOME}/DeepSpeech/ds/
verify_ctcdecoder_url
popd
platform=$(python -c 'import sys; import platform; plat = platform.system().lower(); arch = platform.machine().lower(); plat = "manylinux1" if plat == "linux" and arch == "x86_64" else plat; plat = "macosx_10_10" if plat == "darwin" else plat; sys.stdout.write("%s_%s" % (plat, platform.machine()));')
whl_ds_version="$(python -c 'from pkg_resources import parse_version; print(parse_version("'${DS_VERSION}'"))')"
decoder_pkg="ds_ctcdecoder-${whl_ds_version}-cp${pyver_pkg}-cp${pyver_pkg}${py_unicode_type}-${platform}.whl"

Просмотреть файл

@ -79,7 +79,7 @@ if __name__ == '__main__':
help='Name of the artifact to download. Defaults to "native_client.tar.xz"')
parser.add_argument('--source', required=False, default=None,
help='Name of the TaskCluster scheme to use.')
parser.add_argument('--branch', required=False, default='master',
parser.add_argument('--branch', required=False,
help='Branch name to use. Defaulting to "master".')
parser.add_argument('--decoder', action='store_true',
help='Get URL to ds_ctcdecoder Python package.')
@ -103,6 +103,11 @@ if __name__ == '__main__':
else:
args.arch = 'cpu'
has_branch_set = True
if not args.branch:
has_branch_set = False
args.branch = 'master'
if args.decoder:
plat = platform.system().lower()
arch = platform.machine()
@ -113,7 +118,11 @@ if __name__ == '__main__':
if plat == 'darwin':
plat = 'macosx_10_10'
ds_version = parse_version(read('../VERSION'))
version_string = read('../VERSION').strip()
ds_version = parse_version(version_string)
if not has_branch_set:
args.branch = "v{}".format(version_string)
m_or_mu = 'mu' if is_ucs2 else 'm'
pyver = ''.join(map(str, sys.version_info[0:2]))