From 8a0ad755ca59b1cd298c1d1f944e61256ffeede3 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sat, 3 Feb 2024 23:55:02 -0500 Subject: [PATCH] Avoid mypy dependency in RHEL builds RHEL does not include mypy, and the plugin is deprecated in 2.0: https://docs.sqlalchemy.org/en/20/orm/extensions/mypy.html --- python-sqlalchemy.spec | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python-sqlalchemy.spec b/python-sqlalchemy.spec index 91aea05..5c757fe 100644 --- a/python-sqlalchemy.spec +++ b/python-sqlalchemy.spec @@ -1,5 +1,7 @@ +# Mypy plugin is deprecated in 2.0. mypy is not in RHEL. +%bcond mypy %{undefined rhel} # Tests crash when being run by pytest-xdist -%bcond_with xdist +%bcond xdist 0 %global srcname SQLAlchemy %global canonicalname %{py_dist_name %{srcname}} @@ -10,7 +12,7 @@ mssql_pyodbc \ mysql \ mysql_connector \ - mypy \ + %{?with_mypy:mypy} \ postgresql \ postgresql_pg8000 \ postgresql_asyncpg \ @@ -36,7 +38,9 @@ BuildRequires: findutils BuildRequires: gcc BuildRequires: python3-devel >= 3.7 # The dependencies needed for testing don’t get auto-generated. +%if %{with mypy} BuildRequires: python3dist(mypy) +%endif BuildRequires: python3dist(pytest) %if %{with xdist} BuildRequires: python3dist(pytest-xdist) @@ -110,6 +114,9 @@ done > doc-files.txt %check %pytest test \ +%if %{without mypy} + -k 'not Mypy' \ +%endif %if %{with xdist} --numprocesses=auto %endif