summaryrefslogtreecommitdiff
path: root/lang/python/python-package-install.sh
diff options
context:
space:
mode:
authorAlexandru Ardelean <ardeleanalex@gmail.com>2018-01-10 09:52:18 +0200
committerAlexandru Ardelean <ardeleanalex@gmail.com>2018-01-10 23:06:22 +0200
commitf4c098cc85417fdfc39476d0b8fda6981ac3c265 (patch)
treef767e04b087417cb6728f355e1750f33b0bd42a3 /lang/python/python-package-install.sh
parent57987b699b4a02552f2ff916e797a2e930c63d25 (diff)
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>
Diffstat (limited to 'lang/python/python-package-install.sh')
-rw-r--r--lang/python/python-package-install.sh16
1 files changed, 10 insertions, 6 deletions
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
}