Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id D254CE007C0; Mon, 27 Oct 2014 12:03:53 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.45 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 18BF8E00796 for ; Mon, 27 Oct 2014 12:03:50 -0700 (PDT) Received: by mail-wg0-f45.google.com with SMTP id x12so2043513wgg.28 for ; Mon, 27 Oct 2014 12:03:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZV1TIZ5uqTQYzv1ScHLd7LOmB7M4qWWPNtBbNS+yL0E=; b=aCg1SIBTOzQ4o8EpnS4a9zkBCX8rH9wVMXStI7siBWBWNn1i8bhRqbWMrVX0e8CNKV f57un9dT8WaKFQGOAitINZ2BdgoHuQOPZWkUgSz3+04Q6xSdAZoj/bPd/OHoFv6C/GcF Id4YwL3SqqUZnj39Gb9nEvMiplqoT4Gv3CKsDhvL7yxFrpUWbr5mK0TZAb3wroSdLzmv kMtAIwqnY3bRNrmPh8Fk9ykNyrXuts8GuHPkXe53pKs+mbl8oiUQ1RxwZlh8FJXGJ/DP Dx+QiZuj5n9vB+EP738Q05WyqSrp2Z00Lu2pLByptmC2p8kn6IoJt3JfsIIbwsoWVRKw L3nA== X-Gm-Message-State: ALoCoQnADwCTNO0NxIF5YIrQignrptdd+P4/wKQ4pcw2r815USNPgHTRiZypMZRQrFcdN4jZ4qQl X-Received: by 10.180.98.170 with SMTP id ej10mr22589275wib.17.1414436629170; Mon, 27 Oct 2014 12:03:49 -0700 (PDT) Received: from draco.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ua8sm16561911wjc.7.2014.10.27.12.03.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Oct 2014 12:03:48 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 27 Oct 2014 19:03:06 +0000 Message-Id: <1414436586-18303-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414423898-12128-1-git-send-email-michael.g.wood@intel.com> References: <1414423898-12128-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH V2] bitbake: toaster: skip virtualenv when searching for django apps X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Oct 2014 19:03:53 -0000 If we are using a virtualenv in the current search path we end up trying to add modules to the django apps list which do not have the correct load path or are internal to other modules. Fix this by skipping the virtualenv path. [YOCTO #6896] Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastermain/settings.py | 4 ++++ bitbake/lib/toaster/toastermain/urls.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 42581f2..65f1991 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -260,6 +260,10 @@ import os currentdir = os.path.dirname(__file__) for t in os.walk(os.path.dirname(currentdir)): modulename = os.path.basename(t[0]) + #if we have a virtualenv skip it to avoid incorrect imports + if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]: + continue + if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS: INSTALLED_APPS = INSTALLED_APPS + (modulename,) diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py index 1ae6245..549fda1 100644 --- a/bitbake/lib/toaster/toastermain/urls.py +++ b/bitbake/lib/toaster/toastermain/urls.py @@ -55,6 +55,10 @@ if toastermain.settings.MANAGED: import os currentdir = os.path.dirname(__file__) for t in os.walk(os.path.dirname(currentdir)): + #if we have a virtualenv skip it to avoid incorrect imports + if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]: + continue + if "urls.py" in t[2] and t[0] != currentdir: modulename = os.path.basename(t[0]) urlpatterns.append( url(r'^' + modulename + '/', include ( modulename + '.urls'))) -- 1.9.1