From 43c7891fe5bbc05d1248eab5afb605c88b4b4350 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Mon, 17 Apr 2017 12:24:33 +0200 Subject: [PATCH] Cleanup --- waflib/Context.py | 4 ++-- waflib/Errors.py | 1 + waflib/Tools/ifort.py | 3 +-- waflib/Tools/tex.py | 6 ++++-- waflib/extras/dpapi.py | 2 +- waflib/extras/netcache_client.py | 6 +++--- waflib/extras/resx.py | 2 +- waflib/extras/xcode6.py | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/waflib/Context.py b/waflib/Context.py index 4f9dbb60..5a198a4f 100644 --- a/waflib/Context.py +++ b/waflib/Context.py @@ -95,8 +95,8 @@ class store_context(type): Context classes must provide an attribute 'cmd' representing the command name, and a function attribute 'fun' representing the function name that the command uses. """ - def __init__(cls, name, bases, dict): - super(store_context, cls).__init__(name, bases, dict) + def __init__(cls, name, bases, dct): + super(store_context, cls).__init__(name, bases, dct) name = cls.__name__ if name in ('ctx', 'Context'): diff --git a/waflib/Errors.py b/waflib/Errors.py index b057d19b..b414023e 100644 --- a/waflib/Errors.py +++ b/waflib/Errors.py @@ -17,6 +17,7 @@ class WafError(Exception): :param ex: exception causing this error (optional) :type ex: exception """ + Exception.__init__(self) self.msg = msg assert not isinstance(msg, Exception) diff --git a/waflib/Tools/ifort.py b/waflib/Tools/ifort.py index 77701d67..0b7e9948 100644 --- a/waflib/Tools/ifort.py +++ b/waflib/Tools/ifort.py @@ -85,8 +85,7 @@ def configure(conf): v.MSVC_COMPILER = compiler try: v.MSVC_VERSION = float(version) - except Exception: - raise + except TypeError: v.MSVC_VERSION = float(version[:-3]) conf.find_ifort_win32() diff --git a/waflib/Tools/tex.py b/waflib/Tools/tex.py index db31becb..6ebeeacb 100644 --- a/waflib/Tools/tex.py +++ b/waflib/Tools/tex.py @@ -54,14 +54,16 @@ def bibunitscan(self): for match in re_bibunit.finditer(code): path = match.group('file') if path: + found = None for k in ('', '.bib'): # add another loop for the tex include paths? Logs.debug('tex: trying %s%s', path, k) fi = node.parent.find_resource(path + k) if fi: + found = True nodes.append(fi) - # no break, people are crazy - else: + # no break + if not found: Logs.debug('tex: could not find %s', path) Logs.debug('tex: found the following bibunit files: %s', nodes) diff --git a/waflib/extras/dpapi.py b/waflib/extras/dpapi.py index c988b1c0..b94d4823 100644 --- a/waflib/extras/dpapi.py +++ b/waflib/extras/dpapi.py @@ -35,7 +35,7 @@ def get_data(blob_out): pbData = blob_out.pbData buffer = c_buffer(cbData) memcpy(buffer, pbData, cbData) - LocalFree(pbData); + LocalFree(pbData) return buffer.raw @conf diff --git a/waflib/extras/netcache_client.py b/waflib/extras/netcache_client.py index 5ae19692..1039b38b 100644 --- a/waflib/extras/netcache_client.py +++ b/waflib/extras/netcache_client.py @@ -214,12 +214,9 @@ def can_retrieve_cache(self): p = node.abspath() recv_file(conn, ssig, cnt, p) cnt += 1 - else: - Logs.debug('netcache: obtained %r from cache', self.outputs) except MissingFile as e: Logs.debug('netcache: file is not in the cache %r', e) err = True - except Exception as e: Logs.debug('netcache: could not get the files %r', self.outputs) if Logs.verbose > 1: @@ -229,6 +226,9 @@ def can_retrieve_cache(self): # broken connection? remove this one close_connection(conn) conn = None + else: + Logs.debug('netcache: obtained %r from cache', self.outputs) + finally: release_connection(conn) if err: diff --git a/waflib/extras/resx.py b/waflib/extras/resx.py index 35379db7..3234b36f 100644 --- a/waflib/extras/resx.py +++ b/waflib/extras/resx.py @@ -1,5 +1,5 @@ #! /usr/bin/env python -# +# encoding: utf-8 import os from waflib import Task diff --git a/waflib/extras/xcode6.py b/waflib/extras/xcode6.py index 47474a01..3714773c 100644 --- a/waflib/extras/xcode6.py +++ b/waflib/extras/xcode6.py @@ -150,7 +150,7 @@ its value. However, attributes starting with an underscore _ are ignored during that process and allows you to store arbitray values that are not supposed to be written out. """ -class XCodeNode: +class XCodeNode(object): def __init__(self): self._id = newid() self._been_written = False