python-cryptography/disable-RustExtension.patch
Matej Cepl f943f3caf8 Accepting request 924948 from home:bnavigator:branches:devel:languages:python
- Add disable-RustExtension.patch in order to avoid a build
  requirement setuptools_rust
- Next version (35.0) needs a full Rust toolchain.
- Clean runtime, build and test requirements
- Disable python2 build: Not supported anymore

OBS-URL: https://build.opensuse.org/request/show/924948
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cryptography?expand=0&rev=139
2021-10-13 00:59:08 +00:00

50 lines
1.8 KiB
Diff

Index: cryptography-3.4.8/setup.py
===================================================================
--- cryptography-3.4.8.orig/setup.py
+++ cryptography-3.4.8/setup.py
@@ -13,18 +13,9 @@ from setuptools import find_packages, se
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
+ print("Could not find setuptools_rust."
+ "Set CRYPTOGRAPHY_DONT_BUILD_RUST in order to not build with Rust")
+ RustExtension = None
base_dir = os.path.dirname(__file__)
@@ -41,9 +32,9 @@ with open(os.path.join(src_dir, "cryptog
# `install_requirements` and `setup_requirements` must be kept in sync with
# `pyproject.toml`
-setuptools_rust = "setuptools-rust>=0.11.4"
+setuptools_rust = ["setuptools-rust>=0.11.4"] if RustExtension else []
install_requirements = ["cffi>=1.12"]
-setup_requirements = install_requirements + [setuptools_rust]
+setup_requirements = install_requirements + setuptools_rust
if os.environ.get("CRYPTOGRAPHY_DONT_BUILD_RUST"):
rust_extensions = []
@@ -129,9 +120,7 @@ try:
"twine >= 1.12.0",
"sphinxcontrib-spelling >= 4.0.1",
],
- "sdist": [
- setuptools_rust,
- ],
+ "sdist": setuptools_rust,
"pep8test": [
"black",
"flake8",