Skip to content

Commit

Permalink
Merge pull request #1802 from lissyx/ds_ctcdecoder-download-branch
Browse files Browse the repository at this point in the history
Fetch ds_ctcdecoder from VERSION-based URL by default
  • Loading branch information
lissyx authored Dec 19, 2018
2 parents da608dc + 0e617ea commit e549f89
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
22 changes: 22 additions & 0 deletions tc-tests-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tc-train-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 11 additions & 2 deletions util/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def read(fname):
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.')
Expand All @@ -103,6 +103,11 @@ def read(fname):
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()
Expand All @@ -113,7 +118,11 @@ def read(fname):
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]))
Expand Down

0 comments on commit e549f89

Please sign in to comment.