From 8619b974d17a186dc1013bfdc9d95f6a2e823335 Mon Sep 17 00:00:00 2001
From: Kui Shi <skuicloud@gmail.com>
Date: Wed, 21 Aug 2013 19:07:43 +0800
Subject: [PATCH] emit warning while running flake8 without virtual env

run_tests.sh -N -p
it will call the flake8 installed on your host to detect PEP8, and
the flake8 plugin "OpenStack hacking" may not installed on your
host, so this command may not detect the OpenStack Style Commandment
supplied by hacking(e.g H202).

run_tests.sh -p
it will call the flake8 from virtual env, flake8 plugin "OpenStack
hacking" installed in virtual env will be triggered.

The result from "run_tests.sh -p" should be trusted, and jenkins uses
virtual env to run flake8 too.

When "-N" is enabled, emit warning to remind user.

Bug #1208584

Change-Id: Ie08e5fa2b44088dad135e11583c046650d65df1e
---
 run_tests.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/run_tests.sh b/run_tests.sh
index 467473d91..80365d4fa 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -180,6 +180,10 @@ function copy_subunit_log {
 
 function run_pep8 {
   echo "Running flake8 ..."
+  if [ $never_venv -eq 1 ]; then
+      echo "**WARNING**:"
+      echo "Running flake8 without virtual env may miss OpenStack HACKING detection"
+  fi
   bash -c "${wrapper} flake8 cinder* bin/*"
 }
 
-- 
2.45.2