Miro Hrončok
10e0e5309d
Don't assume %_smp_mflags only ever contains -jX, use -j%_smp_build_ncpus directly
...
When we added %_smp_mflags here, Petr Viktorin asked the question:
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/154#comment-124613
> I couldn't find docs for %_smp_mflags.
> How much of a guarantee is there that it contains no other flags than -j?
My answer was:
> %_smp_mflags is documented in https://rpm-packaging-guide.github.io/
> and used in many other RPM macros in Fedora and upstream everywhere.
> There is no official guarantee that it will never contain anything else,
> but if it does, I assume multiple things would burn.
> I am willing to take that risk.
Turns out, the world did not burn, but packagers do set %_smp_mflags to -lX,
which does not work with compileall.
Fixes https://bugzilla.redhat.com/2179149
2023-03-16 19:45:39 +01:00
Miro Hrončok
a3ea23bd5e
Bytecompilation: Compile Python files in parallel, according to %_smp_mflags
2022-12-21 12:18:48 +01:00
Miro Hrončok
77912c744d
Add a script to clamp source mtimes, invoke it from the bytecompilation BRP/macro
...
https://fedoraproject.org/wiki/Changes/ReproducibleBuildsClampMtimes
2022-12-21 12:18:48 +01:00
Miro Hrončok
e4baf5ab7e
Bytecompilation: Pass --invalidation-mode=timestamp to compileall
...
(Only on Python 3.7+, where it exists and matters.)
This will replace patch 328 in Python and fix https://bugzilla.redhat.com/2133850
2022-12-19 14:27:49 +01:00
Miro Hrončok
eb7a4fda28
Bytecompilation: Unset $SOURCE_DATE_EPOCH when %clamp_mtime_to_source_date_epoch is not set
...
https://fedoraproject.org/wiki/Changes/ReproducibleBuildsClampMtimes#Python_bytecode
2022-12-19 14:25:52 +01:00
Miro Hrončok
cfa45dfdf3
Add a note: Python 3.11+ no longer needs PYTHONHASHSEED=0
...
Implemented in: https://github.com/python/cpython/pull/27926
We keep using it thou, because this is Python version agnostic.
Once we drop support for anything older than 3.11, we can remove it.
That'll be around ~2030. Assuming the world still exists by then.
2022-05-12 11:43:00 +02:00
Petr Viktorin
dd8caa5aa3
Use --hardlink-dupes for Python 3.4+ as well
2021-09-10 16:14:28 +02:00
Petr Viktorin
37bf640f37
Use --hardlink-dupes in %py_byte_compile and brp-python-bytecompile
...
(for Python 3.9+)
Resolves: rhbz#1977895
2021-09-10 10:50:01 +02:00
Miro Hrončok
03a1e3ba65
Escape % symbols in macro files comments
...
This is most likely not neccessary but can prevent serious problems like:
https://bugzilla.redhat.com/show_bug.cgi?id=1953910
2021-04-27 12:36:11 +02:00
Lumir Balhar
0eae1d90da
Disable Python hash seed randomization in %py_byte_compile
...
This change should help with byte-compilation reproducibility: https://bugzilla.redhat.com/show_bug.cgi?id=1686078
2020-07-24 07:35:07 +02:00
Lumir Balhar
3a211cc91b
Use compileall from stdlib for Python >= 3.9
2020-06-16 13:57:38 +02:00
Lumir Balhar
eb3274394c
Do not allow passing arguments to Python during byte-compilation
2019-07-15 14:26:49 +02:00
Lumir Balhar
4493789fb8
Use -s
to not add user site directory to sys.path for byte-compilation
2019-07-15 14:26:49 +02:00
Lumir Balhar
76681ad58e
Use a new module compileall2 for Python byte-compilation
2019-07-15 14:26:49 +02:00
Miro Hrončok
4b3c23b233
Workaround leaking buildroot PATH in %py_byte_compile ( #1647212 )
2018-12-14 10:20:40 +01:00
Miro Hrončok
8f067ff385
Make %py_byte_compile terminate build on SyntaxErrors ( #1616219 )
...
Also, make it simpler again
2018-08-22 11:48:27 +02:00
Tomas Orsava
05333eb586
macros.pybytecompile: Detect Python version through sys.version_info
...
...instead of guessing from the executable name.
This should make it work on EPEL7 as well where we ship 3.4 and 3.6
https://bugzilla.redhat.com/show_bug.cgi?id=1599809
2018-07-19 11:52:36 +02:00
Tomas Orsava
f961fbbc29
Fix %%py_byte_compile macro
...
When invoked with a Python 2 binary it also mistakenly ran py3_byte_compile.
2018-07-10 15:14:23 +02:00
Miro Hrončok
21ac2a9653
Make the pybytecompile version agnostic again
...
It is no longer bound to a specific pythonX package
2018-04-10 11:58:45 +02:00
Matej Stuchlik
bcfeb6a0b1
Update macros.pybytecompile to 3.4
2018-04-10 11:58:45 +02:00
dmalcolm
739136717f
Introduce macros.pybytecompile
2018-04-10 11:58:45 +02:00