From: Oleg Broytman Date: Fri, 31 Jan 2014 11:09:38 +0000 (+0400) Subject: Use compileall.py X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=251fbf7a8041156345cd9bdc4ddb382b7fd93b9f;p=dotfiles.git Use compileall.py --- diff --git a/bin/compyle b/bin/compyle index 260788a..4050467 100755 --- a/bin/compyle +++ b/bin/compyle @@ -1,17 +1,9 @@ #! /bin/sh if [ -z "$1" ]; then - echo "Usage: compyle [-1] file.py..." + echo "Usage: compyle file.py..." >&2 exit 1 fi -TEMPLATE="from py_compile import compile; compile('" - -for file in "$@"; do - pgm=$TEMPLATE$file"')" - python"$PY_VER" -c "$pgm" || exit 1 - python"$PY_VER" -OOc "$pgm" || exit 1 -done - -#pgm="$HOME/lib/python/com.py" -#python"$PY_VER" $pgm "$@" && python"$PY_VER" -O $pgm "$@" + python$PY_VER -m compileall "$@" && +exec python$PY_VER -O -m compileall "$@" diff --git a/bin/compyleall b/bin/compyleall index 8ba7cb5..f78f33d 100755 --- a/bin/compyleall +++ b/bin/compyleall @@ -1,12 +1,3 @@ #! /bin/sh - -umask 022 - -if [ -z "$PY_VER" ]; then - PY_VER="`python -c 'import sys; print sys.version[:3]'`" -fi - -PY_PREFIX="`python$PY_VER -c 'import sys; print sys.prefix'`" - -python$PY_VER $PY_PREFIX/lib/python$PY_VER/compileall.py . -python$PY_VER -O $PY_PREFIX/lib/python$PY_VER/compileall.py . + python$PY_VER -m compileall . && +exec python$PY_VER -O -m compileall .