Mercurial > babel > old > mirror
annotate 0.9.x/scripts/import_cldr.py @ 471:40735021c908 stable
Merged revisions 518-519 via svnmerge from
http://svn.edgewall.org/repos/babel/trunk
........
r518 | jruigrok | 2010-04-08 11:16:53 +0200 (do, 08 apr 2010) | 2 lines
Fix the ElementTree find()/findall() syntax to be compatible with Python 2.7.
........
r519 | jruigrok | 2010-04-08 11:17:34 +0200 (do, 08 apr 2010) | 2 lines
Document the Python 2.7 ElementTree fix.
........
author | jruigrok |
---|---|
date | Sun, 11 Apr 2010 08:10:45 +0000 |
parents | e69a068990f0 |
children | 4f39b6e38540 |
rev | line source |
---|---|
263 | 1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- | |
3 # | |
4 # Copyright (C) 2007 Edgewall Software | |
5 # All rights reserved. | |
6 # | |
7 # This software is licensed as described in the file COPYING, which | |
8 # you should have received as part of this distribution. The terms | |
9 # are also available at http://babel.edgewall.org/wiki/License. | |
10 # | |
11 # This software consists of voluntary contributions made by many | |
12 # individuals. For the exact contribution history, see the revision | |
13 # history and logs, available at http://babel.edgewall.org/log/. | |
14 | |
15 import copy | |
16 from optparse import OptionParser | |
17 import os | |
18 import pickle | |
381 | 19 import re |
263 | 20 import sys |
21 try: | |
22 from xml.etree.ElementTree import parse | |
23 except ImportError: | |
24 from elementtree.ElementTree import parse | |
25 | |
26 # Make sure we're using Babel source, and not some previously installed version | |
27 sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '..')) | |
28 | |
29 from babel import dates, numbers | |
381 | 30 from babel.localedata import Alias |
263 | 31 |
32 weekdays = {'mon': 0, 'tue': 1, 'wed': 2, 'thu': 3, 'fri': 4, 'sat': 5, | |
33 'sun': 6} | |
34 | |
35 try: | |
36 any | |
37 except NameError: | |
38 def any(iterable): | |
39 return filter(None, list(iterable)) | |
40 | |
381 | 41 |
263 | 42 def _text(elem): |
43 buf = [elem.text or ''] | |
44 for child in elem: | |
45 buf.append(_text(child)) | |
46 buf.append(elem.tail or '') | |
47 return u''.join(filter(None, buf)).strip() | |
48 | |
381 | 49 |
50 NAME_RE = re.compile(r"^\w+$") | |
51 TYPE_ATTR_RE = re.compile(r"^\w+\[@type='(.*?)'\]$") | |
52 | |
53 NAME_MAP = { | |
54 'dateFormats': 'date_formats', | |
55 'dateTimeFormats': 'datetime_formats', | |
56 'eraAbbr': 'abbreviated', | |
57 'eraNames': 'wide', | |
58 'eraNarrow': 'narrow', | |
59 'timeFormats': 'time_formats' | |
60 } | |
61 | |
62 def _translate_alias(ctxt, path): | |
63 parts = path.split('/') | |
64 keys = ctxt[:] | |
65 for part in parts: | |
66 if part == '..': | |
67 keys.pop() | |
68 else: | |
69 match = TYPE_ATTR_RE.match(part) | |
70 if match: | |
71 keys.append(match.group(1)) | |
72 else: | |
73 assert NAME_RE.match(part) | |
74 keys.append(NAME_MAP.get(part, part)) | |
75 return keys | |
76 | |
77 | |
263 | 78 def main(): |
79 parser = OptionParser(usage='%prog path/to/cldr') | |
80 options, args = parser.parse_args() | |
81 if len(args) != 1: | |
82 parser.error('incorrect number of arguments') | |
83 | |
84 srcdir = args[0] | |
85 destdir = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), | |
86 '..', 'babel') | |
87 | |
88 sup = parse(os.path.join(srcdir, 'supplemental', 'supplementalData.xml')) | |
89 | |
348
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
90 # Import global data from the supplemental files |
263 | 91 global_data = {} |
92 | |
93 territory_zones = global_data.setdefault('territory_zones', {}) | |
94 zone_aliases = global_data.setdefault('zone_aliases', {}) | |
95 zone_territories = global_data.setdefault('zone_territories', {}) | |
471 | 96 for elem in sup.findall('.//timezoneData/zoneFormatting/zoneItem'): |
263 | 97 tzid = elem.attrib['type'] |
98 territory_zones.setdefault(elem.attrib['territory'], []).append(tzid) | |
99 zone_territories[tzid] = elem.attrib['territory'] | |
100 if 'aliases' in elem.attrib: | |
101 for alias in elem.attrib['aliases'].split(): | |
102 zone_aliases[alias] = tzid | |
103 | |
348
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
104 # Import Metazone mapping |
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
105 meta_zones = global_data.setdefault('meta_zones', {}) |
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
106 tzsup = parse(os.path.join(srcdir, 'supplemental', 'metazoneInfo.xml')) |
471 | 107 for elem in tzsup.findall('.//timezone'): |
348
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
108 for child in elem.findall('usesMetazone'): |
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
109 if 'to' not in child.attrib: # FIXME: support old mappings |
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
110 meta_zones[elem.attrib['type']] = child.attrib['mzone'] |
05975a0e7021
Merged revisions [358:360], [364:370], [373:378], [380:382] from [source:trunk].
cmlenz
parents:
263
diff
changeset
|
111 |
263 | 112 outfile = open(os.path.join(destdir, 'global.dat'), 'wb') |
113 try: | |
114 pickle.dump(global_data, outfile, 2) | |
115 finally: | |
116 outfile.close() | |
117 | |
118 # build a territory containment mapping for inheritance | |
119 regions = {} | |
471 | 120 for elem in sup.findall('.//territoryContainment/group'): |
263 | 121 regions[elem.attrib['type']] = elem.attrib['contains'].split() |
122 | |
123 # Resolve territory containment | |
124 territory_containment = {} | |
125 region_items = regions.items() | |
126 region_items.sort() | |
127 for group, territory_list in region_items: | |
128 for territory in territory_list: | |
129 containers = territory_containment.setdefault(territory, set([])) | |
130 if group in territory_containment: | |
131 containers |= territory_containment[group] | |
132 containers.add(group) | |
133 | |
134 filenames = os.listdir(os.path.join(srcdir, 'main')) | |
135 filenames.remove('root.xml') | |
136 filenames.sort(lambda a,b: len(a)-len(b)) | |
137 filenames.insert(0, 'root.xml') | |
138 | |
139 for filename in filenames: | |
140 stem, ext = os.path.splitext(filename) | |
141 if ext != '.xml': | |
142 continue | |
143 | |
391
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
144 print>>sys.stderr, 'Processing input file %r' % filename |
263 | 145 tree = parse(os.path.join(srcdir, 'main', filename)) |
146 data = {} | |
147 | |
148 language = None | |
471 | 149 elem = tree.find('.//identity/language') |
263 | 150 if elem is not None: |
151 language = elem.attrib['type'] | |
152 print>>sys.stderr, ' Language: %r' % language | |
153 | |
154 territory = None | |
471 | 155 elem = tree.find('.//identity/territory') |
263 | 156 if elem is not None: |
157 territory = elem.attrib['type'] | |
158 else: | |
159 territory = '001' # world | |
160 print>>sys.stderr, ' Territory: %r' % territory | |
161 regions = territory_containment.get(territory, []) | |
162 print>>sys.stderr, ' Regions: %r' % regions | |
163 | |
164 # <localeDisplayNames> | |
165 | |
166 territories = data.setdefault('territories', {}) | |
471 | 167 for elem in tree.findall('.//territories/territory'): |
381 | 168 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
169 and elem.attrib['type'] in territories: | |
263 | 170 continue |
171 territories[elem.attrib['type']] = _text(elem) | |
172 | |
173 languages = data.setdefault('languages', {}) | |
471 | 174 for elem in tree.findall('.//languages/language'): |
381 | 175 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
176 and elem.attrib['type'] in languages: | |
263 | 177 continue |
178 languages[elem.attrib['type']] = _text(elem) | |
179 | |
180 variants = data.setdefault('variants', {}) | |
471 | 181 for elem in tree.findall('.//variants/variant'): |
381 | 182 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
183 and elem.attrib['type'] in variants: | |
263 | 184 continue |
185 variants[elem.attrib['type']] = _text(elem) | |
186 | |
187 scripts = data.setdefault('scripts', {}) | |
471 | 188 for elem in tree.findall('.//scripts/script'): |
381 | 189 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
190 and elem.attrib['type'] in scripts: | |
263 | 191 continue |
192 scripts[elem.attrib['type']] = _text(elem) | |
193 | |
194 # <dates> | |
195 | |
196 week_data = data.setdefault('week_data', {}) | |
471 | 197 supelem = sup.find('.//weekData') |
263 | 198 |
199 for elem in supelem.findall('minDays'): | |
200 territories = elem.attrib['territories'].split() | |
201 if territory in territories or any([r in territories for r in regions]): | |
202 week_data['min_days'] = int(elem.attrib['count']) | |
203 | |
204 for elem in supelem.findall('firstDay'): | |
205 territories = elem.attrib['territories'].split() | |
206 if territory in territories or any([r in territories for r in regions]): | |
207 week_data['first_day'] = weekdays[elem.attrib['day']] | |
208 | |
209 for elem in supelem.findall('weekendStart'): | |
210 territories = elem.attrib['territories'].split() | |
211 if territory in territories or any([r in territories for r in regions]): | |
212 week_data['weekend_start'] = weekdays[elem.attrib['day']] | |
213 | |
214 for elem in supelem.findall('weekendEnd'): | |
215 territories = elem.attrib['territories'].split() | |
216 if territory in territories or any([r in territories for r in regions]): | |
217 week_data['weekend_end'] = weekdays[elem.attrib['day']] | |
218 | |
219 zone_formats = data.setdefault('zone_formats', {}) | |
471 | 220 for elem in tree.findall('.//timeZoneNames/gmtFormat'): |
381 | 221 if 'draft' not in elem.attrib and 'alt' not in elem.attrib: |
263 | 222 zone_formats['gmt'] = unicode(elem.text).replace('{0}', '%s') |
223 break | |
471 | 224 for elem in tree.findall('.//timeZoneNames/regionFormat'): |
381 | 225 if 'draft' not in elem.attrib and 'alt' not in elem.attrib: |
263 | 226 zone_formats['region'] = unicode(elem.text).replace('{0}', '%s') |
227 break | |
471 | 228 for elem in tree.findall('.//timeZoneNames/fallbackFormat'): |
381 | 229 if 'draft' not in elem.attrib and 'alt' not in elem.attrib: |
263 | 230 zone_formats['fallback'] = unicode(elem.text) \ |
231 .replace('{0}', '%(0)s').replace('{1}', '%(1)s') | |
232 break | |
233 | |
234 time_zones = data.setdefault('time_zones', {}) | |
471 | 235 for elem in tree.findall('.//timeZoneNames/zone'): |
263 | 236 info = {} |
237 city = elem.findtext('exemplarCity') | |
238 if city: | |
239 info['city'] = unicode(city) | |
240 for child in elem.findall('long/*'): | |
241 info.setdefault('long', {})[child.tag] = unicode(child.text) | |
242 for child in elem.findall('short/*'): | |
243 info.setdefault('short', {})[child.tag] = unicode(child.text) | |
244 time_zones[elem.attrib['type']] = info | |
245 | |
246 meta_zones = data.setdefault('meta_zones', {}) | |
471 | 247 for elem in tree.findall('.//timeZoneNames/metazone'): |
263 | 248 info = {} |
249 city = elem.findtext('exemplarCity') | |
250 if city: | |
251 info['city'] = unicode(city) | |
252 for child in elem.findall('long/*'): | |
253 info.setdefault('long', {})[child.tag] = unicode(child.text) | |
254 for child in elem.findall('short/*'): | |
255 info.setdefault('short', {})[child.tag] = unicode(child.text) | |
256 info['common'] = elem.findtext('commonlyUsed') == 'true' | |
257 meta_zones[elem.attrib['type']] = info | |
258 | |
471 | 259 for calendar in tree.findall('.//calendars/calendar'): |
263 | 260 if calendar.attrib['type'] != 'gregorian': |
261 # TODO: support other calendar types | |
262 continue | |
263 | |
264 months = data.setdefault('months', {}) | |
265 for ctxt in calendar.findall('months/monthContext'): | |
381 | 266 ctxt_type = ctxt.attrib['type'] |
267 ctxts = months.setdefault(ctxt_type, {}) | |
263 | 268 for width in ctxt.findall('monthWidth'): |
381 | 269 width_type = width.attrib['type'] |
270 widths = ctxts.setdefault(width_type, {}) | |
271 for elem in width.getiterator(): | |
272 if elem.tag == 'month': | |
273 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ | |
274 and int(elem.attrib['type']) in widths: | |
275 continue | |
276 widths[int(elem.attrib.get('type'))] = unicode(elem.text) | |
277 elif elem.tag == 'alias': | |
278 ctxts[width_type] = Alias( | |
279 _translate_alias(['months', ctxt_type, width_type], | |
280 elem.attrib['path']) | |
281 ) | |
263 | 282 |
283 days = data.setdefault('days', {}) | |
284 for ctxt in calendar.findall('days/dayContext'): | |
381 | 285 ctxt_type = ctxt.attrib['type'] |
286 ctxts = days.setdefault(ctxt_type, {}) | |
263 | 287 for width in ctxt.findall('dayWidth'): |
381 | 288 width_type = width.attrib['type'] |
289 widths = ctxts.setdefault(width_type, {}) | |
290 for elem in width.getiterator(): | |
291 if elem.tag == 'day': | |
292 dtype = weekdays[elem.attrib['type']] | |
293 if ('draft' in elem.attrib or 'alt' not in elem.attrib) \ | |
294 and dtype in widths: | |
295 continue | |
296 widths[dtype] = unicode(elem.text) | |
297 elif elem.tag == 'alias': | |
298 ctxts[width_type] = Alias( | |
299 _translate_alias(['days', ctxt_type, width_type], | |
300 elem.attrib['path']) | |
301 ) | |
263 | 302 |
303 quarters = data.setdefault('quarters', {}) | |
304 for ctxt in calendar.findall('quarters/quarterContext'): | |
381 | 305 ctxt_type = ctxt.attrib['type'] |
263 | 306 ctxts = quarters.setdefault(ctxt.attrib['type'], {}) |
307 for width in ctxt.findall('quarterWidth'): | |
381 | 308 width_type = width.attrib['type'] |
309 widths = ctxts.setdefault(width_type, {}) | |
310 for elem in width.getiterator(): | |
311 if elem.tag == 'quarter': | |
312 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ | |
313 and int(elem.attrib['type']) in widths: | |
314 continue | |
315 widths[int(elem.attrib['type'])] = unicode(elem.text) | |
316 elif elem.tag == 'alias': | |
317 ctxts[width_type] = Alias( | |
318 _translate_alias(['quarters', ctxt_type, width_type], | |
319 elem.attrib['path']) | |
320 ) | |
263 | 321 |
322 eras = data.setdefault('eras', {}) | |
323 for width in calendar.findall('eras/*'): | |
381 | 324 width_type = NAME_MAP[width.tag] |
325 widths = eras.setdefault(width_type, {}) | |
326 for elem in width.getiterator(): | |
327 if elem.tag == 'era': | |
328 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ | |
329 and int(elem.attrib['type']) in widths: | |
330 continue | |
331 widths[int(elem.attrib.get('type'))] = unicode(elem.text) | |
332 elif elem.tag == 'alias': | |
333 eras[width_type] = Alias( | |
334 _translate_alias(['eras', width_type], | |
335 elem.attrib['path']) | |
336 ) | |
263 | 337 |
338 # AM/PM | |
339 periods = data.setdefault('periods', {}) | |
340 for elem in calendar.findall('am'): | |
381 | 341 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
342 and elem.tag in periods: | |
263 | 343 continue |
344 periods[elem.tag] = unicode(elem.text) | |
345 for elem in calendar.findall('pm'): | |
381 | 346 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
347 and elem.tag in periods: | |
263 | 348 continue |
349 periods[elem.tag] = unicode(elem.text) | |
350 | |
351 date_formats = data.setdefault('date_formats', {}) | |
381 | 352 for format in calendar.findall('dateFormats'): |
353 for elem in format.getiterator(): | |
354 if elem.tag == 'dateFormatLength': | |
355 if 'draft' in elem.attrib and \ | |
356 elem.attrib.get('type') in date_formats: | |
357 continue | |
358 try: | |
359 date_formats[elem.attrib.get('type')] = \ | |
360 dates.parse_pattern(unicode(elem.findtext('dateFormat/pattern'))) | |
361 except ValueError, e: | |
362 print>>sys.stderr, 'ERROR: %s' % e | |
363 elif elem.tag == 'alias': | |
364 date_formats = Alias(_translate_alias( | |
365 ['date_formats'], elem.attrib['path']) | |
366 ) | |
263 | 367 |
368 time_formats = data.setdefault('time_formats', {}) | |
381 | 369 for format in calendar.findall('timeFormats'): |
370 for elem in format.getiterator(): | |
371 if elem.tag == 'timeFormatLength': | |
372 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ | |
373 and elem.attrib.get('type') in time_formats: | |
374 continue | |
375 try: | |
376 time_formats[elem.attrib.get('type')] = \ | |
377 dates.parse_pattern(unicode(elem.findtext('timeFormat/pattern'))) | |
378 except ValueError, e: | |
379 print>>sys.stderr, 'ERROR: %s' % e | |
380 elif elem.tag == 'alias': | |
381 time_formats = Alias(_translate_alias( | |
382 ['time_formats'], elem.attrib['path']) | |
383 ) | |
263 | 384 |
385 datetime_formats = data.setdefault('datetime_formats', {}) | |
381 | 386 for format in calendar.findall('dateTimeFormats'): |
387 for elem in format.getiterator(): | |
388 if elem.tag == 'dateTimeFormatLength': | |
389 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ | |
390 and elem.attrib.get('type') in datetime_formats: | |
391 continue | |
392 try: | |
393 datetime_formats[elem.attrib.get('type')] = \ | |
394 unicode(elem.findtext('dateTimeFormat/pattern')) | |
395 except ValueError, e: | |
396 print>>sys.stderr, 'ERROR: %s' % e | |
397 elif elem.tag == 'alias': | |
398 datetime_formats = Alias(_translate_alias( | |
399 ['datetime_formats'], elem.attrib['path']) | |
400 ) | |
263 | 401 |
402 # <numbers> | |
403 | |
404 number_symbols = data.setdefault('number_symbols', {}) | |
471 | 405 for elem in tree.findall('.//numbers/symbols/*'): |
263 | 406 number_symbols[elem.tag] = unicode(elem.text) |
407 | |
408 decimal_formats = data.setdefault('decimal_formats', {}) | |
471 | 409 for elem in tree.findall('.//decimalFormats/decimalFormatLength'): |
381 | 410 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
411 and elem.attrib.get('type') in decimal_formats: | |
263 | 412 continue |
413 pattern = unicode(elem.findtext('decimalFormat/pattern')) | |
414 decimal_formats[elem.attrib.get('type')] = numbers.parse_pattern(pattern) | |
415 | |
416 scientific_formats = data.setdefault('scientific_formats', {}) | |
471 | 417 for elem in tree.findall('.//scientificFormats/scientificFormatLength'): |
381 | 418 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
419 and elem.attrib.get('type') in scientific_formats: | |
263 | 420 continue |
421 pattern = unicode(elem.findtext('scientificFormat/pattern')) | |
422 scientific_formats[elem.attrib.get('type')] = numbers.parse_pattern(pattern) | |
423 | |
424 currency_formats = data.setdefault('currency_formats', {}) | |
471 | 425 for elem in tree.findall('.//currencyFormats/currencyFormatLength'): |
381 | 426 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
427 and elem.attrib.get('type') in currency_formats: | |
263 | 428 continue |
429 pattern = unicode(elem.findtext('currencyFormat/pattern')) | |
430 currency_formats[elem.attrib.get('type')] = numbers.parse_pattern(pattern) | |
431 | |
432 percent_formats = data.setdefault('percent_formats', {}) | |
471 | 433 for elem in tree.findall('.//percentFormats/percentFormatLength'): |
381 | 434 if ('draft' in elem.attrib or 'alt' in elem.attrib) \ |
435 and elem.attrib.get('type') in percent_formats: | |
263 | 436 continue |
437 pattern = unicode(elem.findtext('percentFormat/pattern')) | |
438 percent_formats[elem.attrib.get('type')] = numbers.parse_pattern(pattern) | |
439 | |
440 currency_names = data.setdefault('currency_names', {}) | |
441 currency_symbols = data.setdefault('currency_symbols', {}) | |
471 | 442 for elem in tree.findall('.//currencies/currency'): |
391
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
443 code = elem.attrib['type'] |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
444 # TODO: support plural rules for currency name selection |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
445 for name in elem.findall('displayName'): |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
446 if ('draft' in name.attrib or 'count' in name.attrib) \ |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
447 and code in currency_names: |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
448 continue |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
449 currency_names[code] = unicode(name.text) |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
450 # TODO: support choice patterns for currency symbol selection |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
451 symbol = elem.find('symbol') |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
452 if symbol is not None and 'draft' not in symbol.attrib \ |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
453 and 'choice' not in symbol.attrib: |
e69a068990f0
Ported [424], [425], and [428] back to 0.9.x branch.
cmlenz
parents:
381
diff
changeset
|
454 currency_symbols[code] = unicode(symbol.text) |
263 | 455 |
456 outfile = open(os.path.join(destdir, 'localedata', stem + '.dat'), 'wb') | |
457 try: | |
458 pickle.dump(data, outfile, 2) | |
459 finally: | |
460 outfile.close() | |
461 | |
381 | 462 |
263 | 463 if __name__ == '__main__': |
464 main() |