~ubuntu-branches/ubuntu/raring/wxwidgets2.8/raring

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/extern/pygments/cmdline.py

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
    Command line interface.
7
7
 
8
 
    :copyright: 2006-2008 by Georg Brandl.
9
 
    :license: BSD, see LICENSE for more details.
 
8
    :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
 
9
    :license: BSD, see LICENSE for details.
10
10
"""
11
11
import sys
12
12
import getopt
13
13
from textwrap import dedent
14
14
 
15
 
from pygments import __version__, __author__, highlight
 
15
from pygments import __version__, highlight
16
16
from pygments.util import ClassNotFound, OptionError, docstring_headline
17
17
from pygments.lexers import get_all_lexers, get_lexer_by_name, get_lexer_for_filename, \
18
18
     find_lexer_class, guess_lexer, TextLexer
219
219
        return 0
220
220
 
221
221
    if opts.pop('-V', None) is not None:
222
 
        print 'Pygments version %s, (c) 2006-2008 by %s.' % (__version__, __author__)
 
222
        print 'Pygments version %s, (c) 2006-2008 by Georg Brandl.' % __version__
223
223
        return 0
224
224
 
225
225
    # handle ``pygmentize -L``
359
359
 
360
360
        infn = args[0]
361
361
        try:
362
 
            code = open(infn).read()
 
362
            code = open(infn, 'rb').read()
363
363
        except Exception, err:
364
364
            print >>sys.stderr, 'Error: cannot read infile:', err
365
365
            return 1
366
366
 
367
367
        if not lexer:
368
368
            try:
369
 
                lexer = get_lexer_for_filename(infn, **parsed_opts)
 
369
                lexer = get_lexer_for_filename(infn, code, **parsed_opts)
370
370
            except ClassNotFound, err:
371
371
                if '-g' in opts:
372
372
                    try:
402
402
            # encoding pass-through
403
403
            fmter.encoding = 'latin1'
404
404
        else:
405
 
            # use terminal encoding
406
 
            lexer.encoding = getattr(sys.stdin, 'encoding', None) or 'ascii'
407
 
            fmter.encoding = getattr(sys.stdout, 'encoding', None) or 'ascii'
 
405
            if sys.version_info < (3,):
 
406
                # use terminal encoding; Python 3's terminals already do that
 
407
                lexer.encoding = getattr(sys.stdin, 'encoding',
 
408
                                         None) or 'ascii'
 
409
                fmter.encoding = getattr(sys.stdout, 'encoding',
 
410
                                         None) or 'ascii'
408
411
 
409
412
    # ... and do it!
410
413
    try: