Allow to pass the %%py_import_check if no modules are detected

Add option '-M' to %%py_import_check
- if there are no arguments to the macro and -M option is set, the check
  will pass
- if there are arguments to the macro and they evaluate to the empty
  list of modules, and the -M option is set, the check will pass
This is only allowed to use in fully automated environment and cannot be
accepted in Fedora's official packages.
This commit is contained in:
Karolina Surma 2023-09-01 15:23:11 +02:00
commit 4e63af0532
6 changed files with 34 additions and 4 deletions

View file

@ -71,10 +71,11 @@
# Respect the custom values of %%py_shebang_flags or set nothing if it's undefined.
# Filter and check import on only top-level modules using -t flag.
# Exclude unwanted modules by passing their globs to -e option.
# Use -M flag in automated environments to pass the check even if no modules are detected.
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators if providing list directly.
# Use newlines as separators if providing list in a file.
%py_check_import(e:tf:) %{expand:\\\
%py_check_import(e:tf:M) %{expand:\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
_PYTHONSITE="%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}"\\\