From 53d85779e86740893de94485f6dd9d7b75bfae5b Mon Sep 17 00:00:00 2001 From: John Admanski Date: Mon, 30 Jun 2008 15:29:55 +0000 Subject: [PATCH] Eliminate the /tools directory in favour of a /utils directory. Signed-off-by: John Admanski --- tools/common.py | 8 ---- tools/run_pylint.py | 71 ------------------------------------ {tools => utils}/reindent.py | 0 3 files changed, 79 deletions(-) delete mode 100644 tools/common.py delete mode 100644 tools/run_pylint.py rename {tools => utils}/reindent.py (100%) diff --git a/tools/common.py b/tools/common.py deleted file mode 100644 index 9941b190e8..0000000000 --- a/tools/common.py +++ /dev/null @@ -1,8 +0,0 @@ -import os, sys -dirname = os.path.dirname(sys.modules[__name__].__file__) -autotest_dir = os.path.abspath(os.path.join(dirname, "..")) -client_dir = os.path.join(autotest_dir, "client") -sys.path.insert(0, client_dir) -import setup_modules -sys.path.pop(0) -setup_modules.setup(base_path=autotest_dir, root_module_name="autotest_lib") diff --git a/tools/run_pylint.py b/tools/run_pylint.py deleted file mode 100644 index 902b051003..0000000000 --- a/tools/run_pylint.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python -u - -import os, sys, fnmatch -import common - -pylintrc_path = os.path.expanduser('~/.pylintrc') -if not os.path.exists(pylintrc_path): - open(pylintrc_path, 'w').close() - -import pylint.lint -from pylint.checkers import imports - -ROOT_MODULE = 'autotest_lib.' - -# need to put autotest root dir on sys.path so pylint will be happy -autotest_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) -sys.path.insert(0, autotest_root) - -# patch up pylint import checker to handle our importing magic -RealImportsChecker = imports.ImportsChecker - -class CustomImportsChecker(imports.ImportsChecker): - def visit_from(self, node): - if node.modname.startswith(ROOT_MODULE): - node.modname = node.modname[len(ROOT_MODULE):] - return RealImportsChecker.visit_from(self, node) - -imports.ImportsChecker = CustomImportsChecker - -# some files make pylint blow up, so make sure we ignore them -blacklist = ['/contrib/*', '/frontend/afe/management.py'] - -# only show errors -pylint_base_opts = ['--disable-msg-cat=warning,refactor,convention', - '--reports=no', - '--include-ids=y'] - -file_list = sys.argv[1:] -if '--' in file_list: - index = file_list.index('--') - pylint_base_opts.extend(file_list[index+1:]) - file_list = file_list[:index] - - -def check_file(file_path): - if not file_path.endswith('.py'): - return - for blacklist_pattern in blacklist: - if fnmatch.fnmatch(os.path.abspath(file_path), - '*' + blacklist_pattern): - return - pylint.lint.Run(pylint_base_opts + [file_path]) - - -def visit(arg, dirname, filenames): - for filename in filenames: - check_file(os.path.join(dirname, filename)) - - -def check_dir(dir_path): - os.path.walk(dir_path, visit, None) - - -if len(file_list) > 0: - for path in file_list: - if os.path.isdir(path): - check_dir(path) - else: - check_file(path) -else: - check_dir('.') diff --git a/tools/reindent.py b/utils/reindent.py similarity index 100% rename from tools/reindent.py rename to utils/reindent.py