From 61fff122754ff1bc5bcbe3103399a7cd0eaed24b Mon Sep 17 00:00:00 2001 From: Sascha Silbe Date: Wed, 26 Aug 2009 19:16:59 +0000 Subject: pylint fixes --- diff --git a/sjhbuild/bundlemodule.py b/sjhbuild/bundlemodule.py index f6071de..c9a950d 100644 --- a/sjhbuild/bundlemodule.py +++ b/sjhbuild/bundlemodule.py @@ -18,8 +18,8 @@ class BundleModule(Package): PHASE_BUILD = 'build' PHASE_INSTALL = 'install' - def __init__(self, name, branch, dependencies=[], after=[]): - Package.__init__(self, name, dependencies, after) + def __init__(self, name, branch, dependencies=None, after=None): + Package.__init__(self, name, dependencies or [], after or []) self.branch = branch def get_srcdir(self, buildscript): @@ -66,7 +66,6 @@ class BundleModule(Package): def do_build(self, buildscript): buildscript.set_action('Building', self) srcdir = self.get_srcdir(buildscript) - builddir = self.get_builddir(buildscript) python = os.environ.get('PYTHON', 'python') cmd = [python, 'setup.py', 'build'] buildscript.execute(cmd, cwd=srcdir) @@ -79,7 +78,6 @@ class BundleModule(Package): def do_install(self, buildscript): buildscript.set_action('Installing', self) srcdir = self.get_srcdir(buildscript) - builddir = self.get_builddir(buildscript) python = os.environ.get('PYTHON', 'python') cmd = [python, 'setup.py', 'install'] cmd.extend(['--prefix', buildscript.config.prefix]) @@ -90,8 +88,8 @@ class BundleModule(Package): def parse_bundle(node, config, uri, repositories, default_repo): - id = node.getAttribute('id') + bundle_id = node.getAttribute('id') branch = get_branch(node, repositories, default_repo, config) - return BundleModule(id, branch) + return BundleModule(bundle_id, branch) register_module_type('bundle', parse_bundle) diff --git a/sjhbuild/config.py b/sjhbuild/config.py index defbca5..2c30ce0 100644 --- a/sjhbuild/config.py +++ b/sjhbuild/config.py @@ -16,6 +16,7 @@ class Config(jhbuild.config.Config): self._setup() def _setup(self): + # pylint: disable-msg=W0201 self.autogenargs = '' self.checkoutroot = os.path.join(self.base_dir, 'source') @@ -27,7 +28,8 @@ class Config(jhbuild.config.Config): '(unknown distribution/version).\n') sys.exit(126) - for package, source in deps: + for package_, source in deps: + # pylint: disable-msg=E1101 if source and source not in self.skip: self.skip.append(source) diff --git a/sjhbuild/depscheck.py b/sjhbuild/depscheck.py index 7a22632..838e524 100644 --- a/sjhbuild/depscheck.py +++ b/sjhbuild/depscheck.py @@ -22,7 +22,7 @@ class cmd_depscheck(Command): def run(self, config, options, args): deps = sysdeps.get_packages() missing_deps = [] - for package, source in deps: + for package, source_ in deps: if not sysdeps.check_package(package): missing_deps.append(package) @@ -32,4 +32,5 @@ class cmd_depscheck(Command): print ' '.join(missing_deps) sys.exit(1) + register_command(cmd_depscheck) diff --git a/sjhbuild/main.py b/sjhbuild/main.py index 67ea70b..f0bdb8a 100644 --- a/sjhbuild/main.py +++ b/sjhbuild/main.py @@ -22,7 +22,6 @@ import errno import optparse import os import sys -import traceback import gettext localedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../mo')) @@ -32,13 +31,11 @@ __builtin__.__dict__['N_'] = lambda x: x import jhbuild.commands from jhbuild.errors import UsageError, FatalError -from jhbuild.utils.cmds import get_output from jhbuild.moduleset import warn_local_modulesets import bundlemodule -import depscheck - from config import Config +import depscheck if sys.platform == 'darwin': # work around locale.getpreferredencoding() returning an empty string in @@ -88,8 +85,11 @@ def help_commands(option, opt_str, value, parser): name, ext = os.path.splitext(fname) if not ext == '.py': continue + try: __import__('jhbuild.commands.%s' % name) + + # pylint: disable-msg=W0704 except ImportError: pass diff --git a/sjhbuild/sysdeps.py b/sjhbuild/sysdeps.py index a4887c9..225f17d 100644 --- a/sjhbuild/sysdeps.py +++ b/sjhbuild/sysdeps.py @@ -19,8 +19,7 @@ _UNSTABLE_NAMES = { def _pipe_lower(args): - out, err = subprocess.Popen(args, - stdout=subprocess.PIPE).communicate() + out, err_ = subprocess.Popen(args, stdout=subprocess.PIPE).communicate() return out.strip().lower() @@ -39,6 +38,7 @@ def get_distribution(): _cached_dname = _pipe_lower(['lsb_release', '-is']) _cached_dversion = _pipe_lower(['lsb_release', '-rs']) + # pylint: disable-msg=W0704 except OSError: pass @@ -46,13 +46,13 @@ def get_distribution(): def check_package(package): - name, version = get_distribution() + name, version_ = get_distribution() if name in ['fedora', 'mandrivalinux']: ret = subprocess.call(['rpm', '--quiet', '-q', package]) return ret == 0 elif name in ['ubuntu', 'debian']: cmd = ["dpkg-query", "-f='${status}'", "-W", package] - out, err = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate() + out, err_ = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate() return out.find('install ok installed') != -1 return None -- cgit v0.9.1