mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
config/functions: add Python bytecode/source code helper functions
This commit is contained in:
parent
59857855ac
commit
fcfee6ff42
@ -1046,6 +1046,22 @@ source_package() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# arg1: file, or directory to recursively compile.
|
||||||
|
python_compile() {
|
||||||
|
local path="${1:-${INSTALL}/usr/lib/${PKG_PYTHON_VERSION}}"
|
||||||
|
${TOOLCHAIN}/bin/python3 -Wi -t -B ${TOOLCHAIN}/lib/${PKG_PYTHON_VERSION}/compileall.py -f -d "${path#${INSTALL}}" "${path}"
|
||||||
|
python_remove_source "${path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# arg1: file, or directory from which to recursively remove all py source code
|
||||||
|
python_remove_source() {
|
||||||
|
local path="${1:-${INSTALL}/usr/lib/${PKG_PYTHON_VERSION}}"
|
||||||
|
if [ -d "${path}" ]; then
|
||||||
|
find "${path}" -type f -name '*.py' -delete
|
||||||
|
else
|
||||||
|
rm -f "${path}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
### KERNEL HELPERS ###
|
### KERNEL HELPERS ###
|
||||||
kernel_path() {
|
kernel_path() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user