From f4c098cc85417fdfc39476d0b8fda6981ac3c265 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 10 Jan 2018 09:52:18 +0200 Subject: 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 --- lang/python/python-package-install.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lang/python/python-package-install.sh') diff --git a/lang/python/python-package-install.sh b/lang/python/python-package-install.sh index 60c1e273c..d5a50322f 100644 --- a/lang/python/python-package-install.sh +++ b/lang/python/python-package-install.sh @@ -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 } -- cgit