2010年9月5日星期日

Linux下python编译pyc

compile_pyc(){
cecho 'Compile *.py to *.pyc($1)...' blue
if [ -z '$1' -o '$1' = '/' -o ! -d '$1' ];then
cecho 'compile_pyc Error: DIR $1 is empty or /.' red
return 1;
fi
python -c 'import compileall;compileall.compile_dir('${1}')' |grep '^Compiling'|wc -l
}

#end compile_pyc

没有评论:

发表评论