]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added 'warn' method.
authorGreg Ward <gward@python.net>
Mon, 18 Jan 1999 17:08:16 +0000 (17:08 +0000)
committerGreg Ward <gward@python.net>
Mon, 18 Jan 1999 17:08:16 +0000 (17:08 +0000)
Lib/distutils/text_file.py

index 9fff941ec90d499c78b284b952f141c3e3b0b3d4..9e1a73b79890c532c1984356e56db6a4695e2461 100644 (file)
@@ -9,7 +9,7 @@ lines, and joining lines with backslashes."""
 __revision__ = "$Id$"
 
 from types import *
-import os, string, re
+import sys, os, string, re
 
 
 class TextFile:
@@ -67,6 +67,15 @@ class TextFile:
         self.current_line = None
 
 
+    def warn (self, msg):
+        sys.stderr.write (self.filename + ", ")
+        if type (self.current_line) is ListType:
+            sys.stderr.write ("lines %d-%d: " % tuple (self.current_line))
+        else:
+            sys.stderr.write ("line %d: " % self.current_line)
+        sys.stderr.write (msg + "\n")
+
+
     def readline (self):
 
         buildup_line = ''