diff --git a/bin/detect b/bin/detect index e3a553c77dbd35cbf16d9b1fcc4cb9c95fccbeea..17597c053f6bb6eec62106d99b817099b4ffd141 100755 --- a/bin/detect +++ b/bin/detect @@ -1,8 +1,14 @@ #!/usr/bin/env bash -# bin/name <build-dir> +# bin/detect <build-dir> BUILD_DIR=$1 -[ -f $BUILD_DIR/requirements.txt ] || exit 1 # fail fast if no requirements.txt -# 'Django' if there is a [mysite]/settings.py file present; otherwise 'Python' -ls $BUILD_DIR/**/settings.py &> /dev/null && echo Django || echo Python \ No newline at end of file +function abort() { + echo $1 1>&2 + exit 1 +} + +[ -f $BUILD_DIR/requirements.txt ] || abort "fatal: Not a Python app (no requirements.txt)" + +# 'Python/Django' if there is a [mysite]/settings.py file present; otherwise 'Python' +ls $BUILD_DIR/**/settings.py &> /dev/null && echo Python/Django || echo Python diff --git a/test/canary_python/requirements.txt b/test/canary_python/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391