From a0f2073eb1735db365e37f1bd6ebc7a6a9ab9334 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz <me@kennethreitz.com>
Date: Tue, 6 Mar 2012 04:46:16 -0500
Subject: [PATCH] check for django in requirements.txt

---
 bin/compile | 4 +++-
 bin/detect  | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/compile b/bin/compile
index eb4eeb44..4157b76a 100755
--- a/bin/compile
+++ b/bin/compile
@@ -34,7 +34,9 @@ cd $BUILD_DIR
 
 # Reject a non-packaged Django app.
 if [ "$NAME" = "Python" ]; then
-  [ -f manage.py ] && [ -f settings.py ] && { echo " !     Django app must be in a package subdirectory"; exit 1; }
+  [ -f settings.py ] && { echo " !     Django settings must be in a package subdirectory"; exit 1; }
+
+  (grep -Fiq "django" requirements.txt) && [ -f settings.py ] && { echo " !     Django app must be in a package subdirectory"; exit 1; }
 fi
 
 # Warn a checked-in virtualenv.
diff --git a/bin/detect b/bin/detect
index 1d7041c5..c9db66dd 100755
--- a/bin/detect
+++ b/bin/detect
@@ -3,9 +3,9 @@
 
 BUILD_DIR=$1
 
-if [ -f $BUILD_DIR/requirements.txt ] || [ -f $BUILD_DIR/setup.py ]; then
+if [ ! -f $BUILD_DIR/requirements.txt ] || [ ! -f $BUILD_DIR/setup.py ]; then
   exit 1
 fi
 
 # '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
+ls $BUILD_DIR/**/settings.py &> /dev/null && (grep -Fiq "django" requirements.txt) && echo Python/Django || echo Python
-- 
GitLab