[elbe-devel] [PATCH 6/7] pep8: fix E741 ambiguous variable name 'l'

Manuel Traut manuel.traut at linutronix.de
Thu Dec 21 11:57:34 CET 2017


Hi,

i just noticed that this change triggers an error:

  Traceback (most recent call last):
    File "/var/cache/elbe/devel/elbepack/asyncworker.py", line 102, in execute
      skip_pbuild=self.skip_pbuilder)
    File "/var/cache/elbe/devel/elbepack/elbeproject.py", line 240, in build
      self.xml.validate_apt_sources(m, self.arch)
    File "/var/cache/elbe/devel/elbepack/elbexml.py", line 184, in validate_apt_sources
      srcline = re.sub(r'\[.*\] ', '', l)
  NameError: global name 'l' is not defined

It will be fixed in v2.

  Manuel

On Wed, Dec 20, 2017 at 10:11:46PM +0100, Manuel Traut wrote:
> this updates pycodestyle statistics to:
> 
> 99      E501 line too long (82 > 79 characters)
> 
> Signed-off-by: Manuel Traut <manut at linutronix.de>
> ---
>  elbepack/elbexml.py        | 12 ++++++------
>  elbepack/licencexml.py     |  4 ++--
>  elbepack/projectmanager.py | 16 ++++++++--------
>  elbepack/rfs.py            |  6 +++---
>  4 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> index ab1a2c92..d2c2a6a6 100644
> --- a/elbepack/elbexml.py
> +++ b/elbepack/elbexml.py
> @@ -180,16 +180,16 @@ class ElbeXML(object):
>          sources_lines = slist.split('\n')
>  
>          repos = []
> -        for l in sources_lines:
> -            l = re.sub(r'\[.*\] ', '', l)
> -            if l.startswith("deb copy:"):
> +        for source_line in sources_lines:
> +            source_line = re.sub(r'\[.*\] ', '', l)
> +            if source_line.startswith("deb copy:"):
>                  # This is a cdrom, we dont verify it
>                  pass
> -            elif l.startswith("deb-src copy:"):
> +            elif source_line.startswith("deb-src copy:"):
>                  # This is a cdrom, we dont verify it
>                  pass
> -            elif l.startswith("deb ") or l.startswith("deb-src "):
> -                lsplit = l.split(" ")
> +            elif source_line.startswith("deb ") or source_line.startswith("deb-src "):
> +                lsplit = source_line.split(" ")
>                  url = lsplit[1]
>                  suite = lsplit[2]
>                  section = lsplit[3]
> diff --git a/elbepack/licencexml.py b/elbepack/licencexml.py
> index f5db9cc8..71278c37 100644
> --- a/elbepack/licencexml.py
> +++ b/elbepack/licencexml.py
> @@ -101,8 +101,8 @@ class copyright_xml (object):
>              xmlpkg.append('heuristics')
>              xmllic = xmlpkg.append('debian_licenses')
>              for i in lics:
> -                l = xmllic.append('license')
> -                l.et.text = i
> +                ltag = xmllic.append('license')
> +                ltag.et.text = i
>  
>              return
>  
> diff --git a/elbepack/projectmanager.py b/elbepack/projectmanager.py
> index c775ed1a..f039da9c 100644
> --- a/elbepack/projectmanager.py
> +++ b/elbepack/projectmanager.py
> @@ -527,18 +527,18 @@ class ProjectManager(object):
>              if part is None:
>                  return self.db.is_busy(ep.builddir), ""
>  
> -            l = None
> +            logline = None
>              with open(os.path.join(ep.builddir, 'log.txt'), 'r', 0) as lf:
> -                for l in lf:
> +                for logline in lf:
>                      if count == part:
> -                        l = str(part + 1) + '###' + str(l)
> -                        return self.db.is_busy(ep.builddir), str(l)
> +                        logline = str(part + 1) + '###' + str(logline)
> +                        return self.db.is_busy(ep.builddir), str(logline)
>                      count = count + 1
>              # don't crash if logfile doesn't exist
> -            if not l:
> -                l = None
> -            l = str(part) + '###' + str(l)
> -            return self.db.is_busy(ep.builddir), l
> +            if not logline:
> +                logline = None
> +            logline = str(part) + '###' + str(logline)
> +            return self.db.is_busy(ep.builddir), logline
>  
>      def _get_current_project(self, userid, allow_busy=True):
>          # Must be called with self.lock held
> diff --git a/elbepack/rfs.py b/elbepack/rfs.py
> index 6272c61e..1afe96a9 100644
> --- a/elbepack/rfs.py
> +++ b/elbepack/rfs.py
> @@ -190,10 +190,10 @@ class BuildEnv ():
>          if self.xml.has('project/mirror/url-list'):
>              for url in self.xml.node('project/mirror/url-list'):
>                  if url.has('key'):
> -                    l = url.text('key').strip()    # URL to key
> -                    name = l.split('/')[-1]        # Filename of key
> +                    keyurl = url.text('key').strip()    # URL to key
> +                    name = keyurl.split('/')[-1]        # Filename of key
>  
> -                    myKey = urllib2.urlopen(l).read()
> +                    myKey = urllib2.urlopen(keyurl).read()
>                      self.log.do(
>                          'echo "%s" > %s' %
>                          (myKey, self.rfs.fname("tmp/key.pub")))
> -- 
> 2.15.1
> 



More information about the elbe-devel mailing list