summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYuriy Taraday <yorik.sar@gmail.com>2012-03-06 12:53:07 +0400
committerYuriy Taraday <yorik.sar@gmail.com>2012-03-07 12:51:39 +0400
commit01a938f7fe4dea274713e49f124fcc45702f80a0 (patch)
treec761687b21ab3b10b29f2aa175480d1dba3a7682 /tools
parentd8324bb3d089acd444bd1639a3efc07e89556f69 (diff)
downloadnova-01a938f7fe4dea274713e49f124fcc45702f80a0.tar.gz
HACKING fixes, all but sqlalchemy.
Looks like this fixes all HACKING problems that were around. Thanks to Dina Belova and Alexander Kovalev for this work. Change-Id: I8157f0d4890184c1216aab63ef7180ee8b7a184d
Diffstat (limited to 'tools')
-rwxr-xr-xtools/hacking.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index 75c795b9ca..7aa756bb5b 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012, Cloudscaling
@@ -24,10 +25,10 @@ import inspect
import os
import re
import sys
-import traceback
import pep8
+
#N1xx comments
#N2xx except
#N3xx imports
@@ -118,14 +119,14 @@ def nova_import_module_only(logical_line):
return logical_line.find(mod), ("NOVA N302: import only "
"modules. '%s' does not import a module" % logical_line)
- except (ImportError, NameError):
+ except (ImportError, NameError) as exc:
if not added:
added = True
sys.path.append(current_path)
return importModuleCheck(mod, parent, added)
else:
- print >> sys.stderr, ("ERROR: import '%s' failed, couldn't "
- "find module" % logical_line)
+ print >> sys.stderr, ("ERROR: import '%s' failed: %s" %
+ (logical_line, exc))
added = False
sys.path.pop()
return
@@ -149,6 +150,7 @@ def nova_import_module_only(logical_line):
# handle "from x import y as z"
elif (logical_line.startswith("from ") and "," not in logical_line and
split_line[2] == "import" and split_line[3] != "*" and
+ split_line[1] != "__future__" and
(len(split_line) == 4 or
(len(split_line) == 6 and split_line[4] == "as"))):
mod = split_line[3]