Commit Graph

18 Commits

Author SHA1 Message Date
Miro Hrončok
5cf7712d6f Set $RPM_BUILD_ROOT in %{python3_...} macros, for alternate sysconfig install scheme
Our Pythons currently patches distutils to install packages to
/usr/lib(64)/pythonX.Y/site-packages when the $RPM_BUILD_ROOT environment
variable is set (and to /usr/local/lib(64)/pythonX.Y/site-packages otherwise).
With the deprecation of distutils [1] we want to change the patch to create
and use a different sysconfig install scheme [2].

However, we have realized that macros defined as %(%{__python3} ...) don't
"see" the environment variables set by rpmbuild because they are expanded earlier
and hence e.g. %{python3_sitelib} evaluates to
/usr/local/lib/python3.X/site-packages -- which is not desired.
To be able to reliably detect an RPM build environment by checking
the presence of the $RPM_BUILD_ROOT environment variable,
we manually set it in the macro definitions.

Since %{buildroot} in not fully populated
(e.g. it can expand literally to
/home/anna/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64),
we don't use it here.
The variable simply needs to present in the environment.

See also the analysis of the build failures when this is not done [3].

[1] https://www.python.org/dev/peps/pep-0632/
[2] https://bugs.python.org/issue43976
[3] https://src.fedoraproject.org/rpms/python3.10/pull-request/63#comment-79042

Related: rhbz#1950291
2021-12-14 21:28:24 +01:00
Tomas Orsava
3b86d5797c Define a new macros %python_wheel_dir and %python_wheel_pkg_prefix
Related: rhbz#1982668
2021-11-05 10:47:41 +01:00
Mohan Boddu
76df3dcf3d Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-08-10 00:22:25 +00:00
Miro Hrončok
7d8d1b3283 Introduce %py3_check_import
With $PATH and $PYTHONPATH set to the %buildroot,
the macro tries to import the given Python 3 module(s).
Useful as a smoke test in %check when ruining tests is not feasible.
Accepts spaces or commas as separators.

Package python-six:

    %check
    %py3_check_import six

    Executing(%check): ...
    ...
    + PATH=...
    + PYTHONPATH=...
    + PYTHONDONTWRITEBYTECODE=1
    + /usr/bin/python3 -c 'import six'
    + RPM_EC=0
    ++ jobs -p
    + exit 0

    %py3_check_import six seven

    ...
    + /usr/bin/python3 -c 'import six, seven'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'seven'

    error: Bad exit status from ... (%check)

    ...
    %py3_check_import five, six, seven

    + /usr/bin/python3 -c 'import five, six, seven'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'five'

    error: Bad exit status from ... (%check)

Package python-packaging:

    %py3_check_import packaging, packaging.markers  packaging.requirements, packaging.tags

    Executing(%check): ...
    ...
    + PATH=...
    + PYTHONPATH=...
    + PYTHONDONTWRITEBYTECODE=1
    + /usr/bin/python3 -c 'import packaging, packaging.markers, packaging.requirements, packaging.tags'
    + RPM_EC=0
    ++ jobs -p
    + exit 0

    %py3_check_import packaging, packaging.markers  packaging.notachance, packaging.tags

    ...
    + /usr/bin/python3 -c 'import packaging, packaging.markers, packaging.notachance, packaging.tags'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'packaging.notachance'

    error: Bad exit status from ... (%check)

Related: rhbz#1950291
2021-07-14 18:42:26 +02:00
Miro Hrončok
1232cc253e %pytest: Set $PYTEST_ADDOPTS when %{__pytest_addopts} is defined
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1935212

Related: rhbz#1950291
2021-06-30 16:25:45 +02:00
Miro Hrončok
9235955bb3 Fix %python_provide when fed python3.10-foo to obsolete python-foo instead of python--foo
This has unlikely broken anything in practice,
no packages in Fedora use %python_provide with major.minor-version-prefixed names.

Related: rhbz#1950291
2021-06-30 12:17:29 +02:00
Petr Viktorin
4f73bb9538 Add the project's canonical URL
Related: rhbz#1950291
2021-06-30 12:17:29 +02:00
Miro Hrončok
a272f59825 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

Related: rhbz#1950291
2021-05-05 17:18:32 +02:00
Karolina Surma
20a3073f02 Use sysconfig.get_path() to define %python_sitelib and %python_sitearch
Distutils which were used to define the macros are deprecated in Python3.10:
https://www.python.org/dev/peps/pep-0632/.
Sysconfig isn't and it works across our Pythons, making it better choice for the task.

Related: rhbz#1950291
2021-04-22 18:29:53 +02:00
Miro Hrončok
019f8b973d Escape a macro in an old %changelog entry
Related: rhbz#1950291
2021-04-22 18:28:24 +02:00
Miro Hrončok
ca0a3311c5 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.)

Related: rhbz#1950291
2021-04-22 18:28:04 +02:00
Mohan Boddu
f9564fc7d5 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-04-16 04:44:32 +00:00
DistroBaker
6bf18de563 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-rpm-macros.git#a6382f5b5a6536d01477b71cf5a378c30c828783
2021-03-11 20:31:16 +00:00
Troy Dawson
f73468722f RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-rpm-macros#626168789c73d62eb211ec72fe260a128e66df45
2021-02-10 06:05:59 -08:00
DistroBaker
b18966f2a7 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-rpm-macros.git#230ce7f0613816bd7daf1f615bca443d6c5aa7d5
2021-02-08 11:37:59 +00:00
DistroBaker
0e23a801f0 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-rpm-macros.git#5b5cc39d89ceca9fba82f1c03cf06ea2f4e1f00b
2021-02-05 03:39:24 +01:00
DistroBaker
ede6a5b9bf Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/python-rpm-macros.git#e5429a7a486e470b514aed207457fb237d061598
2020-12-10 15:38:11 +00:00
Troy Dawson
365a69534a RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-rpm-macros#06987f5024e2618f3169ca829462b71f7bbae463
2020-10-14 20:10:31 -07:00