# transforms for the same phase will be used in the order they are given.
def bad_usage():
- print >>sys.stderr, usage
+ sys.stderr.write(usage)
sys.exit(1)
def parse_command_line(args):
elif arg.endswith(".o"):
options.objects.append(arg)
else:
- print >>sys.stderr, \
- "cython: %s: Unknown filename suffix" % arg
+ sys.stderr.write(
+ "cython: %s: Unknown filename suffix\n" % arg)
if options.objects and len(sources) > 1:
- print >>sys.stderr, \
- "cython: Only one source file allowed together with .o files"
+ sys.stderr.write(
+ "cython: Only one source file allowed together with .o files\n")
if options.use_listing_file and len(sources) > 1:
- print >>sys.stderr, \
- "cython: Only one source file allowed when using -o"
+ sys.stderr.write(
+ "cython: Only one source file allowed when using -o\n")
sys.exit(1)
if len(sources) == 0 and not options.show_version:
bad_usage()
import os, sys, re, codecs
if sys.version_info[:2] < (2, 2):
- print >>sys.stderr, "Sorry, Cython requires Python 2.2 or later"
+ sys.stderr.write("Sorry, Cython requires Python 2.2 or later\n")
sys.exit(1)
from time import time
options = default_options
sources = args
if options.show_version:
- print >>sys.stderr, "Cython version %s" % Version.version
+ sys.stderr.write("Cython version %s\n" % Version.version)
context = Context(options.include_path)
for source in sources:
try:
if result.num_errors > 0:
any_failures = 1
except PyrexError, e:
- print >>sys.stderr, e
+ sys.stderr.write(str(e) + '\n')
any_failures = 1
if any_failures:
sys.exit(1)
#
#=======================================================================
-from Regexps import *
+from Regexps import Alt, Seq, Rep, Rep1, Opt, Any, AnyBut, Bol, Eol, Char
from Errors import PlexError
class RegexpSyntaxError(PlexError):
char_list.append(chr(a))
else:
char_list.append(c1)
- chars = string.join(char_list, "")
+ chars = ''.join(char_list)
if invert:
return AnyBut(chars)
else: