Migrate a bit more logic to pyproject.toml (#9489)

This commit is contained in:
Alex Gaynor 2023-08-23 10:32:16 -04:00 committed by GitHub
parent 2879af1e81
commit afc06e28f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 29 deletions

View file

@ -6,7 +6,7 @@ requires = [
"wheel", "wheel",
# Must be kept in sync with `project.dependencies` # Must be kept in sync with `project.dependencies`
"cffi>=1.12; platform_python_implementation != 'PyPy'", "cffi>=1.12; platform_python_implementation != 'PyPy'",
"setuptools-rust>=0.11.4", "setuptools-rust>=1.7.0",
] ]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
@ -81,6 +81,13 @@ docstest = ["pyenchant >=1.6.11", "twine >=1.12.0", "sphinxcontrib-spelling >=4
sdist = ["build"] sdist = ["build"]
pep8test = ["black", "ruff", "mypy", "check-sdist"] pep8test = ["black", "ruff", "mypy", "check-sdist"]
[[tool.setuptools-rust.ext-modules]]
target = "cryptography.hazmat.bindings._rust"
path = "src/rust/Cargo.toml"
py-limited-api = true
rust-version = ">=1.63.0"
[tool.black] [tool.black]
line-length = 79 line-length = 79
target-version = ["py37"] target-version = ["py37"]

View file

@ -14,23 +14,6 @@ import warnings
from setuptools import setup from setuptools import setup
try:
from setuptools_rust import RustExtension
except ImportError:
print(
"""
=============================DEBUG ASSISTANCE==========================
If you are seeing an error here please try the following to
successfully install cryptography:
Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
=============================DEBUG ASSISTANCE==========================
"""
)
raise
# distutils emits this warning if you pass `setup()` an unknown option. This # distutils emits this warning if you pass `setup()` an unknown option. This
# is what happens if you somehow run this file without `cffi` installed: # is what happens if you somehow run this file without `cffi` installed:
# `cffi_modules` is an unknown option. # `cffi_modules` is an unknown option.
@ -47,17 +30,8 @@ if hasattr(sys, "pypy_version_info") and sys.pypy_version_info < (7, 3, 10):
raise RuntimeError("cryptography is not compatible with PyPy3 < 7.3.10") raise RuntimeError("cryptography is not compatible with PyPy3 < 7.3.10")
try: try:
# See pyproject.toml for most of the config metadata. # See pyproject.toml for the config metadata.
setup( setup()
rust_extensions=[
RustExtension(
"cryptography.hazmat.bindings._rust",
"src/rust/Cargo.toml",
py_limited_api=True,
rust_version=">=1.63.0",
)
],
)
except: except:
# Note: This is a bare exception that re-raises so that we don't interfere # Note: This is a bare exception that re-raises so that we don't interfere
# with anything the installation machinery might want to do. Because we # with anything the installation machinery might want to do. Because we