mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 60614232da | |||
| edb7004a28 | |||
| ea350a6694 |
@@ -1,2 +1 @@
|
||||
* @heroku/languages
|
||||
* @heroku/buildpack-maintainers
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
# Master
|
||||
|
||||
- Set Code Owners to @heroku/langauges
|
||||
- Bugfix: Caching on subsequent redeploys
|
||||
- Update tests to support latest version of Python
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
# 168 (2020-04-06)
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ cd "$BUILD_DIR"
|
||||
# - Once the build is complete, `~/.heroku/{known-paths}` is copied back into the cache.
|
||||
|
||||
# Create the cache directory, if it doesn't exist.
|
||||
mkdir -p "$CACHE_DIR"
|
||||
mkdir -p "$CACHE_DIR/.heroku"
|
||||
|
||||
# Restore old artifacts from the cache.
|
||||
mkdir -p .heroku
|
||||
|
||||
+4
-9
@@ -100,22 +100,17 @@ if [[ ! -f "$CACHE_DIR/.heroku/requirements.txt" ]]; then
|
||||
# IF there's no cached dependencies, update cached version of requirements.txt
|
||||
# This should only run for new apps and first deploys after this update
|
||||
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"
|
||||
# If we don't already have a python version, this is a new app
|
||||
if [ -f .heroku/python-version ]; then
|
||||
puts-step "Clearing cached dependencies"
|
||||
# if there are any differences, clear the Python cache
|
||||
# Installing Python over again does not take noticably more time
|
||||
rm -rf .heroku/python
|
||||
unset SKIP_INSTALL
|
||||
fi
|
||||
else
|
||||
# IF there IS a cached directory, check for differences with the new one
|
||||
if ! diff "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt" &> /dev/null; then
|
||||
puts-step "Clearing cached dependencies"
|
||||
puts-step "Requirements file has been changed, clearing cached dependencies"
|
||||
# if there are any differences, clear the Python cache
|
||||
# Installing Python over again does not take noticably more time
|
||||
cp -R "$BUILD_DIR/requirements.txt" "$CACHE_DIR/.heroku/requirements.txt"
|
||||
rm -rf .heroku/python
|
||||
unset SKIP_INSTALL
|
||||
else
|
||||
puts-step "No change in requirements detected, installing from cache"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ buildpack_sqlite3_install() {
|
||||
puts-step "Installing SQLite3"
|
||||
|
||||
if sqlite3_install "$BUILD_DIR/.heroku/python" ; then
|
||||
echo "Sqlite3 successfully installed."
|
||||
mcount "success.python.sqlite3"
|
||||
else
|
||||
echo "Sqlite3 failed to install."
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
---
|
||||
- - "./repos/python/python-getting-started"
|
||||
- f56b90499ec11e1c9576da2f8c7331300e189db3
|
||||
- 443a90c58be6881583cd7ef628e3869e3c30bb98
|
||||
|
||||
@@ -3,26 +3,40 @@ require_relative '../spec_helper'
|
||||
describe "Default Python Deploy" do
|
||||
it "🐍" do
|
||||
Hatchet::Runner.new('python-getting-started', stack: DEFAULT_STACK).deploy do |app|
|
||||
|
||||
# What should happen on first deploy
|
||||
expect(app.output).to match(/Installing pip/)
|
||||
expect(app.run('python -V')).to match(/3.6.10/)
|
||||
|
||||
# What should not happen
|
||||
expect(app.output).to_not match("Requirements file has been changed, updating cache")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
expect(app.output).to_not match("No such file or directory")
|
||||
expect(app.output).to_not match("cp: cannot create regular file")
|
||||
|
||||
expect(app.output).to_not match("Clearing cached dependencies")
|
||||
|
||||
# Redeploy
|
||||
# Redeploy with changed requirements file
|
||||
run!(%Q{echo "" >> requirements.txt})
|
||||
run!(%Q{echo "flask" >> requirements.txt})
|
||||
run!(%Q{git add . ; git commit --allow-empty -m next})
|
||||
app.push!
|
||||
|
||||
# Check for the cache tohave cleared
|
||||
expect(app.output).to match("Clearing cached dependencies")
|
||||
# Check for the cache to have cleared
|
||||
expect(app.output).to match("Requirements file has been changed, updating cache")
|
||||
|
||||
# What should not happen when the requirements file is changed
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
expect(app.output).to_not match("No change in requirements detected, installing from cache")
|
||||
|
||||
run!(%Q{git commit --allow-empty -m next})
|
||||
app.push!
|
||||
|
||||
# The cache should not clear with no changes
|
||||
expect(app.output).to_not match("Clearing cached dependencies")
|
||||
# With no changes on redeploy, the cache should
|
||||
expect(app.output).to match("No change in requirements detected, installing from cache")
|
||||
|
||||
# With no changes on redeploy, the cache should not
|
||||
expect(app.output).to_not match("Requirements file has been changed, updating cache")
|
||||
expect(app.output).to_not match("No dependencies found, preparing to install")
|
||||
|
||||
expect(app.run('python -V')).to match(/3.7.6/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +56,6 @@ testPysqlite() {
|
||||
|
||||
testSqliteInstall() {
|
||||
compile "pythonDefault"
|
||||
assertCaptured "Sqlite3 successfully installed."
|
||||
assertNotCaptured "Sqlite3 failed to install."
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user