Index: pychecker-0.8.17/pychecker/warn.py =================================================================== --- pychecker-0.8.17.orig/pychecker/warn.py +++ pychecker-0.8.17/pychecker/warn.py @@ -391,16 +391,26 @@ def getBlackList(moduleList) : pass return blacklist -def getStandardLibrary() : +def getStandardLibraries() : + """ + Return a list of standard libraries. + + @rtype: list of str or None + """ if cfg().ignoreStandardLibrary : try : from distutils import sysconfig - std_lib = sysconfig.get_python_lib() - path = os.path.split(std_lib) - if path[1] == 'site-packages' : - std_lib = path[0] - return std_lib + std_libs = [ + sysconfig.get_python_lib(plat_specific=0), + sysconfig.get_python_lib(plat_specific=1) + ] + ret = [] + for std_lib in std_libs: + path = os.path.split(std_lib) + if path[1] == 'site-packages' : + ret.append(path[0]) + return ret except ImportError : return None @@ -409,12 +419,20 @@ def normalize_path(path): def removeWarnings(warnings, blacklist, std_lib, cfg): if std_lib is not None: - std_lib = normalize_path(std_lib) + std_lib = [normalize_path(p) for p in std_lib] for index in range(len(warnings)-1, -1, -1) : filename = normalize_path(warnings[index].file) - if filename in blacklist or (std_lib is not None and - utils.startswith(filename, std_lib)) : + if filename in blacklist: del warnings[index] + elif std_lib: + found = False + for path in std_lib: + if utils.startswith(filename, path) : + del warnings[index] + found = True + break + if found: + continue elif cfg.only: # ignore files not specified on the cmd line if requested if os.path.abspath(filename) not in cfg.files: @@ -721,7 +739,7 @@ def find(moduleList, initialCfg, suppres std_lib = None if cfg().ignoreStandardLibrary : - std_lib = getStandardLibrary() + std_lib = getStandardLibraries() return removeWarnings(warnings, getBlackList(cfg().blacklist), std_lib, cfg())