mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 15:00:19 +00:00
fix build
This commit is contained in:
@@ -158,9 +158,6 @@ source $BIN_DIR/steps/python
|
||||
# Sanity check for setuptools/distribute.
|
||||
source $BIN_DIR/steps/setuptools
|
||||
|
||||
# Pipenv support.
|
||||
source $BIN_DIR/steps/pipenv
|
||||
|
||||
# If no requirements.txt file given, assume `setup.py develop` is intended.
|
||||
if [ ! -f requirements.txt ]; then
|
||||
echo "-e ." > requirements.txt
|
||||
|
||||
@@ -13,6 +13,19 @@ find .heroku/python/lib-python/*/site-packages/ -name "*.egg-link" -print0 2> /d
|
||||
find .heroku/python/lib-python/*/site-packages/ -name "*.pth" -print0 2> /dev/null | xargs -r -0 -n 1 sed -i -e "s#/app/#/$(pwd)/#" &> /dev/null
|
||||
set -e
|
||||
|
||||
# Pipenv support (Generate requriements.txt with pipenv).
|
||||
if [[ -f Pipfile ]]; then
|
||||
if [[ ! -f requirements.txt ]]; then
|
||||
puts-step "Generating 'requirements.txt' with pipenv"
|
||||
|
||||
/app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
|
||||
/app/.heroku/python/bin/pipenv lock --requirements --no-hashes > requirements.txt #2> /dev/null
|
||||
cat requirements.txt
|
||||
pipstrip requirements.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
|
||||
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Generate requriements.txt with pipenv.
|
||||
|
||||
if [[ -f Pipfile ]]; then
|
||||
if [[ ! -f requirements.txt ]]; then
|
||||
puts-step "Generating 'requirements.txt' with pipenv"
|
||||
|
||||
pip install pipenv --upgrade &> /dev/null
|
||||
pipenv lock --requirements > requirements.txt 2> /dev/null
|
||||
|
||||
pipstrip requirements.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -3,19 +3,20 @@
|
||||
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
|
||||
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
|
||||
if [[ ! -f Pipfile.lock ]]; then
|
||||
pipenv lock 2> /dev/null
|
||||
if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
puts-warn "No 'pipfile.lock' found! We recommend you commit this into your repository."
|
||||
fi
|
||||
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
set +e
|
||||
PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r)
|
||||
set -e
|
||||
|
||||
set +e
|
||||
PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r)
|
||||
set -e
|
||||
|
||||
if [ "$PYTHON" = 2.7 ]; then
|
||||
echo "python-2.7.13" > $BUILD_DIR/runtime.txt
|
||||
fi
|
||||
if [ "$PYTHON" = 3.6 ]; then
|
||||
echo "python-3.6.0" > $BUILD_DIR/runtime.txt
|
||||
if [ "$PYTHON" = 2.7 ]; then
|
||||
echo "python-2.7.13" > $BUILD_DIR/runtime.txt
|
||||
fi
|
||||
if [ "$PYTHON" = 3.6 ]; then
|
||||
echo "python-3.6.0" > $BUILD_DIR/runtime.txt
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
+22
-15
@@ -55,23 +55,30 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then
|
||||
TMPTARDIR=$(mktemp -d)
|
||||
trap "rm -rf $TMPTARDIR" RETURN
|
||||
|
||||
bpwatch start install_setuptools
|
||||
# Prepare it for the real world
|
||||
# puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
|
||||
tar zxf $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION.tar.gz -C $TMPTARDIR
|
||||
cd $TMPTARDIR/setuptools-$SETUPTOOLS_VERSION/
|
||||
python setup.py install &> /dev/null
|
||||
cd $WORKING_DIR
|
||||
bpwatch stop install_setuptoools
|
||||
puts-step "Installing pip"
|
||||
/app/.heroku/python/bin/python $ROOT_DIR/vendor/get-pip.py &> /dev/null
|
||||
|
||||
# bpwatch start install_setuptools
|
||||
# # Prepare it for the real world
|
||||
# puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
|
||||
# tar zxf $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION.tar.gz -C $TMPTARDIR
|
||||
# cd $TMPTARDIR/setuptools-$SETUPTOOLS_VERSION/
|
||||
# /app/.heroku/python/bin/python setup.py install &> /dev/null
|
||||
# cd $WORKING_DIR
|
||||
# bpwatch stop install_setuptoools
|
||||
|
||||
# bpwatch start install_pip
|
||||
# puts-step "Installing Pip ($PIP_VERSION)"
|
||||
# tar zxf $ROOT_DIR/vendor/pip-$PIP_VERSION.tar.gz -C $TMPTARDIR
|
||||
# cd $TMPTARDIR/pip-$PIP_VERSION/
|
||||
# /app/.heroku/python/bin/python setup.py install &> /dev/null
|
||||
# cd $WORKING_DIR
|
||||
|
||||
# bpwatch stop install_pip
|
||||
|
||||
|
||||
|
||||
bpwatch start install_pip
|
||||
# puts-step "Installing Pip ($PIP_VERSION)"
|
||||
tar zxf $ROOT_DIR/vendor/pip-$PIP_VERSION.tar.gz -C $TMPTARDIR
|
||||
cd $TMPTARDIR/pip-$PIP_VERSION/
|
||||
python setup.py install &> /dev/null
|
||||
cd $WORKING_DIR
|
||||
|
||||
bpwatch stop install_pip
|
||||
bpwatch stop prepare_environment
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
testPipenvVersion() {
|
||||
compile "pipenv-version"
|
||||
assertCaptured "3.6.0"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
|
||||
testPipenv() {
|
||||
compile "pipenv"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
|
||||
|
||||
testNoRequirements() {
|
||||
@@ -12,20 +24,6 @@ testNLTK() {
|
||||
compile "nltk"
|
||||
assertCaptured "wordnet"
|
||||
assertCapturedSuccess
|
||||
|
||||
}
|
||||
|
||||
|
||||
testPipenvVersion() {
|
||||
compile "pipenv-version"
|
||||
assertCaptured "3.6.0"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
|
||||
testPipenv() {
|
||||
compile "pipenv"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+20061
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user