From d8888fe9b15b6afc058917a08f682c5da14a5ebe Mon Sep 17 00:00:00 2001 From: Stuart Rackham Date: Mon, 14 Sep 2009 18:17:53 +1200 Subject: Added program name suffix to console messages. --- a2x.py | 2 ++ asciidoc.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/a2x.py b/a2x.py index c006adf..3776a7c 100755 --- a/a2x.py +++ b/a2x.py @@ -169,6 +169,8 @@ def shell(cmd, raise_error=True): If raise_error is True then a non-zero return terminates the application. ''' if os.name == 'nt': + # TODO: this is probably unnecessary, see: + # http://groups.google.com/group/asciidoc/browse_frm/thread/9442ee0c419f1242 # Windows doesn't like running scripts directly so explicitly # specify python interpreter. # Extract first (quoted or unquoted) argument. diff --git a/asciidoc.py b/asciidoc.py index 5dfb2df..042ad21 100755 --- a/asciidoc.py +++ b/asciidoc.py @@ -144,6 +144,8 @@ class Message: """ Message functions. """ + PROG = os.path.basename(os.path.splitext(__file__)[0]) + def __init__(self): self.linenos = None # Used to globally override line numbers. self.messages = [] @@ -151,7 +153,7 @@ class Message: def stderr(self,line=''): self.messages.append(line) if __name__ == '__main__': - sys.stderr.write(line+os.linesep) + sys.stderr.write('%s: %s%s' % (self.PROG, line, os.linesep)) def verbose(self, msg,linenos=True): if config.verbose: -- cgit v1.2.1