Add new options for %%py{3}_check_import: -f, -t, -e
-f: optionally read a file with module names to test -t: bool flag - if set, filter only top-level modules -e: optionally exclude module names matching the given glob (Unix shell-style wildcards) Importing all modules may cause bogus failures in some cases, eg. when the imported code assumes there is an existing graphical window. Such behaviour may be by design, hence for automatic processing it's more convinient to - in some cases - check only for top-level modules or filter out the troublemakers.
This commit is contained in:
parent
189f16965d
commit
41f5962da8
7 changed files with 585 additions and 29 deletions
|
|
@ -65,16 +65,17 @@
|
|||
}
|
||||
|
||||
# With $PATH and $PYTHONPATH set to the %%buildroot,
|
||||
# try to import the given Python 3 module(s).
|
||||
# try to import the Python 3 module(s) given as command-line args or read from file (-f).
|
||||
# Filter and check import on only top-level modules using -t flag.
|
||||
# Exclude unwanted modules by passing their globs to -e option.
|
||||
# Useful as a smoke test in %%check when running tests is not feasible.
|
||||
# Use spaces or commas as separators.
|
||||
%py3_check_import() %{expand:\\\
|
||||
(cd %{_topdir} &&\\\
|
||||
# Use spaces or commas as separators if providing list directly.
|
||||
# Use newlines as separators if providing list in a file.
|
||||
%py3_check_import(e:tf:) %{expand:\\\
|
||||
PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
||||
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
|
||||
PYTHONDONTWRITEBYTECODE=1\\\
|
||||
%{__python3} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
||||
)
|
||||
%{__python3} -%{py3_shebang_flags} %{_rpmconfigdir}/redhat/import_all_modules.py %{?**}
|
||||
}
|
||||
|
||||
# This only supports Python 3.5+ and will never work with Python 2.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue