From 63236cf386574484d9f594af4b464c44c579cf25 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 25 May 2007 18:39:29 +0000 Subject: [PATCH] Minimal fixes to save the bootstrap on OSX. --- Lib/distutils/sysconfig.py | 3 ++- Lib/distutils/text_file.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index ea2e0597788..51f23a24a55 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -11,6 +11,7 @@ Email: __revision__ = "$Id$" +import io import os import re import sys @@ -353,7 +354,7 @@ def _init_posix(): # load the installed pyconfig.h: try: filename = get_config_h_filename() - parse_config_h(open(filename), g) + parse_config_h(io.open(filename), g) except IOError as msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index c23a31dd9cd..9d4d42b4c64 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -7,7 +7,7 @@ lines, and joining lines with backslashes.""" __revision__ = "$Id$" from types import * -import sys, os +import sys, os, io class TextFile: @@ -34,7 +34,7 @@ class TextFile: something that provides 'readline()' and 'close()' methods). It is recommended that you supply at least 'filename', so that TextFile can include it in warning messages. If 'file' is not supplied, - TextFile creates its own using the 'open()' builtin. + TextFile creates its own using 'io.open()'. The options are all boolean, and affect the value returned by 'readline()': @@ -118,7 +118,7 @@ class TextFile: 'filename' and 'file' arguments to the constructor.""" self.filename = filename - self.file = open (self.filename, 'r') + self.file = io.open (self.filename, 'r') self.current_line = 0