diff --git a/ctypeslib-pr113-clang2py-h.patch b/ctypeslib-pr113-clang2py-h.patch deleted file mode 100644 index d062477..0000000 --- a/ctypeslib-pr113-clang2py-h.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 85c47d704eb5f85c48c9588db054f2639cbce6d3 Mon Sep 17 00:00:00 2001 -From: Ben Greiner -Date: Wed, 15 Jun 2022 13:14:08 +0200 -Subject: [PATCH] Changed clang2py -h output in Python 3.10 - -The line for the argparser changed from "optional arguments" to "options". ---- - test/test_clang2py.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/test_clang2py.py b/test/test_clang2py.py -index 6cf2ea6..3d0ad43 100644 ---- a/test/test_clang2py.py -+++ b/test/test_clang2py.py -@@ -96,7 +96,7 @@ def test_helper(self): - self.assertEqual(0, p.returncode) - self.assertIn("Cross-architecture:", output) - self.assertIn("usage:", output) -- self.assertIn("optional arguments", output) -+ self.assertRegex(output, r"\noption.*:") - - - class ArgumentTypeKind(ClangTest): diff --git a/ctypeslib2-2.3.2.tar.gz b/ctypeslib2-2.3.2.tar.gz deleted file mode 100644 index bf0959a..0000000 --- a/ctypeslib2-2.3.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1cacac938ecee4302d3982dd74769d45e3dbfcc9444304c25f0aca5f9fe6c2da -size 74361 diff --git a/ctypeslib2-2.3.4-gh.tar.gz b/ctypeslib2-2.3.4-gh.tar.gz new file mode 100644 index 0000000..b6666f7 --- /dev/null +++ b/ctypeslib2-2.3.4-gh.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a744004022aa0ae4233165b9fe814af7071dc6c50fcdb517190ad13efacfd6af +size 93081 diff --git a/ctypeslib2-suse-remove-info-check.patch b/ctypeslib2-suse-remove-info-check.patch new file mode 100644 index 0000000..e7679cf --- /dev/null +++ b/ctypeslib2-suse-remove-info-check.patch @@ -0,0 +1,39 @@ +# 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] diff --git a/python-ctypeslib2.changes b/python-ctypeslib2.changes index 69e483f..8b6cffb 100644 --- a/python-ctypeslib2.changes +++ b/python-ctypeslib2.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Apr 24 21:34:46 UTC 2023 - Ben Greiner + +- Update to 2.3.4 + * no release notes +- Release 2.3.3 + * be more specific on the warning +- Upstream released only a wheel not an sdist: use github tarball +- Drop ctypeslib-pr113-clang2py-h.patch +- Add ctypeslib2-suse-remove-info-check.patch +- Restrict to clang15 on Tumbleweed + ------------------------------------------------------------------- Fri Oct 14 01:33:02 UTC 2022 - John Vandenberg diff --git a/python-ctypeslib2.spec b/python-ctypeslib2.spec index e7676a0..cc662f7 100644 --- a/python-ctypeslib2.spec +++ b/python-ctypeslib2.spec @@ -1,7 +1,7 @@ # # spec file for package python-ctypeslib2 # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,30 +21,37 @@ %define pythons python3 # help in the rename from multiflavor to python3 only %define primary_python3 python%{python3_version_nodots} -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %ifarch %{ix86} x86_64 %bcond_without test %else %bcond_with test %endif +%if 0%{suse_version >= 1599} +# Tumbleweed default 16 is not compatible +%define clangmajor 15 +%endif Name: python-ctypeslib2 -Version: 2.3.2 +Version: 2.3.4 Release: 0 Summary: Python FFI toolkit using clang License: MIT Group: Development/Languages/Python URL: https://github.com/trolldbois/ctypeslib -Source: https://files.pythonhosted.org/packages/source/c/ctypeslib2/ctypeslib2-%{version}.tar.gz -# PATCH-FIX-UPSTREAM ctypeslib-pr113-clang2py-h.patch -- gh#trolldbois/ctypeslib#113 -Patch1: ctypeslib-pr113-clang2py-h.patch -BuildRequires: %{python_module clang >= 11} +Source: https://github.com/trolldbois/ctypeslib/archive/refs/tags/%{version}.tar.gz#/ctypeslib2-%{version}-gh.tar.gz +# PATCH-FIX-OPENSUSE ctypeslib2-suse-remove-info-check.patch code@bnavigator.de, python3-clang does not provide dist- or egg-info, we do not use the unofficial pypi package there +Patch1: ctypeslib2-suse-remove-info-check.patch +BuildRequires: %{python_module clang%{?clangmajor} >= 11} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools_scm} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module testsuite} -BuildRequires: clang >= 11 +BuildRequires: %{python_module wheel} +BuildRequires: clang%{?clangmajor} >= 11 BuildRequires: fdupes +BuildRequires: llvm%{?clangmajor}-libclang13 BuildRequires: python-rpm-macros >= 20220610 -Requires: python-clang >= 11 +Requires: python-clang%{?clangmajor} >= 11 Requires(post): update-alternatives Requires(postun):update-alternatives Provides: %{primary_python3}-ctypeslib2 = %{version}-%{release} @@ -56,20 +63,15 @@ BuildArch: noarch Python FFI toolkit using clang. %prep -%autosetup -p1 -n ctypeslib2-%{version} +%autosetup -p1 -n ctypeslib-%{version} sed -i '1{/^#!/d}' ctypeslib/clang2py.py -# avoid pkg_resources/importlib errors because python3-clang does not provide an egg-info (even upstream does not) -sed -i '/clang>=/ d' setup.py - -# avoid toml error: gh#trolldbois/ctypeslib#94 -sed -i 's/True/true/' pyproject.toml - %build -%python_build +export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/clang2py %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -79,8 +81,8 @@ CFLAGS="-Wall -Wextra -Werror -Wno-strict-prototypes -std=c99 -pedantic -fpic" LDFLAGS="-shared" clang $CFLAGS $LDFLAGS -o test/data/test-callbacks.so test/data/test-callbacks.c +%python_flavored_alternatives export LANG=en_US.UTF-8 -export PATH="$(pwd)/build/bin:$PATH" export CPATH=$(clang -print-resource-dir)/include if [ $(getconf LONG_BIT) -eq 32 ]; then # not for 32-bit (looks for gnu/stubs-64.h) @@ -89,7 +91,8 @@ if [ $(getconf LONG_BIT) -eq 32 ]; then sed -i 's/test_extern_function_pointer_multiarg/_&/' test/test_types_values.py fi -%pyunittest discover -s test/ -v +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} clang2py --version +%pyunittest -v test.alltests %endif %post