am b6e895e8: am 87efcd2e: Merge "Don\'t avoid IPv6 when looking for new tzdata."

* commit 'b6e895e80f96301b3921a2ec7327c337ab988b41':
  Don't avoid IPv6 when looking for new tzdata.
This commit is contained in:
Elliott Hughes 2013-04-24 11:01:28 -07:00 committed by Android Git Automerger
commit 537e1aa9c6

View File

@ -6,7 +6,6 @@ import ftplib
import httplib import httplib
import os import os
import re import re
import socket
import subprocess import subprocess
import sys import sys
import tarfile import tarfile
@ -33,14 +32,6 @@ regions = ['africa', 'antarctica', 'asia', 'australasia', 'backward',
'etcetera', 'europe', 'northamerica', 'southamerica'] 'etcetera', 'europe', 'northamerica', 'southamerica']
def DisableIpv6():
"""Replaces socket.getaddrinfo with a version that only requests IPv4 addresses."""
__real_getaddrinfo = socket.getaddrinfo
def __ipv4_getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
return __real_getaddrinfo(host, port, socket.AF_INET, socktype, proto, flags)
socket.getaddrinfo = __ipv4_getaddrinfo
def GetCurrentTzDataVersion(): def GetCurrentTzDataVersion():
return open('%s/tzdata' % bionic_libc_zoneinfo_dir).read().split('\x00', 1)[0] return open('%s/tzdata' % bionic_libc_zoneinfo_dir).read().split('\x00', 1)[0]
@ -159,7 +150,6 @@ def main():
# The FTP server lets you download intermediate releases, and also lets you # The FTP server lets you download intermediate releases, and also lets you
# download the signatures for verification, so it's your best choice. # download the signatures for verification, so it's your best choice.
use_ftp = True use_ftp = True
DisableIpv6() # I've been unable to talk to the FTP server over IPv6 (2013-04).
if use_ftp: if use_ftp:
ftp = ftplib.FTP('ftp.iana.org') ftp = ftplib.FTP('ftp.iana.org')