2023-06-12 02:16:58 +00:00
|
|
|
# RHEL does not have packaged rust libraries
|
|
|
|
%bcond packaged_rust_libraries %{undefined rhel}
|
|
|
|
# The integration tests depend on the presence of these libraries
|
|
|
|
%bcond integration_tests %{with packaged_rust_libraries}
|
|
|
|
# Regex of integration tests to skip.
|
|
|
|
# * html-py-ever requires unpackaged rust crates
|
|
|
|
%global integration_tests_exc '^(html-py-ever)'
|
2021-03-09 10:09:03 +00:00
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
Name: python-setuptools-rust
|
2023-08-23 04:56:42 +00:00
|
|
|
Version: 1.7.0
|
2021-11-22 07:06:50 +00:00
|
|
|
Release: %autorelease
|
2021-01-14 20:11:20 +00:00
|
|
|
Summary: Setuptools Rust extension plugin
|
|
|
|
|
|
|
|
License: MIT
|
|
|
|
URL: https://github.com/PyO3/setuptools-rust
|
|
|
|
Source0: %{pypi_source setuptools-rust}
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
BuildRequires: python3-devel
|
2023-06-12 02:16:58 +00:00
|
|
|
BuildRequires: %{py3_dist pytest}
|
2021-02-11 06:21:06 +00:00
|
|
|
%if 0%{?fedora}
|
2023-03-01 22:25:34 +00:00
|
|
|
BuildRequires: rust-packaging
|
2021-02-11 06:21:06 +00:00
|
|
|
%else
|
2021-02-11 14:31:54 +00:00
|
|
|
# RHEL has rust-toolset and neither setuptools-scm nor wheel
|
|
|
|
BuildRequires: rust-toolset >= 1.45
|
2021-02-11 06:21:06 +00:00
|
|
|
%endif
|
2023-06-12 02:16:58 +00:00
|
|
|
%if %{with integration_tests}
|
|
|
|
BuildRequires: %{py3_dist cffi}
|
2021-03-09 10:09:03 +00:00
|
|
|
%endif
|
2021-01-14 20:11:20 +00:00
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
|
|
|
|
%global _description %{expand:
|
2021-01-14 20:11:20 +00:00
|
|
|
Setuptools helpers for Rust Python extensions. Compile and distribute Python
|
2023-06-12 02:16:58 +00:00
|
|
|
extensions written in Rust as easily as if they were written in C.}
|
|
|
|
|
|
|
|
%description %{_description}
|
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
|
|
|
|
%package -n python3-setuptools-rust
|
|
|
|
Summary: %{summary}
|
2021-02-11 14:31:54 +00:00
|
|
|
%if 0%{?fedora}
|
2023-03-01 22:25:34 +00:00
|
|
|
Requires: rust-packaging
|
2021-02-11 14:31:54 +00:00
|
|
|
%else
|
|
|
|
Requires: rust-toolset >= 1.45
|
|
|
|
%endif
|
2021-01-14 20:11:20 +00:00
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
%description -n python3-setuptools-rust %{_description}
|
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%autosetup -n setuptools-rust-%{version}
|
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
%cargo_prep
|
|
|
|
|
|
|
|
%if %{with integration_tests}
|
|
|
|
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
|
|
|
|
cd "examples/${example}"
|
|
|
|
%cargo_prep
|
|
|
|
cd -
|
|
|
|
done
|
2021-02-11 06:21:06 +00:00
|
|
|
%endif
|
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
|
2023-08-23 04:56:42 +00:00
|
|
|
%generate_buildrequires
|
|
|
|
%pyproject_buildrequires
|
2023-06-12 02:16:58 +00:00
|
|
|
%if %{with integration_tests}
|
|
|
|
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
|
|
|
|
cd "examples/${example}"
|
|
|
|
%cargo_generate_buildrequires
|
|
|
|
cd - >&2
|
|
|
|
done
|
|
|
|
%endif
|
|
|
|
|
2021-02-11 06:21:06 +00:00
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
%build
|
2023-08-23 04:56:42 +00:00
|
|
|
%pyproject_wheel
|
2021-01-14 20:11:20 +00:00
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
%install
|
2023-08-23 04:56:42 +00:00
|
|
|
%pyproject_install
|
|
|
|
%pyproject_save_files setuptools_rust
|
2021-01-14 20:11:20 +00:00
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
|
2021-02-11 06:21:06 +00:00
|
|
|
%check
|
2023-06-12 02:16:58 +00:00
|
|
|
%pyproject_check_import
|
|
|
|
# Disable tests that require internet access and/or test Windows functionality
|
|
|
|
%global test_ignores %{shrink:
|
|
|
|
not test_adjusted_local_rust_target_windows_msvc
|
|
|
|
and not test_get_lib_name_namespace_package
|
|
|
|
}
|
2021-02-11 06:21:06 +00:00
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
%if %{without packaged_rust_libraries}
|
|
|
|
%global test_ignores %{shrink:%{test_ignores}
|
|
|
|
and not test_metadata_contents
|
|
|
|
and not test_metadata_cargo_log
|
|
|
|
}
|
2021-03-09 10:09:03 +00:00
|
|
|
%endif
|
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
%pytest tests/ setuptools_rust/ --import-mode importlib -k '%{test_ignores}'
|
|
|
|
|
|
|
|
%if %{with integration_tests}
|
2023-08-31 01:53:30 +00:00
|
|
|
export %{py3_test_envvars}
|
2023-06-12 02:16:58 +00:00
|
|
|
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
|
|
|
|
cd "examples/${example}"
|
|
|
|
%{python3} -c 'from setuptools.build_meta import build_wheel; build_wheel("dist")'
|
|
|
|
if [ -d "tests/" ]; then
|
|
|
|
%{python3} -m venv venv --system-site-packages
|
|
|
|
. ./venv/bin/activate
|
|
|
|
pip install dist/*.whl
|
|
|
|
python -Pm pytest tests/
|
|
|
|
deactivate
|
|
|
|
fi
|
|
|
|
cd -
|
|
|
|
done
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
2023-08-23 04:56:42 +00:00
|
|
|
%files -n python3-setuptools-rust -f %{pyproject_files}
|
2021-01-14 20:11:20 +00:00
|
|
|
%doc README.md CHANGELOG.md
|
|
|
|
%license LICENSE
|
|
|
|
|
2023-06-12 02:16:58 +00:00
|
|
|
|
2021-01-14 20:11:20 +00:00
|
|
|
%changelog
|
2021-11-22 07:06:50 +00:00
|
|
|
%autochangelog
|