Commit Graph

24 Commits

Author SHA1 Message Date
Miro Hrončok 72371929c5 Implement %pyX_shebang_fix
See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/UGCMDDG3S32U7JJK36OEZNHLUVQQRG3M/
2020-05-18 18:58:39 +02:00
Miro Hrončok 0d3f1e6b74 Implement %pytest
See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/XLPDSH362PJKMJCAYOXNJNV53Y66EF6B/
2020-05-11 19:04:28 +02:00
Tomas Hrnciar daf7d32612 remove direct_url.json file and sed it out from RECORD
With PEP 610 there is created new file direct_url.json since is not
useful for us, it will be removed using py3_install_wheel macro.

See: https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012
2020-05-05 09:18:16 +02:00
Miro Hrončok e9f07b72aa Define %py(2|3)?_shbang_opts_nodash to be used with pathfix.py -a 2020-02-06 10:26:04 +01:00
Anna Khaitovich 2314fd928a Remove stray __pycache__ directory from /usr/bin when running %py_install, %py_install_wheel and %py_install_egg macros
Solves bz#1739848
2019-12-28 19:16:16 +01:00
Miro Hrončok 6c63a5b7f4 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:12:37 +01:00
Miro Hrončok f09ccd21f5 Drop --strip-file-prefix option from %pyX_install_wheel macros, it is not needed
A custom pip patch was needed for this option, but the RECORD files are
relative, so no stripping is needed. We will eventually drop the patch.
2019-08-26 15:33:41 +00:00
Miro Hrončok 84ed1ab69d Fix %python3_version macros for Python 3.10
No need to bump the release, 3.10 is far from now.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1745601
2019-08-26 15:24:23 +02: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 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
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
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
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
Michal Cyprian d0fdb0d759 Add --no-deps option to py_install_wheel macros 2017-01-23 18:52:17 +01: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 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
Jason Tibbitts af37c22835 Add single-second sleeps to work around setuptools bug. 2016-05-12 13:28:05 -05:00
Orion Poplawski ec28c775cd Initial import 2016-01-12 16:52:28 -07:00