Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
heroku-buildpack-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evili del Rio i Silvan
heroku-buildpack-python
Commits
1c51f5d8
Commit
1c51f5d8
authored
8 years ago
by
Kenneth Reitz
Browse files
Options
Downloads
Patches
Plain Diff
NLTK support
parent
6922a825
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/compile
+3
-0
3 additions, 0 deletions
bin/compile
bin/steps/nltk
+38
-0
38 additions, 0 deletions
bin/steps/nltk
with
41 additions
and
0 deletions
bin/compile
+
3
−
0
View file @
1c51f5d8
...
@@ -193,6 +193,9 @@ source $BIN_DIR/steps/gdal
...
@@ -193,6 +193,9 @@ source $BIN_DIR/steps/gdal
# Install dependencies with Pip (where the magic happens).
# Install dependencies with Pip (where the magic happens).
source
$BIN_DIR
/steps/pip-install
source
$BIN_DIR
/steps/pip-install
# Support for NLTK corpora.
sub-env
$BIN_DIR
/steps/nltk
# Support for pip install -e.
# Support for pip install -e.
rm
-fr
$BUILD_DIR
/.heroku/src
rm
-fr
$BUILD_DIR
/.heroku/src
deep-cp /app/.heroku/src
$BUILD_DIR
/.heroku/src
deep-cp /app/.heroku/src
$BUILD_DIR
/.heroku/src
...
...
This diff is collapsed.
Click to expand it.
bin/steps/nltk
0 → 100755
+
38
−
0
View file @
1c51f5d8
#!/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.
source
$BIN_DIR
/utils
bpwatch start nltk_download
export
NLTK_DATA_DIR
=
"
$BUILD_DIR
/nltk_data"
export
NLTK_DATA
=
"
$BUILD_DIR
/nltk_data"
# Check that nltk was installed by pip, otherwise obviously not needed
python
-m
nltk.downloader
-h
>
/dev/null 2>&1
if
[
$?
-eq
0
]
;
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"
fi
else
puts-warn
"nltk not apparently installed, not downloading packages"
fi
bpwatch stop nltk_download
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment