[gobject-introspection/customize-compiler-setup-macos] ccompiler: restore customize_compiler() setup for macOS. See #268



commit d7524c9d9ec6ac8b3db19177b2976187b3b6b3dd
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Mar 2 17:51:55 2019 +0100

    ccompiler: restore customize_compiler() setup for macOS. See #268
    
    The original customize_compiler() calls into  _osx_support.customize_compiler()
    the first time it is used and I didn't copy it in !118 because it is private API.
    
    Issue #268 points out that the macOS build is broken now so I guess that was important
    in some way. Make sure the setup code is run by calling the original customize_compiler()
    with a dummy compiler instance.

 giscanner/ccompiler.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index aee6a1af..32c92966 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -30,6 +30,7 @@ from distutils.msvccompiler import MSVCCompiler
 from distutils.unixccompiler import UnixCCompiler
 from distutils.cygwinccompiler import Mingw32CCompiler
 from distutils.sysconfig import get_config_vars
+from distutils.sysconfig import customize_compiler as orig_customize_compiler
 
 from . import utils
 
@@ -40,6 +41,12 @@ def customize_compiler(compiler):
     defaults if alternatives through env vars are given.
     """
 
+    # The original customize_compiler() in distutils calls into macOS setup
+    # code the first time it is called. This makes sure we run that setup
+    # code as well.
+    dummy = distutils.ccompiler.new_compiler()
+    orig_customize_compiler(dummy)
+
     if compiler.compiler_type == "unix":
         (cc, cxx, ldshared, shlib_suffix, ar, ar_flags) = \
             get_config_vars('CC', 'CXX', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')


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