From 161621fb2f0bacd044b03a658455b5ea214257fd Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Wed, 24 Apr 2013 21:46:41 +0800 Subject: [PATCH] Pylint:fixed pylint findings and removed unused libs Change-Id: Icb19383d82dbd4b0f993e95e90c0a3a471094423 --- gitbuildsys/cmd_build.py | 5 ++--- gitbuildsys/ks_utils.py | 4 ++-- gitbuildsys/utils.py | 11 ++++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gitbuildsys/cmd_build.py b/gitbuildsys/cmd_build.py index 47cfa22..2330020 100644 --- a/gitbuildsys/cmd_build.py +++ b/gitbuildsys/cmd_build.py @@ -23,7 +23,6 @@ import os import shutil import pwd import re -import glob import urlparse from gitbuildsys.utils import Temp, RepoParser @@ -77,7 +76,7 @@ QEMU_CAN_BUILD = ['armv4l', 'armv5el', 'armv5l', 'armv6l', 'armv7l', USERID = pwd.getpwuid(os.getuid())[0] TMPDIR = os.path.join(configmgr.get('tmpdir', 'general'), '%s-gbs' % USERID) -def update_ks_files(args, repoparser, cachedir): +def update_ks_files(args, repoparser): '''Update ks files: Add local repo and add user/pass if needed''' if args.arch: buildarch = args.arch @@ -160,7 +159,7 @@ def prepare_repos_and_build_conf(args, arch, profile, cachedir): 'following repos:\n%s' % (arch, '\n'.join(repos))) cmd_opts += [('--repository=%s' % url.full) for url in repourls] - update_ks_files(args, repoparser, cachedir) + update_ks_files(args, repoparser) prepare_meta_files(args, repoparser) if args.dist: diff --git a/gitbuildsys/ks_utils.py b/gitbuildsys/ks_utils.py index f1d847b..b0862bf 100644 --- a/gitbuildsys/ks_utils.py +++ b/gitbuildsys/ks_utils.py @@ -18,7 +18,6 @@ """Helpers, convenience utils, common APIs for ks file""" -import os import urlparse from gitbuildsys.safe_url import SafeURL @@ -67,7 +66,8 @@ class KSRepoUpdater(object): repo_host = urlparse.urlsplit(repoargs[0].baseurl).hostname if repo_host != host: continue - repoargs[0].baseurl = SafeURL(repoargs[0].baseurl, user, passwd).full + repoargs[0].baseurl = SafeURL(repoargs[0].baseurl, user, + passwd).full new_repo = ' '.join(repoargs[1]) new_repo = '%s --baseurl=%s' % (new_repo, repoargs[0].baseurl) kslist[index] = new_repo diff --git a/gitbuildsys/utils.py b/gitbuildsys/utils.py index ec097ef..1513b1f 100644 --- a/gitbuildsys/utils.py +++ b/gitbuildsys/utils.py @@ -372,7 +372,8 @@ class RepoParser(object): def _fetch_image_configs(self, latest_repo_url): """Fetch and parse image-config.xml.""" - image_configs_url = latest_repo_url.pathjoin('builddata/image-configs.xml') + image_configs_url = latest_repo_url.pathjoin('builddata/'\ + 'image-configs.xml') image_configs_xml = self.fetch(image_configs_url) if image_configs_xml: return self._parse_image_configs(image_configs_xml) @@ -448,8 +449,8 @@ class RepoParser(object): self.group_file['name'] = self.fetch(group_url) if not self.group_file['name']: continue - with open(self.group_file['name'], 'rb') as f: - md5sum = hexdigest(f) + with open(self.group_file['name'], 'rb') as fobj: + md5sum = hexdigest(fobj) if 'md5sum' in self.group_file and \ md5sum != self.group_file['md5sum']: log.warning('multiple differnent group files found') @@ -460,8 +461,8 @@ class RepoParser(object): if not self.pattern_file['name']: log.warning('pattern/group files do not exist in the same repo') continue - with open(self.pattern_file['name'], 'rb') as f: - md5sum = hexdigest(f) + with open(self.pattern_file['name'], 'rb') as fobj: + md5sum = hexdigest(fobj) if 'md5sum' in self.pattern_file and \ md5sum != self.pattern_file['md5sum']: log.warning('multiple differnent pattern files found') -- 2.7.4