compilation

Moshe Zadka moshez at math.huji.ac.il
Wed Jun 28 02:44:09 EDT 2000


On Tue, 27 Jun 2000, Oleg Broytmann wrote:

> #! /bin/sh
> 
> if [ -z "$1" ]; then
>    echo "Usage: compyle file.py..."
>    exit 1
> fi
> 
> TEMPLATE="from py_compile import compile; compile('"
> 
> for file in $*; do
>    pgm=$TEMPLATE$file"')"
>    python -c   "$pgm" || exit 1
>    python -OOc "$pgm" || exit 1
> done


#!/usr/local/bin/python
import sys, py_compile

for file in sys.argv[1:]
	py_compile.compile(file)

It's a bit shorter <wink>
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list