File ctypeslib2-suse-remove-info-check.patch of Package python-ctypeslib2

# python3-clang does not provide dist- or egg-info, we do not use the unofficial pypi package there
Index: ctypeslib-2.3.4/ctypeslib/__init__.py
===================================================================
--- ctypeslib-2.3.4.orig/ctypeslib/__init__.py
+++ ctypeslib-2.3.4/ctypeslib/__init__.py
@@ -11,7 +11,9 @@ and providing tools for handling errors
 import ctypes
 import os
 import re
+import subprocess
 import sys
+import sysconfig
 import warnings
 from ctypes.util import find_library
 
@@ -114,7 +116,10 @@ try:
     from clang import cindex
     from ctypeslib.codegen.codegenerator import translate, translate_files
 
-    __clang_py_version__ = get_distribution('clang').version
+    purelib = sysconfig.get_path("purelib")
+    __clang_py_version__ = subprocess.check_output(
+        ["rpm", "--query", "--queryformat", "%{version}", "-f", f"{purelib}/clang"],
+        text=True)
     __clang_library_filename = __configure_clang_cindex()
     if __clang_library_filename is None:
         warnings.warn("Could not find the clang library. please install llvm libclang", RuntimeWarning)
Index: ctypeslib-2.3.4/pyproject.toml
===================================================================
--- ctypeslib-2.3.4.orig/pyproject.toml
+++ ctypeslib-2.3.4/pyproject.toml
@@ -15,7 +15,6 @@ classifiers = [
     "Programming Language :: Python :: 3.8",
     "Topic :: Software Development :: Libraries :: Python Modules",
 ]
-dependencies = ["clang>=11"]
 dynamic = ["version"]
 
 [project.urls]
From 12425beba8db4c3074bb045d80a07be8ad722ade Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Wed, 26 Apr 2023 11:00:41 +0200
Subject: [PATCH] Switch clang and clang_py versions

---
 ctypeslib/clang2py.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctypeslib/clang2py.py b/ctypeslib/clang2py.py
index 10c29a1..49133bc 100755
--- a/ctypeslib/clang2py.py
+++ b/ctypeslib/clang2py.py
@@ -260,7 +260,7 @@ def windows_dlls(option, opt, value, _parser):  # pylint: disable=unused-argumen
 
     def version_string():
         version = "versions - %(prog)s:" \
-                  f"{ctypeslib.__version__} python-clang:{clang_version()} clang:{clang_py_version()} " \
+                  f"{ctypeslib.__version__} python-clang:{clang_py_version()} clang:{clang_version()} " \
                   f"clang_filename:{ctypeslib.__clang_library_filename}"  # pylint: disable=protected-access
         return version
 
openSUSE Build Service is sponsored by