"py_compile" — Python ソースファイルのコンパイル
************************************************

**ソースコード:** Lib/py_compile.py

======================================================================

"py_compile" モジュールには、ソースファイルからバイトコードファイルを
作る関数と、モジュールのソースファイルがスクリプトとして呼び出される時
に使用される関数が定義されています。

頻繁に必要となるわけではありませんが、共有ライブラリとしてモジュールを
インストールする場合や、特にソースコードのあるディレクトリにバイトコー
ドのキャッシュファイルを書き込む権限がないユーザがいるときには、この関
数は役に立ちます。

exception py_compile.PyCompileError

   ファイルをコンパイル中にエラーが発生すると送出される例外。

py_compile.compile(file[, cfile[, dfile[, doraise]]])

   Compile a source file to byte-code and write out the byte-code
   cache  file.  The source code is loaded from the file named *file*.
   The  byte-code is written to *cfile*, which defaults to *file* "+"
   "'c'" ("'o'" if optimization is enabled in the current
   interpreter).  If *dfile* is specified, it is used as the name of
   the source file in error messages instead of *file*.  If *doraise*
   is true, a "PyCompileError" is raised when an error is encountered
   while compiling *file*. If *doraise* is false (the default), an
   error string is written to "sys.stderr", but no exception is
   raised.

py_compile.main([args])

   Compile several source files.  The files named in *args* (or on the
   command line, if *args* is not specified) are compiled and the
   resulting bytecode is cached in the normal manner.  This function
   does not search a directory structure to locate source files; it
   only compiles files named explicitly. If "'-'" is the only
   parameter in args, the list of files is taken from standard input.

   バージョン 2.7 で変更: "'-'" のサポートが追加されました。

このモジュールがスクリプトとして実行されると、 "main()" がコマンドライ
ンで指定されたファイルを全てコンパイルします。一つでもコンパイルできな
いファイルがあると終了ステータスが 0 でない値になります。

バージョン 2.6 で変更: Added the nonzero exit status when module is
run as a script.

参考:

  "compileall" モジュール
     ディレクトリツリー内の Python ソースファイルを全てコンパイルする
     ライブラリ。
