(ianaZones, ianaLinks, icuZones, icuLinks, ignoreBackzone)
return sorted(result, key=itemgetter(0))
Find incorrect ICU zone entries.
Find incorrect ICU zone entries.
Find incorrect ICU zone entries .
def findIncorrectICUZones(ianaZones, ianaLinks, icuZones, icuLinks, ignoreBackzone):
    """ Find incorrect ICU zone entries. """
    isIANATimeZone = lambda zone: zone in ianaZones or zone in ianaLinks
    isICUTimeZone = lambda zone: zone in icuZones or zone in icuLinks
    isICULink = lambda zone: zone in icuLinks

    # All IANA zones should be present in ICU.
    missingTimeZones = [zone for zone in ianaZones if not isICUTimeZone(zone)]
    # Normally zones in backzone are also present as links in one of the other
    # time zone files. The only exception to this rule is the Asia/Hanoi time
    # zone, this zone is only present in the backzone file.
    expectedMissing = [] if ignoreBackzone else [Zone("Asia/Hanoi")]
    if missingTimeZones != expectedMissing:
        raise RuntimeError("Not all zones are present in ICU, did you forget "
                           "to run intl/update-tzdata.sh? %s" % missingTimeZones)

    # Zones which are only present in ICU?
    additionalTimeZones = [zone for zone in icuZones if not isIANATimeZone(zone)]
    if additionalTimeZones:
        raise RuntimeError("Additional zones present in ICU, did you forget "
                           "to run intl/update-tzdata.sh? %s" % additionalTimeZones)

    # Zones which are marked as links in ICU.
    result = ((zone, icuLinks[zone]) for zone in ianaZones if isICULink(zone))

    # Remove unnecessary UTC mappings.
    utcnames = ["Etc/UTC", "Etc/UCT", "Etc/GMT"]
    result = ifilterfalse(lambda (zone, target): zone.name in utcnames, result)

    return sorted(result, key=itemgetter(0))
def findIncorrectICUZones ( ianaZones , ianaLinks , icuZones , icuLinks , ignoreBackzone ) : isIANATimeZone = lambda zone : zone in ianaZones or zone in ianaLinks isICUTimeZone = lambda zone : zone in icuZones or zone in icuLinks isICULink = lambda zone : zone in icuLinks # All IANA zones should be present in ICU. missingTimeZones = [ zone for zone in ianaZones if not isICUTimeZone ( zone ) ] # Normally zones in backzone are also present as links in one of the other # time zone files. The only exception to this rule is the Asia/Hanoi time # zone, this zone is only present in the backzone file. expectedMissing = [ ] if ignoreBackzone else [ Zone ( "Asia/Hanoi" ) ] if missingTimeZones != expectedMissing : raise RuntimeError ( "Not all zones are present in ICU, did you forget " "to run intl/update-tzdata.sh? %s" % missingTimeZones ) # Zones which are only present in ICU? additionalTimeZones = [ zone for zone in icuZones if not isIANATimeZone ( zone ) ] if additionalTimeZones : raise RuntimeError ( "Additional zones present in ICU, did you forget " "to run intl/update-tzdata.sh? %s" % additionalTimeZones ) # Zones which are marked as links in ICU. result = ( ( zone , icuLinks [ zone ] ) for zone in ianaZones if isICULink ( zone ) ) # Remove unnecessary UTC mappings. utcnames = [ "Etc/UTC" , "Etc/UCT" , "Etc/GMT" ] result = ifilterfalse ( lambda ( zone , target ) : zone . name in utcnames , result ) return sorted ( result , key = itemgetter ( 0 ) )