6335a7ff4a
Resolves: rhbz#1595265 The problem this change is intended to solve is with how `real_libdir` is calculated. Let's assume we want to recursively byte-compile all `*.py` files in `/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8`. Then, `real_libdir` is this path without `$RPM_BUILD_ROOT` with the filename at the end which displays in the error message like this: ``` Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8 *** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'... File "/usr/lib/python3.8/bar.py", line 1 import sin from math ^ SyntaxError: invalid syntax ``` `/usr/lib/python3.8/bar.py` is obviously wrong. One of the new features of the `compileall2` module (which will be available in stdlib in Python 3.9) is that the path byte-compiled to `*.pyc` files is calculated for each file. This means that by using `-s` and `-p` we can strip `$RPM_BUILD_ROOT` and prepend `/` for each file individually which will fix the problem. ``` Bytecompiling .py files below /builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8 using /usr/bin/python3.8 *** Error compiling '/builddir/build/BUILDROOT/python-scales-1.0.9-250.fc32.x86_64/usr/lib/python3.8/site-packages/greplin/bar.py'... File "/usr/lib/python3.8/site-packages/greplin/bar.py", line 1 import sin from math ^ SyntaxError: invalid syntax ``` This change has an effect only for Python >= 3.4. |
||
---|---|---|
.gitignore | ||
brp-implant-ident-static | ||
brp-java-repack-jars | ||
brp-ldconfig | ||
brp-mangle-shebangs | ||
brp-python-bytecompile | ||
buildflags.md | ||
common.lua | ||
config.guess | ||
config.sub | ||
dist.sh | ||
find-provides | ||
find-provides.ksyms | ||
find-requires | ||
find-requires.ksyms | ||
firmware.prov | ||
forge.lua | ||
gpgverify | ||
kmod.attr | ||
kmod.prov | ||
kmodtool | ||
libsymlink.attr | ||
macros | ||
macros.dwz | ||
macros.fedora-misc | ||
macros.fedora-misc-srpm | ||
macros.forge | ||
macros.kmp | ||
macros.ldc-srpm | ||
macros.ldconfig | ||
macros.mono-srpm | ||
macros.nodejs-srpm | ||
macros.valgrind-srpm | ||
macros.vpath | ||
modalias.prov | ||
redhat-annobin-cc1 | ||
redhat-hardened-cc1 | ||
redhat-hardened-ld | ||
redhat-rpm-config.spec | ||
rpmlint.cf | ||
rpmrc | ||
rpmsort | ||
sources | ||
STAGE2-redhat-rpm-config | ||
symset-table |