Commit Graph

38 Commits

Author SHA1 Message Date
Tomáš Hrnčiar b8b5cb92da Python 3.11
https://fedoraproject.org/wiki/Changes/Python3.11
2022-06-13 11:23:37 +02:00
Tomas Orsava e250f28d09 %py_provides: Do not generate Obsoletes for names containing parentheses
This mechanism is already implemented in the old %python_provide macro.
2022-02-08 12:39:49 +01:00
Tomas Orsava 5d7727c2aa Add lua helper functions to make it possible to automatically generate Obsoletes tags 2022-01-20 18:57:25 +01:00
Miro Hrončok a8b26546eb Set %__python3 value according to %python3_pkgversion
I.e. when %python3_pkgversion is 3.12, %__python3 is /usr/bin/python3.12

We assume that when packagers pacakge for Python 3.X, they want to change both
%python3_pkgversion and %__python3 value.

Hence instead of copy-pasting this:

    %global python3_pkgversion 3.X
    %global __python3 /usr/bin/python3.X

They just need to do:

    %global python3_pkgversion 3.X

Packagers who want to change the value of %__python3 without touching
%python3_pkgversion can still do it:

    %global __python3 /usr/bin/pypy3

Related to https://bugzilla.redhat.com/1821489
2021-12-08 15:35:51 +01:00
Miro Hrončok b55e6151bd Move %python3_pkgversion definition earlier in the file
So we can use it later in %__python3 and maintain readability.
2021-12-08 14:37:09 +01:00
Tomas Orsava 9b797df44d Define a new macros %python_wheel_dir and %python_wheel_pkg_prefix 2021-10-20 16:40:57 +02:00
Miro Hrončok fd3dc4c5dc Move Python related BuildRoot Policy scripts from redhat-rpm-config to python-srpm-macros
This allows us to maintain our own BuildRoot Policy scripts in an easier way.

This change needs to be coordinated with the removal of the files from redhat-rpm-config.

