mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
155b5eecb9
* fixed the bug for pypy-5.8.0 * changelog entry Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * use std-lib sub-env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * let's see if this cleans things up Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * try v7 of stdlib Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * use new sub_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * set_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * set_default_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * v8 of stdlib Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * v112 Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * oops (merge bug) Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * final merge error resolve Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * final final fix for merge conflict Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script serves as the NLTK build step of the
|
|
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
|
# compiler.
|
|
#
|
|
# A [buildpack](https://devcenter.heroku.com/articles/buildpacks) is an
|
|
# adapter between a Python application and Heroku's runtime.
|
|
#
|
|
# This script is invoked by [`bin/compile`](/).
|
|
|
|
# Syntax sugar.
|
|
# shellcheck source=bin/utils
|
|
source "$BIN_DIR/utils"
|
|
|
|
# Check that nltk was installed by pip, otherwise obviously not needed
|
|
if sp-grep -s nltk; then
|
|
puts-step "Downloading NLTK corpora..."
|
|
|
|
nltk_packages_definition="$BUILD_DIR/nltk.txt"
|
|
|
|
if [ -f "$nltk_packages_definition" ]; then
|
|
|
|
nltk_packages=$(tr "\n" " " < "$nltk_packages_definition")
|
|
puts-step "Downloading NLTK packages: $nltk_packages"
|
|
|
|
python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "$nltk_packages" | indent
|
|
set_env NLTK_DATA "/app/.heroku/python/nltk_data"
|
|
|
|
else
|
|
puts-warn "'nltk.txt' not found, not downloading any corpora"
|
|
puts-warn "Learn more: https://devcenter.heroku.com/articles/python-nltk"
|
|
fi
|
|
fi
|
|
|