Go to file
Lumir Balhar 6335a7ff4a Fix brp-python-bytecompile with the new features from compileall2
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.
2019-12-02 16:39:32 +01:00
.gitignore Add .gitignore file. 2016-10-03 17:03:08 -05:00
brp-implant-ident-static add brp-implant-ident-static, which requires mktemp 2003-01-20 20:06:50 +00:00
brp-java-repack-jars Trim trailing whitespace 2014-04-27 11:58:46 +03:00
brp-ldconfig Silence the annoying warning from ldconfig brp-script (#1540971) 2018-12-17 16:16:25 +02:00
brp-mangle-shebangs Make ambiguous python shebangs error 2018-09-10 18:26:02 +02:00
brp-python-bytecompile Fix brp-python-bytecompile with the new features from compileall2 2019-12-02 16:39:32 +01:00
buildflags.md buildflags.md: Fix the packaging guidelines link 2019-01-18 22:38:59 +01:00
common.lua wordwrap: make list indenting smarter, to produce something with enough structure that it can be converted into AppStream metadata 2019-07-08 23:24:08 +02:00
config.guess Update config.guess, config.sub to the latest versions from upstream. 2016-10-13 16:28:32 +01:00
config.sub Update config.guess, config.sub to the latest versions from upstream. 2016-10-13 16:28:32 +01:00
dist.sh fix dist.sh --fc (#223651) 2007-06-19 14:24:12 -04:00
find-provides The attached patch kills a bogus comment in redhat-rpm-config 2014-09-16 09:31:34 +03:00
find-provides.ksyms Fix kernel ABI related scripts 2018-06-04 08:44:43 +02:00
find-requires - Drop most of the script-based dependency generation bits 2014-04-10 15:20:54 +03:00
find-requires.ksyms Fix kernel ABI related scripts 2018-06-04 08:44:43 +02:00
firmware.prov Flatten the directory structure in preparation to merge 2014-04-02 10:42:10 +03:00
forge.lua forge: add pagure driver 2019-04-24 16:48:00 +02:00
gpgverify Added gpgverify. 2019-05-30 19:54:13 +02:00
kmod.attr - Move kmod and libsymlink dependency generators here from rpm 2014-04-15 10:08:30 +03:00
kmod.prov Fix kmod.prov to deal with compressed modules (#1096349) 2014-05-12 15:05:02 -04:00
kmodtool Trim trailing whitespace 2014-04-27 11:58:46 +03:00
libsymlink.attr Use %__libsymlink_path instead of %__libsymlink_exclude_path in libsymlink.attr 2015-07-15 10:39:19 +02:00
macros Move brp-python-bytecompile from rpm, so we can easily adapt it 2019-07-20 08:07:57 +02:00
macros.dwz - require dwz, enable dwarf compression for debuginfo packages (#833311) 2014-01-25 00:11:43 +02:00
macros.fedora-misc Fix the simple API of %gpgverify 2019-11-01 08:04:12 +01:00
macros.fedora-misc-srpm misc: add a wordwrap helper 2019-06-04 08:23:55 +02:00
macros.forge common: add a writevars helper 2018-12-04 17:25:02 +01:00
macros.kmp Make %kernel_module_package actually honor %kmodtool_generate_buildreqs 2017-07-18 14:42:07 +02:00
macros.ldc-srpm Add aarch64 to ldc arches 2018-08-20 22:33:04 +02:00
macros.ldconfig ldconfig: make %ldconfig_post/%ldconfig_postun parameterized 2018-02-25 07:11:46 +01:00
macros.mono-srpm Enable aarch64 for mono arches 2016-10-12 12:44:52 +01:00
macros.nodejs-srpm Add s390x build target for Node.js packages (#1391999) 2016-11-07 15:30:35 +02:00
macros.valgrind-srpm Add valgrind_arches macro for BuildRequires of valgrind (#1334599) 2016-11-07 15:50:01 +02:00
macros.vpath Add macros.vpath from FPC ticket 655 2016-12-15 13:05:41 -06:00
modalias.prov Trim trailing whitespace 2014-04-27 11:58:46 +03:00
redhat-annobin-cc1 Enable binary annotations in compiler flags 2017-11-22 12:41:44 +01:00
redhat-hardened-cc1 Fix cc1 specs mishandling of incremental linking 2015-07-08 13:49:53 -04:00
redhat-hardened-ld Remove -z now from GCC specs file, now on command line (#1548397) 2018-02-24 21:37:06 +01:00
redhat-rpm-config.spec Fix brp-python-bytecompile with the new features from compileall2 2019-12-02 16:39:32 +01:00
rpmlint.cf Add %_configure_disable_silent_rules 2016-10-03 12:55:00 -05:00
rpmrc rpmrc: update optflags for riscv64 2019-07-25 10:12:03 +01:00
rpmsort Update upstream redhat-rpm-config release. 2006-10-12 03:33:42 +00:00
sources - Remember to update lookaside-source status (there aren't any) 2014-04-02 13:21:15 +03:00
STAGE2-redhat-rpm-config Adding STAGE2 bootstrap recipe 2015-11-04 16:43:28 +01:00
symset-table patch from jcm to adjust kmod handling 2007-06-19 15:18:25 +00:00