Skip to content
Snippets Groups Projects
Commit c19f0f83 authored by Kenneth Reitz's avatar Kenneth Reitz
Browse files

fix build

parent 8b88d655
No related branches found
No related tags found
No related merge requests found
...@@ -158,9 +158,6 @@ source $BIN_DIR/steps/python ...@@ -158,9 +158,6 @@ source $BIN_DIR/steps/python
# Sanity check for setuptools/distribute. # Sanity check for setuptools/distribute.
source $BIN_DIR/steps/setuptools 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 no requirements.txt file given, assume `setup.py develop` is intended.
if [ ! -f requirements.txt ]; then if [ ! -f requirements.txt ]; then
echo "-e ." > requirements.txt echo "-e ." > requirements.txt
......
...@@ -13,6 +13,19 @@ find .heroku/python/lib-python/*/site-packages/ -name "*.egg-link" -print0 2> /d ...@@ -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 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 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
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first [ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
......
# 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 @@ ...@@ -3,19 +3,20 @@
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
if [[ ! -f Pipfile.lock ]]; then if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
pipenv lock 2> /dev/null puts-warn "No 'pipfile.lock' found! We recommend you commit this into your repository."
fi 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 if [ "$PYTHON" = 2.7 ]; then
PYTHON=$(cat $BUILD_DIR/Pipfile.lock | jq '._meta.requires.python_version' -r) echo "python-2.7.13" > $BUILD_DIR/runtime.txt
set -e fi
if [ "$PYTHON" = 3.6 ]; then
if [ "$PYTHON" = 2.7 ]; then echo "python-3.6.0" > $BUILD_DIR/runtime.txt
echo "python-2.7.13" > $BUILD_DIR/runtime.txt fi
fi
if [ "$PYTHON" = 3.6 ]; then
echo "python-3.6.0" > $BUILD_DIR/runtime.txt
fi fi
fi fi
fi fi
......
...@@ -55,23 +55,30 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then ...@@ -55,23 +55,30 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then
TMPTARDIR=$(mktemp -d) TMPTARDIR=$(mktemp -d)
trap "rm -rf $TMPTARDIR" RETURN trap "rm -rf $TMPTARDIR" RETURN
bpwatch start install_setuptools puts-step "Installing pip"
# Prepare it for the real world /app/.heroku/python/bin/python $ROOT_DIR/vendor/get-pip.py &> /dev/null
# puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
tar zxf $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION.tar.gz -C $TMPTARDIR # bpwatch start install_setuptools
cd $TMPTARDIR/setuptools-$SETUPTOOLS_VERSION/ # # Prepare it for the real world
python setup.py install &> /dev/null # puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
cd $WORKING_DIR # tar zxf $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION.tar.gz -C $TMPTARDIR
bpwatch stop install_setuptoools # cd $TMPTARDIR/setuptools-$SETUPTOOLS_VERSION/
# /app/.heroku/python/bin/python setup.py install &> /dev/null
bpwatch start install_pip # cd $WORKING_DIR
# puts-step "Installing Pip ($PIP_VERSION)" # bpwatch stop install_setuptoools
tar zxf $ROOT_DIR/vendor/pip-$PIP_VERSION.tar.gz -C $TMPTARDIR
cd $TMPTARDIR/pip-$PIP_VERSION/ # bpwatch start install_pip
python setup.py install &> /dev/null # puts-step "Installing Pip ($PIP_VERSION)"
cd $WORKING_DIR # tar zxf $ROOT_DIR/vendor/pip-$PIP_VERSION.tar.gz -C $TMPTARDIR
# cd $TMPTARDIR/pip-$PIP_VERSION/
bpwatch stop install_pip # /app/.heroku/python/bin/python setup.py install &> /dev/null
# cd $WORKING_DIR
# bpwatch stop install_pip
bpwatch stop prepare_environment bpwatch stop prepare_environment
fi fi
......
#!/usr/bin/env bash #!/usr/bin/env bash
testPipenvVersion() {
compile "pipenv-version"
assertCaptured "3.6.0"
assertCapturedSuccess
}
testPipenv() {
compile "pipenv"
assertCapturedSuccess
}
testNoRequirements() { testNoRequirements() {
...@@ -12,20 +24,6 @@ testNLTK() { ...@@ -12,20 +24,6 @@ testNLTK() {
compile "nltk" compile "nltk"
assertCaptured "wordnet" assertCaptured "wordnet"
assertCapturedSuccess assertCapturedSuccess
}
testPipenvVersion() {
compile "pipenv-version"
assertCaptured "3.6.0"
assertCapturedSuccess
}
testPipenv() {
compile "pipenv"
assertCapturedSuccess
} }
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment