The unversioned Python RPM macros
Go to file
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
tests Introduce %py3_check_import 2021-07-14 18:42:26 +02:00
.gitignore New branch setup 2020-10-08 23:33:09 +00:00
compileall2.py RHEL 9.0.0 Alpha bootstrap 2020-10-14 20:10:31 -07:00
gating.yaml Add gating.yaml from RHEL 2021-06-02 12:42:49 +02:00
macros.pybytecompile Escape % symbols in macro files comments 2021-05-05 17:18:32 +02:00
macros.python Introduce %py3_check_import 2021-07-14 18:42:26 +02:00
macros.python3 Introduce %py3_check_import 2021-07-14 18:42:26 +02:00
macros.python-srpm Update %python3_pkgversion comment 2021-05-05 17:18:43 +02:00
python-rpm-macros.spec Introduce %py3_check_import 2021-07-14 18:42:26 +02:00
python.lua Update comment for python_altnames() to reflect the reality 2021-04-22 18:25:28 +02:00
sources RHEL 9.0.0 Alpha bootstrap 2020-10-14 20:10:31 -07:00