[gobject-introspection/fix-msvc-setuptools-distutils: 9/9] ccompiler.py: Fix running on Visual Studio against SetupTools




commit 1f0a097bc623953308d92e7c333766737c184979
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 19 15:34:17 2022 +0800

    ccompiler.py: Fix running on Visual Studio against SetupTools
    
    ...when we use the distutils that is packaged with SetupTools instead of the
    one that comes with Python stdlib, which is often the case on newer Python 3.9+
    (or so) installations.  Calling distutils.ccompiler.new_compiler() won't work
    when running on Visual Studio builds, and we use the compiler instance for
    distutils's customize_compiler(), which was never meant for Visual Studio.
    
    This will fix the warn-* tests for G-I.

 giscanner/ccompiler.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index a6be9ee6..ae2ff191 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -133,12 +133,12 @@ class CCompiler(object):
         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()
-            # implementation
+            # implementation.  Do not attempt to call customize_compiler().
             from . import msvccompiler
             self.compiler = msvccompiler.get_msvc_compiler()
         else:
             self.compiler = distutils.ccompiler.new_compiler(compiler=compiler_name)
-        customize_compiler(self.compiler)
+            customize_compiler(self.compiler)
 
         # customize_compiler() from distutils only does customization
         # for 'unix' compiler type.  Also, avoid linking to msvcrxx.dll


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]