04-create-xbps-medatada-scripts.sh: autogenerate pycompile_modules

This commit is contained in:
Piotr Wójcik 2019-12-02 20:40:19 +01:00 committed by Piotr
parent 94c2318423
commit 0139bdb524
2 changed files with 7 additions and 3 deletions

View file

@ -1443,9 +1443,10 @@ for example python3.4, those must also be added as host and target build depende
The following variables may influence how the python packages are built and configured The following variables may influence how the python packages are built and configured
at post-install time: at post-install time:
- `pycompile_module`: this variable expects the python modules that should be `byte-compiled` - `pycompile_module`: By default, files and directories installed into
at post-install time. Python modules are those that are installed into the `site-packages` `usr/lib/pythonX.X/site-packages`, excluding `*-info` and `*.so`, are byte-compiled
prefix: `usr/lib/pythonX.X/site-packages`. Multiple python modules may be specified separated at install time as python modules. This variable expects subset of them that
should be byte-compiled, if default is wrong. Multiple python modules may be specified separated
by blanks, Example: `pycompile_module="foo blah"`. If a python module installs a file into by blanks, Example: `pycompile_module="foo blah"`. If a python module installs a file into
`site-packages` rather than a directory, use the name of the file, Example: `site-packages` rather than a directory, use the name of the file, Example:
`pycompile_module="fnord.py"`. `pycompile_module="fnord.py"`.

View file

@ -260,6 +260,9 @@ _EOF
# #
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
pycompile_version="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')" pycompile_version="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')"
if [ -z "${pycompile_module}" ]; then
pycompile_module="$(find ${PKGDESTDIR}/usr/lib/python*/site-packages -mindepth 1 -maxdepth 1 '!' -name '*.egg-info' '!' -name '*.dist-info' '!' -name '*.so' '!' -name '*.pth' -printf '%f ')"
fi
fi fi
if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then