mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
23 lines
576 B
Bash
Executable File
23 lines
576 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# bin/detect <build-dir>
|
|
|
|
BUILD_DIR=$1
|
|
|
|
# Exit early if app is clearly not Python.
|
|
if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then
|
|
exit 1
|
|
fi
|
|
|
|
# If only `setup.py`, assume that the app is not Django.
|
|
if [ ! -f $BUILD_DIR/requirements.txt ]; then
|
|
echo Python
|
|
exit 0
|
|
fi
|
|
|
|
# `Python/Django` if `**/settings.py` is present and `django` exists in
|
|
# `requirements.txt`.
|
|
#
|
|
# Otherwise, `Python`.
|
|
|
|
ls $BUILD_DIR/**/settings.py &> /dev/null && (grep -Fiq "django" $BUILD_DIR/requirements.txt) && echo Python/Django || echo Python
|