diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-07-26 10:48:31 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2022-11-21 15:51:49 +0800 |
commit | 7baf54a4e4e5d8672a4c617cc3578418f4aeb471 (patch) | |
tree | 76c770a0c1a9002cfad986c56e58c5f982e882be /giscanner | |
parent | c2d6e0bc2478b63d0e07c004e38da6162a5ca988 (diff) | |
download | gobject-introspection-fix-msvc-setuptools-distutils.tar.gz |
ccompiler.py: Fix running on Visual Studio against SetupToolsfix-msvc-setuptools-distutils
...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() in this
case 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. So, we do nothing in customize_compiler() if we are
not using a unix compiler type.
This will fix the warn-* tests for G-I on Python 3.9.x or later when the default
distutils used is now the one that comes with setuptools, without needing to
use the envvar SETUPTOOLS_USE_DISTUTILS=stdlib.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ccompiler.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 2912fe0e..7a8dee78 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -40,14 +40,12 @@ def customize_compiler(compiler): any macOS specific bits and which tries to avoid using any Python specific 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": + # 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) (cc, cxx, ldshared, shlib_suffix, ar, ar_flags) = \ get_config_vars('CC', 'CXX', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') |