| |
@@ -115,6 +115,43 @@
|
| |
end
|
| |
}
|
| |
|
| |
+ # With $PATH and $PYTHONPATH set to the %%buildroot,
|
| |
+ # try to import the given Python module(s).
|
| |
+ # Useful as a smoke test in %%check when running tests is not feasible.
|
| |
+ # Use spaces or commas as separators.
|
| |
+ %py_check_import() %{expand:\\\
|
| |
+ (cd %{_topdir} &&\\\
|
| |
+ PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
| |
+ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python_sitearch}:%{buildroot}%{python_sitelib}}"\\\
|
| |
+ PYTHONDONTWRITEBYTECODE=1\\\
|
| |
+ %{__python} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
| |
+ )
|
| |
+ }
|
| |
+ %py2_check_import() %{expand:\\\
|
| |
+ (cd %{_topdir} &&\\\
|
| |
+ PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
| |
+ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python2_sitearch}:%{buildroot}%{python2_sitelib}}"\\\
|
| |
+ PYTHONDONTWRITEBYTECODE=1\\\
|
| |
+ %{__python2} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
| |
+ )
|
| |
+ }
|
| |
+ %py3_check_import() %{expand:\\\
|
| |
+ (cd %{_topdir} &&\\\
|
| |
+ 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)}"
|
| |
+ )
|
| |
+ }
|
| |
+ %py3_other_check_import() %{expand:\\\
|
| |
+ (cd %{_topdir} &&\\\
|
| |
+ PATH="%{buildroot}%{_bindir}:$PATH"\\\
|
| |
+ PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_other_sitearch}:%{buildroot}%{python3_other_sitelib}}"\\\
|
| |
+ PYTHONDONTWRITEBYTECODE=1\\\
|
| |
+ %{__python3_other} -c "import %{lua:local m=rpm.expand('%{?*}'):gsub('[%s,]+', ', ');print(m)}"
|
| |
+ )
|
| |
+ }
|
| |
+
|
| |
# Backport from 4.15
|
| |
%_smp_build_ncpus %([ -z "$RPM_BUILD_NCPUS" ] \\\
|
| |
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
|
| |
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.
Backport of https://src.fedoraproject.org/rpms/python-rpm-macros/c/c2305ea3