Commit Graph

69 Commits

Author SHA1 Message Date
Lumir Balhar d479bad319 Update of bundled compileall2 module to 0.7.1 (bugfix release) 2020-03-31 14:27:06 +02:00
Miro Hrončok 28ed6130e0 Add the compileall2 module (0.7.0) to be used in various Python spec files
No macros here use it, but since we updated python38, python39 to use it,
we need the module if we don't want to diverge the branches of python3Y needlessly.
2020-02-11 00:07:10 +01:00
Miro Hrončok 5c8a587f3f Define %py(2|3)?_shbang_opts_nodash to be used with pathfix.py -a 2020-02-07 18:09:20 +01:00
Miro Hrončok 597d364874 Add the %pycached macro
Usage:

  %files
  ...
  %pycached %{python3_sitelib}/foo.py

This will list:

  /usr/lib/python3.8/site-packages/foo.py
  /usr/lib/python3.8/site-packages/__pycache__/foo.cpython-38{,.opt-?}.pyc

Assuming the Python 3 version is 3.8.
The bytecode files are globbed, their presence is not checked.

This will fail:

  %pycached %{python3_sitelib}/foo

error: %pycached can only be used with paths explicitly ending with .py

And so will any of this:

  %pycached %{python3_sitelib}/*
  %pycached %{python3_sitelib}/foo.*
  %pycached %{python3_sitelib}/foo.p?
  %pycached %{python3_sitelib}/foo.?y
  %pycached %{python3_sitelib}/foo.??

But this will work:

  %pycached %{python3_sitelib}/foo*.py

And it will generate the following globs:

  /usr/lib/python3.8/site-packages/foo*.py
  /usr/lib/python3.8/site-packages/__pycache__/foo*.cpython-38{,.opt-?}.pyc

When used with paths that include Python 3 version, it globs with the version:

  %pycached /opt/python3.10/foo.py

Generates:

  /opt/python3.10/foo.py
  /opt/python3.10/__pycache__/foo.cpython-310{,.opt-?}.pyc

While paths without version have less strict globs:

  %pycached /custom/foo.py
  /custom/foo.py
  /custom/__pycache__/foo.cpython-3*{,.opt-?}.pyc

This will generate a warning in RPM build:

warning: File listed twice: /custom/__pycache__/foo.cpython-38.opt-1.pyc

However it ensures the optimized bytecode is there.
2019-12-28 19:22:58 +01:00
Miro Hrončok 4559c0e65f Define %python, but make it work only if %__python is redefined 2019-12-28 19:22:54 +01:00
Miro Hrončok 936fd1dd8c Define %python2 and %python3
See https://pagure.io/packaging-committee/issue/907

Redefine %__pythonX to change the behavior of %pythonX, %pythonX_version, etc.
Use %pythonX in spec.
2019-09-30 14:28:03 +02:00
Fedora Release Engineering 813a86fcc6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-02 09:09:45 +00:00
Igor Gnatenko 9b8fac037d
Add %python_disable_dependency_generator
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-12-20 14:35:02 +01:00
Miro Hrončok 4b3c23b233 Workaround leaking buildroot PATH in %py_byte_compile (#1647212) 2018-12-14 10:20:40 +01:00
Petr Viktorin c8932dcbef Move "sleep 1" workaround from py3_build to py2_build
https://bugzilla.redhat.com/show_bug.cgi?id=1644923
2018-11-01 11:06:22 +01:00
Tomas Orsava beaa2eec4f Move the __python2/3 macros to the python-srpm-macros subpackage
This facilitates using the %%{__python2/3} in Build/Requires
2018-09-20 13:36:47 +02: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
Miro Hrončok 25b297c006 Bump for 90b0bf7 2018-08-15 11:56:37 +02:00
Pavel Raiskup 90b0bf7480 macros.python: drop last %__python2 occurrence
This is needed so people can do things like:

    %if %{with python3}
    %global __python %__python3
    %else
    %global __python %__python2
    %else

And than just use %__python, %py_build, %py_install,
%python_sitelib, ...
2018-08-03 17:08:55 +02:00
Igor Gnatenko d3d040818d
Change way how enabling-depgen works internally
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-07-28 14:26:10 +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
Fedora Release Engineering 967bb3c12e - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-14 01:58:10 +00: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 1ea9947b6f Add %python3_platform useful for PYTHONPATH on arched builds
This is mostly used when building Sphinx docs on arched build.

Previously:

  PLATFORM=$(python3 -c "import sysconfig; print(sysconfig.get_platform())")
  export PYTHONPATH=../build/lib.${PLATFORM}-%{python3_version}
  make man

Or:

  PYTHONPATH=`realpath ../build/lib.linux*` make

Or:

  PYTHONPATH=$(echo $PWD/build/lib.linux-*) make html

Now:

  PYTHONPATH=../build/lib.%{python3_platform}-%{python3_version}
2018-07-03 14:21:49 +02:00
Jason Tibbitts 37a004eed8 Add %pypi_source macro.
Adds the %pypi_source macro, as well as %__pypi_url and
%__pypi_default_extension.  This should make references to sources in
PyPI much simpler for nearly all Python packages.
2018-06-18 12:54:12 -05:00
Miro Hrončok 3c79d6a899 Move macros.pybytecompile from python3-devel
- https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation
 - No conflicts need to be added the file is renamed
 - If both files are present, there is no harm, so we'll just remove it from 3.7
2018-04-18 18:36:19 +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
Miro Hrončok 438faf7c86 Fix the py_byte_compile macro to work on Python 2
See https://bugzilla.redhat.com/show_bug.cgi?id=1484993

Inspired by Terje Røsten's workaround from that bugzilla
2018-04-10 11:58:45 +02:00
Tomas Orsava 2e3d372310 Fix syntax error in %py_byte_compile macro (rhbz#1433569) 2018-04-10 11:58:45 +02:00
Charalampos Stratakis 5208f057c1 Update macros.pybytecompile to 3.6
Rename the macros.pybytecompile3.5 file to macros.pybytecompile3.6
2018-04-10 11:58:45 +02:00
Charalampos Stratakis 3af7df6454 Update %py_byte_compile macro 2018-04-10 11:58:45 +02:00
Robert Kuska 99ca83f054 Rename macros to 3.5 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
Tomas Orsava 6cc8000e14 Fix the %py_dist_name macro
..to not convert dots (".") into dashes, so that submodules can be
addressed as well

Resolves: rhbz#1564095
2018-04-06 11:48:08 +02:00
Jan Pokorný 4904408b2f macros.python*: make LDFLAGS propagated whenever CFLAGS are
This is to ensure the right linker flags get propagated into binaries
accompanying python packages whenever distutils (or similar, env.
variables provided build flags aware) module is delegated to build them
(e.g. https://bugzilla.redhat.com/show_bug.cgi?id=1541106).  Instead of
using "%{__global_ldflags}" as the seed for the respective env. variable
one-off application, which would be a direct parallel to "%{optflags}"
seeding CFLAGS, use rather "${RPM_LD_FLAGS}" and "${RPM_OPT_FLAGS}",
as these are not directly bound to macros out of rpm proper (like
it would have been, e.g., on redhat-rpm-config package otherwise).

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2018-03-23 13:33:48 +01:00
Fedora Release Engineering 9f912209e5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-09 10:39:49 +00:00
Igor Gnatenko ec476c84cc
add macros to enable dependency generator
References: https://fedoraproject.org/wiki/Changes/EnablingPythonGenerators
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-19 15:52:58 +01:00
Tomas Orsava 69b720ea4f Revert "Add platform-python macros"
This reverts commit cb52c18aa9.
2017-11-28 11:51:43 +01:00
Ville Skyttä 8d3d1dde64 macros.python*: Use -Es/-I to invoke macro scriptlets
To avoid environment and user dir influence.

https://bugzilla.redhat.com/show_bug.cgi?id=1506355
2017-10-26 13:31:35 +03:00
Iryna Shcherbina cb52c18aa9 Add platform-python macros 2017-08-14 14:54:13 +02:00
Fedora Release Engineering b58450b1f3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-27 11:44:18 +00:00
Michal Cyprian a59818afd0 Revert "Switch %%__python3 to /usr/libexec/system-python"
- The Fedora Change https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
  was postponed
- This reverts commit d019d2fd4d
2017-03-03 13:52:35 +01:00
Michal Cyprian d019d2fd4d Switch %%__python3 to /usr/libexec/system-python 2017-02-20 13:41:26 +01:00
Fedora Release Engineering 063c3984a9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-11 10:23:28 +00:00
Michal Cyprian d0fdb0d759 Add --no-deps option to py_install_wheel macros 2017-01-23 18:52:17 +01:00
Tomas Orsava 123ad4b49f Added macros for Build/Requires tags using Python dist tags
https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
2017-01-17 10:28:13 +01:00
Orion Poplawski 516c55eed7 Fix typo in changelog 2016-11-24 07:59:27 -07:00
Orion Poplawski 5ca1f525e5 Make expaned macros start on the same line as the macro 2016-11-24 07:53:47 -07:00
Orion Poplawski a73eb24716 Fix %py3_install_wheel (bug #1395953) 2016-11-16 21:32:46 -07:00
Orion Poplawski e7af332922 Add missing sleeps to other build macros
- Fix build_egg macros
- Add %py_build_wheel and %py_install_wheel macros
2016-11-16 16:28:31 -07:00
Orion Poplawski bad56e0efe Bump release and add %changelog entry 2016-11-15 16:26:40 -07:00
Orion Poplawski f798c43354 Add %py_build_egg and %py_install_egg macros 2016-11-15 16:23:27 -07:00
Orion Poplawski 6ce524f21d Allow multiple args to %py_build/install macros 2016-11-15 16:18:39 -07:00
Orion Poplawski 29e6636ccd Tidy up macro formatting 2016-11-15 16:16:16 -07:00