xbps-triggers: pycompile: support modules at top-level site-packages dir.
This commit is contained in:
parent
cb60ca1e43
commit
08652c703a
|
@ -14,6 +14,10 @@
|
||||||
#
|
#
|
||||||
# pycompile_module="blah foo"
|
# pycompile_module="blah foo"
|
||||||
#
|
#
|
||||||
|
# Or if a module is stored in top-level site-packages directory:
|
||||||
|
#
|
||||||
|
# pycompile_module="foo.py"
|
||||||
|
#
|
||||||
# Arguments: $ACTION = [run/targets]
|
# Arguments: $ACTION = [run/targets]
|
||||||
# $TARGET = [post-install/pre-remove]
|
# $TARGET = [post-install/pre-remove]
|
||||||
# $PKGNAME
|
# $PKGNAME
|
||||||
|
@ -40,10 +44,17 @@ compile()
|
||||||
done
|
done
|
||||||
for f in ${pycompile_module}; do
|
for f in ${pycompile_module}; do
|
||||||
echo "Byte-compiling python code for module ${f}..."
|
echo "Byte-compiling python code for module ${f}..."
|
||||||
python -m compileall -f -q \
|
if [ -d usr/lib/python${PYVER}/site-packages/${f} ]; then
|
||||||
usr/lib/python${PYVER}/site-packages/${f} && \
|
python -m compileall -f -q \
|
||||||
python -O -m compileall -f -q \
|
usr/lib/python${PYVER}/site-packages/${f} && \
|
||||||
usr/lib/python${PYVER}/site-packages/${f}
|
python -O -m compileall -f -q \
|
||||||
|
usr/lib/python${PYVER}/site-packages/${f}
|
||||||
|
else
|
||||||
|
python -m compileall -f -q \
|
||||||
|
usr/lib/python${PYVER}/site-packages/${f} && \
|
||||||
|
python -O -m compileall -f -q \
|
||||||
|
usr/lib/python${PYVER}/site-packages/${f}
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +66,12 @@ remove()
|
||||||
done
|
done
|
||||||
for f in ${pycompile_module}; do
|
for f in ${pycompile_module}; do
|
||||||
echo "Removing byte-compiled python code for module ${f}..."
|
echo "Removing byte-compiled python code for module ${f}..."
|
||||||
find usr/lib/python${PYVER}/site-packages/${f} \
|
if [ -d usr/lib/python${PYVER}/site-packages/${f} ]; then
|
||||||
-type f -name \*.py[co] -delete 2>&1 >/dev/null
|
find usr/lib/python${PYVER}/site-packages/${f} \
|
||||||
|
-type f -name \*.py[co] -delete 2>&1 >/dev/null
|
||||||
|
else
|
||||||
|
rm -f usr/lib/python${PYVER}/site-packages/${f%.py}.py[co]
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'xbps-triggers'
|
# Template file for 'xbps-triggers'
|
||||||
pkgname=xbps-triggers
|
pkgname=xbps-triggers
|
||||||
version=0.45
|
version=0.46
|
||||||
revision=1
|
revision=1
|
||||||
noarch=yes
|
noarch=yes
|
||||||
noextract=yes
|
noextract=yes
|
||||||
|
|
Loading…
Reference in New Issue