Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provision a Heroku Postgres DB in fewer cases #1363

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- The Heroku Postgres database auto-provisioning feature now provisions a DB in fewer cases ([#1363](https://github.com/heroku/heroku-buildpack-python/pull/1363)).

## v218 (2022-09-07)

Expand Down
16 changes: 6 additions & 10 deletions bin/release
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#!/usr/bin/env bash
# bin/release <build-dir>

set -euo pipefail

BUILD_DIR=$1
BIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

MANAGE_FILE=$(cd "$BUILD_DIR" && find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=${MANAGE_FILE:2}
# shellcheck source=bin/utils
source "$BIN_DIR/utils"

if [[ -f "${BUILD_DIR}/manage.py" ]] && is_module_available 'django' && is_module_available 'psycopg2'; then
cat <<EOF
---
config_vars:

EOF


if [[ $MANAGE_FILE ]]; then
cat <<EOF

addons:
- heroku-postgresql
EOF
Expand Down
2 changes: 1 addition & 1 deletion bin/utils
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ measure-size() {
}

is_module_available() {
# Returns 0 is the specified module exists, otherwise returns 1.
# Returns 0 if the specified module exists, otherwise returns 1.
# Uses pkgutil rather than pkg_resources or pip's CLI, since pkgutil exists
# in the stdlib, and doesn't depend on the choice of package manager.
local module_name="${1}"
Expand Down