diff --git a/.gitignore b/.gitignore index e69de29..02e8b0f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,10 @@ +/*-pyproject-* +/setuptools-rust-0.11.6.tar.gz +/setuptools-rust-0.12.0.tar.gz +/setuptools-rust-0.12.1.tar.gz +/setuptools-rust-1.0.0.tar.gz +/setuptools-rust-1.1.2.tar.gz +/setuptools-rust-1.2.0.tar.gz +/setuptools-rust-1.5.2.tar.gz +/setuptools-rust-1.6.0.tar.gz +/setuptools-rust-1.7.0.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..47615f6 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# python-setuptools-rust + +The python-setuptools-rust package diff --git a/changelog b/changelog new file mode 100644 index 0000000..27175ff --- /dev/null +++ b/changelog @@ -0,0 +1,25 @@ +* Fri Jul 23 2021 Fedora Release Engineering - 0.12.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jun 02 2021 Python Maint - 0.12.1-2 +- Rebuilt for Python 3.10 + +* Thu Mar 11 2021 Christian Heimes - 0.12.1-1 +- Update to 0.12.1 + +* Tue Mar 09 2021 Christian Heimes - 0.12.0-1 +- Update to 0.12.0 (#1936679) +- Run tomlgen example as test case + +* Thu Feb 11 2021 Christian Heimes - 0.11.6-4 +- Fix RHEL build: remove wheel build requirements, use rust-toolset + +* Thu Feb 11 2021 Christian Heimes - 0.11.6-3 +- Add RHEL packaging support + +* Wed Jan 27 2021 Fedora Release Engineering - 0.11.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Jan 14 2021 Christian Heimes - 0.11.6-1 +- Initial package. +- Resolves: rhbz#1906490 diff --git a/python-setuptools-rust.spec b/python-setuptools-rust.spec new file mode 100644 index 0000000..124f048 --- /dev/null +++ b/python-setuptools-rust.spec @@ -0,0 +1,123 @@ +# 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)' + +Name: python-setuptools-rust +Version: 1.7.0 +Release: %autorelease +Summary: Setuptools Rust extension plugin + +License: MIT +URL: https://github.com/PyO3/setuptools-rust +Source0: %{pypi_source setuptools-rust} +BuildArch: noarch + +BuildRequires: python3-devel +BuildRequires: %{py3_dist pytest} +%if 0%{?fedora} +BuildRequires: rust-packaging +%else +# RHEL has rust-toolset instead of rust-packaging +BuildRequires: rust-toolset >= 1.45 +%endif +%if %{with integration_tests} +BuildRequires: %{py3_dist cffi} +%endif + + +%global _description %{expand: +Setuptools helpers for Rust Python extensions. Compile and distribute Python +extensions written in Rust as easily as if they were written in C.} + +%description %{_description} + + +%package -n python3-setuptools-rust +Summary: %{summary} +%if 0%{?fedora} +Requires: rust-packaging +%else +Requires: rust-toolset >= 1.45 +%endif + +%description -n python3-setuptools-rust %{_description} + + +%prep +%autosetup -n setuptools-rust-%{version} + +%cargo_prep + +%if %{with integration_tests} +for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do + cd "examples/${example}" + %cargo_prep + cd - +done +%endif + + +%generate_buildrequires +%pyproject_buildrequires +%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 + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files setuptools_rust + + +%check +%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 +} + +%if %{without packaged_rust_libraries} +%global test_ignores %{shrink:%{test_ignores} + and not test_metadata_contents + and not test_metadata_cargo_log +} +%endif + +%pytest tests/ setuptools_rust/ --import-mode importlib -k '%{test_ignores}' + +%if %{with integration_tests} +export %{py3_test_envvars} +%global _pyproject_wheeldir dist +for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do + cd "examples/${example}" + %pyproject_wheel + if [ -d "tests/" ]; then + %{python3} -m venv venv --system-site-packages + ./venv/bin/pip install dist/*.whl + ./venv/bin/python -Pm pytest tests/ + fi + cd - +done +%endif + + +%files -n python3-setuptools-rust -f %{pyproject_files} +%doc README.md CHANGELOG.md +%license LICENSE + + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..6859e22 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (setuptools-rust-1.7.0.tar.gz) = 19e77be4856f6517155175272e4b1ec1eca7a75f73a94ec2e9c26d6b1fe217a7dda3ee6454a30aa477dedea15d7eb723d0f8753700e2d8dec303d58b03712c6e diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..fea4f0e --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,16 @@ +--- +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + repositories: + - repo: "https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git" + dest: "pyproject-rpm-macros" + tests: + - mockbuild_cryptography: + dir: pyproject-rpm-macros/tests + run: fedpkg clone -a python-cryptography && cd python-cryptography && (git switch f$(rpm -q --qf '%{VERSION}' fedora-release-common) || :) && fedpkg sources && ../mocktest.sh python-cryptography + required_packages: + - fedpkg + - mock