redhat-rpm-config requires python-srpm-macros, so no change is expected for the packagers.
2021-07-08 12:58:05 +02:00
Miro Hrončok bc2b51d6d3 Include brp-python-hardlink in python-srpm-macros since it is no longer in RPM 4.17+
See def9a339d2
2021-06-30 18:13:53 +02:00
Miro Hrončok 3a654e3bed Python 3.10
https://fedoraproject.org/wiki/Changes/Python3.10
2021-06-01 15:58:40 +02:00
Miro Hrončok 2b43f896af Update %python3_pkgversion comment 2021-04-27 16:04:58 +02:00
Miro Hrončok 14e4c04a42 Remove EPEL 7 compatibility macros that were actually not defined at all
The %{? in the comment made the entire block of macros not work.

Since nobody actually used those on Fedora, because they did not exist,
we can safely remove them. No need to document this in the %changelog.
2021-04-27 15:49:21 +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
Miro Hrončok a44ae31ad0 Allow commas as argument separator for extras names in %python_extras_subpkg
This allows e.g.:

    %global extras cli,ghostwriter,pytz,dateutil,lark,numpy,pandas,pytest,redis,zoneinfo,django
    %{pyproject_extras_subpkg -n python3-hypothesis %{extras}}
    ...
    %pyproject_buildrequires -x %{extras}

(Note that %pyproject_extras_subpkg is a tiny wrapper around %python_extras_subpkg.)
2021-04-07 12:48:38 +02:00
Lumir Balhar bc016cbbc5 Make extras_subpkg description more general
Because extra subpackages actually might contain code.
See for example: https://src.fedoraproject.org/rpms/python-dns/pull-request/9
2021-03-16 13:05:31 +01:00
Miro Hrončok a6382f5b5a Fix %python_extras_subpkg with underscores in extras names
Fixes https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/FI6J7JNKIOYGBYIN5UJVWYG24UIIES2U/
2021-02-20 12:52:02 +01:00
Miro Hrončok c746b25f28 Automatically word-wrap the description of extras subpackages
This only works for package and extra names less than 79 characters long.
I don't expect many actual packages to exceed this limit.
78 characters should be enough for everybody.

Why 78? 79 is the line-lenght limit from rpmlint.
And we need to put punctuation in there.
2021-02-08 12:04:29 +01:00
Lumir Balhar 638f809f4c Make %py3_dist respect %python3_pkgversion
By default, %{py3_dist foo} generates python3dist(foo).
This change makes it respect %python3_pkgversion so when
it is redefined as X.Y, %{py3_dist foo} generates pythonX.Y(foo).
2020-07-21 13:42:58 +02:00
Miro Hrončok 69b1b30d53 Make the unversioned %__python macro error
See https://fedoraproject.org/wiki/Changes/PythonMacroError

While doing it, make %python macros more consistent with %python3 macros,
mostly wrt whitespace but also to use python -m pip over plain pip etc.

One significant change is the removal of sleeps from python macros,
this could affect packages that use python macros to build for Python 2
while also using python3 macros to build for Python 3.
In reality, I consider that unlikely. The sleep in python2 macros stays.

The --strip-file-prefix option was already removed from %pyX_install_wheel
but we forgot to remove it from %py_install_wheel.
2020-07-16 18:45:25 +02:00
Miro Hrončok 59abe832d4 Adapt %%py_dist_name to keep square brackets
So %{py3_dist foo[bar]} works as expected.

Add tests.
2020-07-10 15:58:00 +02:00
Miro Hrončok 763d24cc5c Add %python_extras_subpkg
See https://fedoraproject.org/wiki/Changes/PythonExtras
2020-07-09 00:49:15 +02:00
Miro Hrončok 5919708f6c https://fedoraproject.org/wiki/Changes/Python3.9
Also switch to PEP 503 based %py_dist_name (see rhbz#1791530)
2020-05-21 17:39:01 +02:00
Miro Hrončok 4569c61d8d Strip tildes from %version in %pypi_source by default, add tests 2020-05-12 11:05:30 +02:00
Miro Hrončok 5f3e4d6300 Change %__default_python3_pkgversion from 38 to 3.8
See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/message/VIUS7WMQMDX6H2WEIH7TVTMBB6SUHY7E/
2020-05-07 21:47:38 +02:00
Miro Hrončok 5fe974759a Make %py_provides work repeatedly 2020-05-05 13:54:28 +02:00
Miro Hrončok 8fea79b1ec Implement %py_provides 2020-05-05 13:54:26 +02:00
Miro Hrončok 1b3e731dc6 Brand as "3.8", rework %python_provide
- Hardcode the default Python 3 version in the SRPM macros
- Provide python38-foo for python3-foo and the other way around (future RHEL compatibility)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1812087

    $ rpm --eval '%python_provide python38-setuptools'
    Provides: python-setuptools = %{version}-%{release}
    Provides: python3-setuptools = %{version}-%{release}
    Obsoletes: python-setuptools < %{version}-%{release}

    $ rpm --eval '%python_provide python3-setuptools'
    Provides: python-setuptools = %{version}-%{release}
    Provides: python38-setuptools = %{version}-%{release}
    Obsoletes: python-setuptools < %{version}-%{release}

    $ rpm --eval '%python_provide python39-setuptools'

    $ rpm --define 'python3_pkgversion 39' --eval '%python_provide python%{python3_pkgversion}-setuptools'

To make the implementation of %python_provide easier,
any names starting with "python" or "pypy" are recognized as valid arguments.

Previously, this was an ERROR:

    $ rpm --eval '%python_provide pythonista'
    %python_provide: ERROR: pythonista not recognized.

Now it is a no-op. The behavior was never documented and the change is
backwards compatible for working spec files.
2020-03-25 17:27:06 +01:00
Miro Hrončok f0be0a2983 Define %python, but make it work only if %__python is redefined 2019-12-28 19:10:09 +01:00
Miro Hrončok af35bb0ac9 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-27 10:02:49 +02:00
Miro Hrončok cf8051e7f5 Make %__python /usr/bin/python once again until we are ready
See https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/22#comment-26552
and further.
2019-06-17 16:29:44 +02:00
Miro Hrončok 536b2efe4e Move %__python definition to the srpm macros, so it is always present 2019-06-12 11:34:53 +02: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
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
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
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 49ccad99b2 Revert "Move srpm macros to macros.0python-srpm to be defined before other macros"
This reverts commit 1a6f8f12f8.
2016-01-14 20:49:29 -07:00
Orion Poplawski 1a6f8f12f8 Move srpm macros to macros.0python-srpm to be defined before other macros 2016-01-14 20:40:15 -07:00
Orion Poplawski cbf9c3d9a6 Move py3_other macros to srpm-macros 2016-01-14 15:32:18 -07:00
Orion Poplawski ec28c775cd Initial import 2016-01-12 16:52:28 -07:00