def main(): assert len(sys.argv) == 2, 'Output file not specified on command line' pot_file_name = sys.argv[1] if not os.path.exists(os.path.dirname(pot_file_name)): os.makedirs(os.path.dirname(pot_file_name)) pot = open(pot_file_name, 'wb') print >> pot, boilerplate for zone in allzones(): print >> pot, 'msgid "%s"' % zone print >> pot, 'msgstr ""' print >> pot
def main(): dest_dir = os.path.abspath(os.path.join(os.path.dirname(__file__))) datf = open(os.path.join(dest_dir, 'zdump.out'), 'w') for zone in allzones(): print('Collecting zdump(1) output for %s in zdump.out' % (zone,)) # We don't yet support v2 format tzfile(5) files, so limit # the daterange we test against - zdump understands v2 format # files and will output historical records we can't cope with # otherwise. command = [zdump, '-v', '-c', '1902,2038', zone] zd_out = subprocess.check_output(command) # Skip bogus output on 64bit architectures, per Bug #213816 lines = [ line.strip() for line in zd_out.splitlines() if not line.decode('utf-8').strip().endswith('NULL')] for line in lines: print >> datf, line datf.flush() datf.close()