python,python3: merge package install scripts

The only difference just a parameter for Python3
[ -b to compile bytecodes in legacy mode ].
No need to keep 2 almost identical files now
that they're exported.

I'm a bit scared of that param, since it may get
removed at some point.
But let's see until then.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
Alexandru Ardelean
2018-01-10 09:52:18 +02:00
parent 57987b699b
commit f4c098cc85
4 changed files with 12 additions and 90 deletions

View File

@@ -35,11 +35,12 @@ process_filespec() {
)
}
src_dir="$1"
dst_dir="$2"
python="$3"
mode="$4"
filespec="$5"
ver="$1"
src_dir="$2"
dst_dir="$3"
python="$4"
mode="$5"
filespec="$6"
process_filespec "$src_dir" "$dst_dir" "$filespec" || {
echo "process filespec error-ed"
@@ -58,13 +59,16 @@ if [ "$mode" == "sources" ] ; then
exit 0
fi
legacy=
[ "$ver" == "3" ] && legacy="-b"
# XXX [So that you won't goof as I did]
# Note: Yes, I tried to use the -O & -OO flags here.
# However the generated byte-codes were not portable.
# So, we just stuck to un-optimized byte-codes,
# which is still way better/faster than running
# Python sources all the time.
$python -m compileall -d '/' $dst_dir || {
$python -m compileall $legacy -d '/' $dst_dir || {
echo "python -m compileall err-ed"
exit 1
}