diff --git a/backport-giscanner-remove-dependency-on-distutils.msvccompiler.patch b/backport-giscanner-remove-dependency-on-distutils.msvccompiler.patch new file mode 100644 index 0000000000000000000000000000000000000000..712fafe27946194e4f382023570827f3d41fcf83 --- /dev/null +++ b/backport-giscanner-remove-dependency-on-distutils.msvccompiler.patch @@ -0,0 +1,101 @@ +From a2139dba59eac283a7f543ed737f038deebddc19 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Wed, 28 Aug 2024 21:26:02 +0200 +Subject: [PATCH] giscanner: remove dependency on distutils.msvccompiler + +It was removed with setuptools 74.0.0. Since we still depend on the +MSVCCompiler class use new_compiler() to get it some other way. + +Remove any reference to MSVC9Compiler, which was for Visual Studio 2008 +which we no longer support anyway. + +Fixes #515 +--- + giscanner/ccompiler.py | 7 +++---- + giscanner/msvccompiler.py | 14 +++++++------- + 2 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py +index d0ed70a3c..9a732cd5e 100644 +--- a/giscanner/ccompiler.py ++++ b/giscanner/ccompiler.py +@@ -26,7 +26,6 @@ import tempfile + import sys + import distutils + +-from distutils.msvccompiler import MSVCCompiler + from distutils.unixccompiler import UnixCCompiler + from distutils.cygwinccompiler import Mingw32CCompiler + from distutils.sysconfig import get_config_vars +@@ -167,7 +166,7 @@ class CCompiler(object): + # Now, create the distutils ccompiler instance based on the info we have. + if compiler_name == 'msvc': + # For MSVC, we need to create a instance of a subclass of distutil's +- # MSVC9Compiler class, as it does not provide a preprocess() ++ # MSVCCompiler class, as it does not provide a preprocess() + # implementation + from . import msvccompiler + self.compiler = msvccompiler.get_msvc_compiler() +@@ -460,7 +459,7 @@ class CCompiler(object): + return self.compiler.linker_exe + + def check_is_msvc(self): +- return isinstance(self.compiler, MSVCCompiler) ++ return self.compiler.compiler_type == "msvc" + + # Private APIs + def _set_cpp_options(self, options): +@@ -486,7 +485,7 @@ class CCompiler(object): + # macros for compiling using distutils + # get dropped for MSVC builds, so + # escape the escape character. +- if isinstance(self.compiler, MSVCCompiler): ++ if self.check_is_msvc(): + macro_value = macro_value.replace('\"', '\\\"') + macros.append((macro_name, macro_value)) + elif option.startswith('-U'): +diff --git a/giscanner/msvccompiler.py b/giscanner/msvccompiler.py +index 0a5439820..e333a80f5 100644 +--- a/giscanner/msvccompiler.py ++++ b/giscanner/msvccompiler.py +@@ -19,30 +19,30 @@ + # + + import os +-import distutils ++from typing import Type + + from distutils.errors import DistutilsExecError, CompileError +-from distutils.ccompiler import CCompiler, gen_preprocess_options ++from distutils.ccompiler import CCompiler, gen_preprocess_options, new_compiler + from distutils.dep_util import newer + + # Distutil's MSVCCompiler does not provide a preprocess() + # Implementation, so do our own here. + + ++DistutilsMSVCCompiler: Type = type(new_compiler(compiler="msvc")) ++ ++ + def get_msvc_compiler(): + return MSVCCompiler() + + +-class MSVCCompiler(distutils.msvccompiler.MSVCCompiler): ++class MSVCCompiler(DistutilsMSVCCompiler): + + def __init__(self, verbose=0, dry_run=0, force=0): +- super(distutils.msvccompiler.MSVCCompiler, self).__init__() ++ super(DistutilsMSVCCompiler, self).__init__() + CCompiler.__init__(self, verbose, dry_run, force) + self.__paths = [] + self.__arch = None # deprecated name +- if os.name == 'nt': +- if isinstance(self, distutils.msvc9compiler.MSVCCompiler): +- self.__version = distutils.msvc9compiler.VERSION + self.initialized = False + self.preprocess_options = None + if self.check_is_clang_cl(): +-- +GitLab + diff --git a/backport-scanner-Limit-the-relative-imports.patch b/backport-scanner-Limit-the-relative-imports.patch new file mode 100644 index 0000000000000000000000000000000000000000..a188a1a6727605719066d5fe3ab397f833f40911 --- /dev/null +++ b/backport-scanner-Limit-the-relative-imports.patch @@ -0,0 +1,69 @@ +From 177da2645946ce4a5e8b50f5fb7b7f67e291f9ce Mon Sep 17 00:00:00 2001 +From: Emmanuele Bassi +Date: Sun, 24 Dec 2023 23:12:37 +0000 +Subject: [PATCH] scanner: Limit the relative imports + +--- + giscanner/ast.py | 6 ++---- + giscanner/message.py | 6 +++--- + 2 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/giscanner/ast.py b/giscanner/ast.py +index ad94f4377..c66c82172 100644 +--- a/giscanner/ast.py ++++ b/giscanner/ast.py +@@ -24,10 +24,8 @@ import operator + from itertools import chain + from collections import OrderedDict + +-from . import message +- + from .sourcescanner import CTYPE_TYPEDEF, CSYMBOL_TYPE_TYPEDEF +-from .message import Position ++from .message import Position, warn + from .utils import to_underscores + + +@@ -779,7 +777,7 @@ class Function(Callable): + # Returns GType + rettype = self.retval.type + if (not rettype.is_equiv(TYPE_GTYPE) and rettype.target_giname != 'Gtk.Type'): +- message.warn("function '%s' returns '%r', not a GType" % (self.name, rettype)) ++ warn("function '%s' returns '%r', not a GType" % (self.name, rettype)) + return False + + return True +diff --git a/giscanner/message.py b/giscanner/message.py +index 72e446d28..70e993b9c 100644 +--- a/giscanner/message.py ++++ b/giscanner/message.py +@@ -23,7 +23,7 @@ import os + import sys + import operator + +-from . import utils ++from .utils import break_on_debug_flag + + (WARNING, + ERROR, +@@ -133,7 +133,7 @@ class MessageLogger(object): + Log a warning, using optional file positioning information. + If the warning is related to a ast.Node type, see log_node(). + """ +- utils.break_on_debug_flag('warning') ++ break_on_debug_flag('warning') + + self._warning_count += 1 + +@@ -179,7 +179,7 @@ class MessageLogger(object): + self._output.write(text) + + if log_type == FATAL: +- utils.break_on_debug_flag('fatal') ++ break_on_debug_flag('fatal') + raise SystemExit(text) + + def log_node(self, log_type, node, text, context=None, positions=None): +-- +GitLab + diff --git a/gobject-introspection.spec b/gobject-introspection.spec index 82dd72da303e0478c3e3d6036a033f55ec93951c..4dfe3ff14c59078b5e9805c1cf11dfe5c9034d70 100644 --- a/gobject-introspection.spec +++ b/gobject-introspection.spec @@ -2,7 +2,7 @@ Name: gobject-introspection Version: 1.76.1 -Release: 3 +Release: 4 Summary: Introspection system for GObject-based libraries License: GPL-2.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND BSD-2-Clause URL: https://gi.readthedocs.io/ @@ -13,6 +13,9 @@ Source1: gi-find-deps.sh Source2: gobjectintrospection.attr Source3: gobject-introspection-typelib.template +Patch6001: backport-giscanner-remove-dependency-on-distutils.msvccompiler.patch +Patch6002: backport-scanner-Limit-the-relative-imports.patch + BuildRequires: gcc BuildRequires: meson >= 0.60.0 BuildRequires: pkgconfig(cairo) @@ -103,6 +106,10 @@ diff -s %{S:3} gobject-introspection-typelib.installed %{_mandir}/man1/*.1* %changelog +* Thu Jun 05 2025 Funda Wang - 1.76.1-4 +- remove dependency on distutils.msvccompiler which is removed with setuptools 74 +- scanner: Limit the relative imports + * Mon Oct 14 2024 Funda Wang - 1.76.1-3 - check typelib provides against installed typelib libs - promote python-gobject for downstream packages