issue5063: Fixes for building RPM on CentOS plus misc .spec file enhancements.
[python.git] / Lib / compiler / __init__.py
blobd75140aa72235ea85ab8a8d164fd305baa0e429f
1 """Package for parsing and compiling Python source code
3 There are several functions defined at the top level that are imported
4 from modules contained in the package.
6 parse(buf, mode="exec") -> AST
7 Converts a string containing Python source code to an abstract
8 syntax tree (AST). The AST is defined in compiler.ast.
10 parseFile(path) -> AST
11 The same as parse(open(path))
13 walk(ast, visitor, verbose=None)
14 Does a pre-order walk over the ast using the visitor instance.
15 See compiler.visitor for details.
17 compile(source, filename, mode, flags=None, dont_inherit=None)
18 Returns a code object. A replacement for the builtin compile() function.
20 compileFile(filename)
21 Generates a .pyc file by compiling filename.
22 """
23 from warnings import warnpy3k
24 warnpy3k("the compiler package has been removed in Python 3.0", stacklevel=2)
25 del warnpy3k
27 from compiler.transformer import parse, parseFile
28 from compiler.visitor import walk
29 from compiler.pycodegen import compile, compileFile