pyproject-rpm-macros/macros.pyproject
2019-07-29 14:42:53 +02:00

42 lines
1.5 KiB
Plaintext

%pyproject_wheel() %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \\\
%{__python3} -m pip wheel --no-deps --use-pep517 --no-build-isolation --disable-pip-version-check --progress-bar off --verbose .
}
%pyproject_install() %{expand:\\\
%{__python3} -m pip install --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location ./*.whl
if [ -d %{buildroot}%{_bindir} ]; then
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{_bindir}/*
fi
if [ -d %{buildroot}%{python3_sitelib} ]; then
sed -i 's/pip/rpm/' %{buildroot}%{python3_sitelib}/*.dist-info/INSTALLER
fi
if [ -d %{buildroot}%{python3_sitearch} ]; then
sed -i 's/pip/rpm/' %{buildroot}%{python3_sitearch}/*.dist-info/INSTALLER
fi
}
%default_toxenv py%{python3_version_nodots}
%toxenv %{default_toxenv}
%pyproject_buildrequires(rx:t:) %{expand:\\\
%{-t:%{expand:%global toxenv %{-t*}}}
echo 'python3-devel'
echo 'python3dist(packaging)'
echo 'python3dist(pip) >= 19'
echo 'python3dist(pytoml)'
# setuptools assumes no pre-existing dist-info
rm -rfv *.dist-info/
if [ -f %{__python3} ]; then
%{__python3} -I %{_rpmconfigdir}/redhat/pyproject_buildrequires.py %{?**}
fi
}
%tox(e:) %{expand:\\\
TOX_TESTENV_PASSENV="${TOX_TESTENV_PASSENV:-*}" \\
PATH="%{buildroot}%{_bindir}:$PATH" \\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \\
tox --current-env -q --recreate -e "%{-e:%{-e*}}%{!-e:%{toxenv}}" %{?*}
}