Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 1 | #!/usr/bin/python |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 2 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 3 | """Updates the timezone data held in bionic and ICU.""" |
Elliott Hughes | d40e63e | 2011-02-17 16:20:07 -0800 | [diff] [blame] | 4 | |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 5 | import ftplib |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 6 | import glob |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 7 | import httplib |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 8 | import os |
| 9 | import re |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 10 | import shutil |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 11 | import subprocess |
| 12 | import sys |
| 13 | import tarfile |
| 14 | import tempfile |
Elliott Hughes | d40e63e | 2011-02-17 16:20:07 -0800 | [diff] [blame] | 15 | |
Elliott Hughes | 2c2463b | 2014-11-11 14:10:51 -0800 | [diff] [blame] | 16 | regions = ['africa', 'antarctica', 'asia', 'australasia', |
| 17 | 'etcetera', 'europe', 'northamerica', 'southamerica', |
| 18 | # These two deliberately come last so they override what came |
| 19 | # before (and each other). |
| 20 | 'backward', 'backzone' ] |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 21 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 22 | def CheckDirExists(dir, dirname): |
| 23 | if not os.path.isdir(dir): |
| 24 | print "Couldn't find %s (%s)!" % (dirname, dir) |
| 25 | sys.exit(1) |
| 26 | |
| 27 | bionic_libc_tools_zoneinfo_dir = os.path.realpath(os.path.dirname(sys.argv[0])) |
| 28 | |
| 29 | # Find the bionic directory, searching upward from this script. |
| 30 | bionic_dir = os.path.realpath('%s/../../..' % bionic_libc_tools_zoneinfo_dir) |
| 31 | bionic_libc_zoneinfo_dir = '%s/libc/zoneinfo' % bionic_dir |
| 32 | CheckDirExists(bionic_libc_zoneinfo_dir, 'bionic/libc/zoneinfo') |
| 33 | CheckDirExists(bionic_libc_tools_zoneinfo_dir, 'bionic/libc/tools/zoneinfo') |
| 34 | print 'Found bionic in %s ...' % bionic_dir |
| 35 | |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 36 | # Find the icu directory. |
| 37 | icu_dir = os.path.realpath('%s/../external/icu' % bionic_dir) |
| 38 | icu4c_dir = os.path.realpath('%s/icu4c/source' % icu_dir) |
| 39 | icu4j_dir = os.path.realpath('%s/icu4j' % icu_dir) |
| 40 | CheckDirExists(icu4c_dir, 'external/icu/icu4c/source') |
| 41 | CheckDirExists(icu4j_dir, 'external/icu/icu4j') |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 42 | print 'Found icu in %s ...' % icu_dir |
| 43 | |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 44 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 45 | def GetCurrentTzDataVersion(): |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 46 | return open('%s/tzdata' % bionic_libc_zoneinfo_dir).read().split('\x00', 1)[0] |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 47 | |
| 48 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 49 | def WriteSetupFile(): |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 50 | """Writes the list of zones that ZoneCompactor should process.""" |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 51 | links = [] |
| 52 | zones = [] |
| 53 | for region in regions: |
| 54 | for line in open('extracted/%s' % region): |
| 55 | fields = line.split() |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 56 | if fields: |
| 57 | if fields[0] == 'Link': |
Elliott Hughes | 2c2463b | 2014-11-11 14:10:51 -0800 | [diff] [blame] | 58 | links.append('%s %s %s' % (fields[0], fields[1], fields[2])) |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 59 | zones.append(fields[2]) |
| 60 | elif fields[0] == 'Zone': |
| 61 | zones.append(fields[1]) |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 62 | zones.sort() |
| 63 | |
| 64 | setup = open('setup', 'w') |
Elliott Hughes | 2c2463b | 2014-11-11 14:10:51 -0800 | [diff] [blame] | 65 | for link in sorted(set(links)): |
| 66 | setup.write('%s\n' % link) |
| 67 | for zone in sorted(set(zones)): |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 68 | setup.write('%s\n' % zone) |
| 69 | setup.close() |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 70 | |
| 71 | |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 72 | def SwitchToNewTemporaryDirectory(): |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 73 | tmp_dir = tempfile.mkdtemp('-tzdata') |
| 74 | os.chdir(tmp_dir) |
| 75 | print 'Created temporary directory "%s"...' % tmp_dir |
| 76 | |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 77 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 78 | def FtpRetrieveFile(ftp, filename): |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 79 | ftp.retrbinary('RETR %s' % filename, open(filename, 'wb').write) |
| 80 | |
| 81 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 82 | def FtpRetrieveFileAndSignature(ftp, data_filename): |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 83 | """Downloads and repackages the given data from the given FTP server.""" |
Elliott Hughes | 5d2ef87 | 2012-11-26 13:44:49 -0800 | [diff] [blame] | 84 | print 'Downloading data...' |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 85 | FtpRetrieveFile(ftp, data_filename) |
Elliott Hughes | 5d2ef87 | 2012-11-26 13:44:49 -0800 | [diff] [blame] | 86 | |
| 87 | print 'Downloading signature...' |
| 88 | signature_filename = '%s.asc' % data_filename |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 89 | FtpRetrieveFile(ftp, signature_filename) |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 90 | |
| 91 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 92 | def HttpRetrieveFile(http, path, output_filename): |
Elliott Hughes | 676e66d | 2013-04-22 11:41:57 -0700 | [diff] [blame] | 93 | http.request("GET", path) |
| 94 | f = open(output_filename, 'wb') |
| 95 | f.write(http.getresponse().read()) |
| 96 | f.close() |
| 97 | |
| 98 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 99 | def HttpRetrieveFileAndSignature(http, data_filename): |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 100 | """Downloads and repackages the given data from the given HTTP server.""" |
Elliott Hughes | 676e66d | 2013-04-22 11:41:57 -0700 | [diff] [blame] | 101 | path = "/time-zones/repository/releases/%s" % data_filename |
| 102 | |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 103 | print 'Downloading data...' |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 104 | HttpRetrieveFile(http, path, data_filename) |
Elliott Hughes | 676e66d | 2013-04-22 11:41:57 -0700 | [diff] [blame] | 105 | |
| 106 | print 'Downloading signature...' |
| 107 | signature_filename = '%s.asc' % data_filename |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 108 | HttpRetrievefile(http, "%s.asc" % path, signature_filename) |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 109 | |
| 110 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 111 | def BuildIcuToolsAndData(data_filename): |
| 112 | # Keep track of the original cwd so we can go back to it at the end. |
| 113 | original_working_dir = os.getcwd() |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 114 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 115 | # Create a directory to run 'make' from. |
| 116 | icu_working_dir = '%s/icu' % original_working_dir |
| 117 | os.mkdir(icu_working_dir) |
| 118 | os.chdir(icu_working_dir) |
| 119 | |
| 120 | # Build the ICU tools. |
| 121 | print 'Configuring ICU tools...' |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 122 | subprocess.check_call(['%s/runConfigureICU' % icu4c_dir, 'Linux']) |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 123 | |
| 124 | # Run the ICU tools. |
| 125 | os.chdir('tools/tzcode') |
Neil Fuller | 0662c3e | 2015-02-02 16:50:05 +0000 | [diff] [blame] | 126 | |
| 127 | # The tz2icu tool only picks up icuregions and icuzones in they are in the CWD |
| 128 | for icu_data_file in [ 'icuregions', 'icuzones']: |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 129 | icu_data_file_source = '%s/tools/tzcode/%s' % (icu4c_dir, icu_data_file) |
Neil Fuller | 0662c3e | 2015-02-02 16:50:05 +0000 | [diff] [blame] | 130 | icu_data_file_symlink = './%s' % icu_data_file |
| 131 | os.symlink(icu_data_file_source, icu_data_file_symlink) |
| 132 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 133 | shutil.copyfile('%s/%s' % (original_working_dir, data_filename), data_filename) |
| 134 | print 'Making ICU data...' |
Neil Fuller | 0662c3e | 2015-02-02 16:50:05 +0000 | [diff] [blame] | 135 | # The Makefile assumes the existence of the bin directory. |
| 136 | os.mkdir('%s/bin' % icu_working_dir) |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 137 | subprocess.check_call(['make']) |
| 138 | |
Elliott Hughes | f8896c6 | 2014-09-30 17:30:01 -0700 | [diff] [blame] | 139 | # Copy the source file to its ultimate destination. |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 140 | icu_txt_data_dir = '%s/data/misc' % icu4c_dir |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 141 | print 'Copying zoneinfo64.txt to %s ...' % icu_txt_data_dir |
| 142 | shutil.copy('zoneinfo64.txt', icu_txt_data_dir) |
| 143 | |
Elliott Hughes | f8896c6 | 2014-09-30 17:30:01 -0700 | [diff] [blame] | 144 | # Regenerate the .dat file. |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 145 | os.chdir(icu_working_dir) |
Fredrik Roubert | bdd8452 | 2015-02-04 17:17:34 +0100 | [diff] [blame] | 146 | subprocess.check_call(['make', 'INCLUDE_UNI_CORE_DATA=1', '-j32']) |
Elliott Hughes | f8896c6 | 2014-09-30 17:30:01 -0700 | [diff] [blame] | 147 | |
| 148 | # Copy the .dat file to its ultimate destination. |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 149 | icu_dat_data_dir = '%s/stubdata' % icu4c_dir |
Neil Fuller | 43f3715 | 2014-05-21 16:59:09 +0100 | [diff] [blame] | 150 | datfiles = glob.glob('data/out/tmp/icudt??l.dat') |
| 151 | if len(datfiles) != 1: |
| 152 | print 'ERROR: Unexpectedly found %d .dat files (%s). Halting.' % (len(datfiles), datfiles) |
| 153 | sys.exit(1) |
Neil Fuller | 43f3715 | 2014-05-21 16:59:09 +0100 | [diff] [blame] | 154 | datfile = datfiles[0] |
| 155 | print 'Copying %s to %s ...' % (datfile, icu_dat_data_dir) |
| 156 | shutil.copy(datfile, icu_dat_data_dir) |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 157 | |
Neil Fuller | 4d3abcb | 2015-04-09 09:22:25 +0100 | [diff] [blame] | 158 | # Generate the ICU4J .jar files |
| 159 | os.chdir('%s/data' % icu_working_dir) |
| 160 | subprocess.check_call(['make', 'icu4j-data']) |
| 161 | |
| 162 | # Copy the ICU4J .jar files to their ultimate destination. |
| 163 | icu_jar_data_dir = '%s/main/shared/data' % icu4j_dir |
| 164 | jarfiles = glob.glob('out/icu4j/*.jar') |
| 165 | if len(jarfiles) != 2: |
| 166 | print 'ERROR: Unexpectedly found %d .jar files (%s). Halting.' % (len(jarfiles), jarfiles) |
| 167 | sys.exit(1) |
| 168 | for jarfile in jarfiles: |
| 169 | print 'Copying %s to %s ...' % (jarfile, icu_jar_data_dir) |
| 170 | shutil.copy(jarfile, icu_jar_data_dir) |
| 171 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 172 | # Switch back to the original working cwd. |
| 173 | os.chdir(original_working_dir) |
| 174 | |
| 175 | |
| 176 | def CheckSignature(data_filename): |
Elliott Hughes | 676e66d | 2013-04-22 11:41:57 -0700 | [diff] [blame] | 177 | signature_filename = '%s.asc' % data_filename |
| 178 | print 'Verifying signature...' |
| 179 | # If this fails for you, you probably need to import Paul Eggert's public key: |
| 180 | # gpg --recv-keys ED97E90E62AA7E34 |
| 181 | subprocess.check_call(['gpg', '--trusted-key=ED97E90E62AA7E34', '--verify', |
| 182 | signature_filename, data_filename]) |
| 183 | |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 184 | |
| 185 | def BuildBionicToolsAndData(data_filename): |
| 186 | new_version = re.search('(tzdata.+)\\.tar\\.gz', data_filename).group(1) |
| 187 | |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 188 | print 'Extracting...' |
| 189 | os.mkdir('extracted') |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 190 | tar = tarfile.open(data_filename, 'r') |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 191 | tar.extractall('extracted') |
| 192 | |
| 193 | print 'Calling zic(1)...' |
| 194 | os.mkdir('data') |
Elliott Hughes | 2c2463b | 2014-11-11 14:10:51 -0800 | [diff] [blame] | 195 | zic_inputs = [ 'extracted/%s' % x for x in regions ] |
| 196 | zic_cmd = ['zic', '-d', 'data' ] |
| 197 | zic_cmd.extend(zic_inputs) |
| 198 | subprocess.check_call(zic_cmd) |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 199 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 200 | WriteSetupFile() |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 201 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 202 | print 'Calling ZoneCompactor to update bionic to %s...' % new_version |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 203 | subprocess.check_call(['javac', '-d', '.', |
Elliott Hughes | 13bab43 | 2014-08-06 15:23:11 -0700 | [diff] [blame] | 204 | '%s/ZoneCompactor.java' % bionic_libc_tools_zoneinfo_dir]) |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 205 | subprocess.check_call(['java', 'ZoneCompactor', |
Elliott Hughes | 2393535 | 2012-10-22 14:47:58 -0700 | [diff] [blame] | 206 | 'setup', 'data', 'extracted/zone.tab', |
| 207 | bionic_libc_zoneinfo_dir, new_version]) |
Elliott Hughes | 5d967e4 | 2012-07-20 16:52:39 -0700 | [diff] [blame] | 208 | |
Elliott Hughes | d40e63e | 2011-02-17 16:20:07 -0800 | [diff] [blame] | 209 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 210 | # Run with no arguments from any directory, with no special setup required. |
Elliott Hughes | e3063f4 | 2012-11-05 08:53:28 -0800 | [diff] [blame] | 211 | # See http://www.iana.org/time-zones/ for more about the source of this data. |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 212 | def main(): |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 213 | print 'Looking for new tzdata...' |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 214 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 215 | tzdata_filenames = [] |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 216 | |
| 217 | # The FTP server lets you download intermediate releases, and also lets you |
Elliott Hughes | 21da42e | 2013-04-22 13:44:50 -0700 | [diff] [blame] | 218 | # download the signatures for verification, so it's your best choice. |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 219 | use_ftp = True |
| 220 | |
| 221 | if use_ftp: |
| 222 | ftp = ftplib.FTP('ftp.iana.org') |
| 223 | ftp.login() |
| 224 | ftp.cwd('tz/releases') |
| 225 | for filename in ftp.nlst(): |
| 226 | if filename.startswith('tzdata20') and filename.endswith('.tar.gz'): |
| 227 | tzdata_filenames.append(filename) |
| 228 | tzdata_filenames.sort() |
| 229 | else: |
| 230 | http = httplib.HTTPConnection('www.iana.org') |
| 231 | http.request("GET", "/time-zones") |
| 232 | index_lines = http.getresponse().read().split('\n') |
| 233 | for line in index_lines: |
| 234 | m = re.compile('.*href="/time-zones/repository/releases/(tzdata20\d\d\c\.tar\.gz)".*').match(line) |
| 235 | if m: |
| 236 | tzdata_filenames.append(m.group(1)) |
Elliott Hughes | bcb2eda | 2011-10-24 10:47:25 -0700 | [diff] [blame] | 237 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 238 | # If you're several releases behind, we'll walk you through the upgrades |
| 239 | # one by one. |
| 240 | current_version = GetCurrentTzDataVersion() |
| 241 | current_filename = '%s.tar.gz' % current_version |
| 242 | for filename in tzdata_filenames: |
| 243 | if filename > current_filename: |
| 244 | print 'Found new tzdata: %s' % filename |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 245 | SwitchToNewTemporaryDirectory() |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 246 | if use_ftp: |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 247 | FtpRetrieveFileAndSignature(ftp, filename) |
Elliott Hughes | f8dff7d | 2013-04-22 11:11:43 -0700 | [diff] [blame] | 248 | else: |
Neil Fuller | 246c688 | 2014-05-16 18:04:48 +0100 | [diff] [blame] | 249 | HttpRetrieveFileAndSignature(http, filename) |
| 250 | |
| 251 | CheckSignature(filename) |
| 252 | BuildIcuToolsAndData(filename) |
| 253 | BuildBionicToolsAndData(filename) |
| 254 | print 'Look in %s and %s for new data files' % (bionic_dir, icu_dir) |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 255 | sys.exit(0) |
Elliott Hughes | d40e63e | 2011-02-17 16:20:07 -0800 | [diff] [blame] | 256 | |
Elliott Hughes | 5b1497a | 2012-10-19 14:47:37 -0700 | [diff] [blame] | 257 | print 'You already have the latest tzdata (%s)!' % current_version |
| 258 | sys.exit(0) |
| 259 | |
| 260 | |
| 261 | if __name__ == '__main__': |
| 262 | main() |