summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-10-26 03:56:46 (GMT)
committerFred Drake <fdrake@acm.org>2000-10-26 03:56:46 (GMT)
commit9c6850510c814dea4c4f5a5c7ff63c5e8ad3976b (patch)
tree7e5201ef7e20df187fbd0fa422e0a8163b957aee
parent33e2c3ece373146e1890504aef0b87d87e8d57d0 (diff)
downloadcpython-9c6850510c814dea4c4f5a5c7ff63c5e8ad3976b.zip
cpython-9c6850510c814dea4c4f5a5c7ff63c5e8ad3976b.tar.gz
cpython-9c6850510c814dea4c4f5a5c7ff63c5e8ad3976b.tar.bz2
Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
-rw-r--r--Tools/unicode/makeunicodedata.py88
1 files changed, 42 insertions, 46 deletions
diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py
index faca17f..8c0c075 100644
--- a/Tools/unicode/makeunicodedata.py
+++ b/Tools/unicode/makeunicodedata.py
@@ -91,56 +91,54 @@ def maketables():
FILE = "Modules/unicodedata_db.h"
- sys.stdout = open(FILE, "w")
-
- print "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
- print
- print "/* a list of unique database records */"
- print "const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {"
+ fp = open(FILE, "w")
+ print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
+ print >>fp
+ print >>fp, "/* a list of unique database records */"
+ print >>fp, \
+ "const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = {"
for item in table:
- print " {%d, %d, %d, %d}," % item
- print "};"
- print
+ print >>fp, " {%d, %d, %d, %d}," % item
+ print >>fp, "};"
+ print >>fp
# FIXME: the following tables should be made static, and
# the support code moved into unicodedatabase.c
- print "/* string literals */"
- print "const char *_PyUnicode_CategoryNames[] = {"
+ print >>fp, "/* string literals */"
+ print >>fp, "const char *_PyUnicode_CategoryNames[] = {"
for name in CATEGORY_NAMES:
- print " \"%s\"," % name
- print " NULL"
- print "};"
+ print >>fp, " \"%s\"," % name
+ print >>fp, " NULL"
+ print >>fp, "};"
- print "const char *_PyUnicode_BidirectionalNames[] = {"
+ print >>fp, "const char *_PyUnicode_BidirectionalNames[] = {"
for name in BIDIRECTIONAL_NAMES:
- print " \"%s\"," % name
- print " NULL"
- print "};"
+ print >>fp, " \"%s\"," % name
+ print >>fp, " NULL"
+ print >>fp, "};"
- print "static const char *decomp_data[] = {"
+ print >>fp, "static const char *decomp_data[] = {"
for name in decomp_data:
- print " \"%s\"," % name
- print " NULL"
- print "};"
+ print >>fp, " \"%s\"," % name
+ print >>fp, " NULL"
+ print >>fp, "};"
# split record index table
index1, index2, shift = splitbins(index)
- print "/* index tables for the database records */"
- print "#define SHIFT", shift
- Array("index1", index1).dump(sys.stdout)
- Array("index2", index2).dump(sys.stdout)
+ print >>fp, "/* index tables for the database records */"
+ print >>fp, "#define SHIFT", shift
+ Array("index1", index1).dump(fp)
+ Array("index2", index2).dump(fp)
# split decomposition index table
index1, index2, shift = splitbins(decomp_index)
- print "/* index tables for the decomposition data */"
- print "#define DECOMP_SHIFT", shift
- Array("decomp_index1", index1).dump(sys.stdout)
- Array("decomp_index2", index2).dump(sys.stdout)
-
- sys.stdout = sys.__stdout__
+ print >>fp, "/* index tables for the decomposition data */"
+ print >>fp, "#define DECOMP_SHIFT", shift
+ Array("decomp_index1", index1).dump(fp)
+ Array("decomp_index2", index2).dump(fp)
#
# 3) unicode type data
@@ -206,26 +204,24 @@ def maketables():
FILE = "Objects/unicodetype_db.h"
- sys.stdout = open(FILE, "w")
+ fp = open(FILE, "w")
- print "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
- print
- print "/* a list of unique character type descriptors */"
- print "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {"
+ print >>fp, "/* this file was generated by %s %s */" % (SCRIPT, VERSION)
+ print >>fp
+ print >>fp, "/* a list of unique character type descriptors */"
+ print >>fp, "const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = {"
for item in table:
- print " {%d, %d, %d, %d, %d, %d}," % item
- print "};"
- print
+ print >>fp, " {%d, %d, %d, %d, %d, %d}," % item
+ print >>fp, "};"
+ print >>fp
# split decomposition index table
index1, index2, shift = splitbins(index)
- print "/* type indexes */"
- print "#define SHIFT", shift
- Array("index1", index1).dump(sys.stdout)
- Array("index2", index2).dump(sys.stdout)
-
- sys.stdout = sys.__stdout__
+ print >>fp, "/* type indexes */"
+ print >>fp, "#define SHIFT", shift
+ Array("index1", index1).dump(fp)
+ Array("index2", index2).dump(fp)
# --------------------------------------------------------------------
# the following support code is taken from the unidb utilities