[gobject-introspection/win32-use-distutils-linker] ccompiler: use the distutils linker in the dumper
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/win32-use-distutils-linker] ccompiler: use the distutils linker in the dumper
- Date: Thu, 8 Aug 2019 19:13:51 +0000 (UTC)
commit c1f4af2830ff636fa32c36964f7ee7f78d94824b
Author: Christoph Reiter <reiter christoph gmail com>
Date: Thu Aug 8 21:12:03 2019 +0200
ccompiler: use the distutils linker in the dumper
No need to hardcode things since distutils looks it up.
Similar to !170 but for Windows.
giscanner/ccompiler.py | 9 +++++++++
giscanner/dumper.py | 6 +-----
tests/scanner/test_ccompiler.py | 5 +++++
3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index 32c92966..35549da2 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -413,6 +413,15 @@ class CCompiler(object):
", ".join(not_resolved))
return shlibs
+ @property
+ def linker_cmd(self):
+ if self.check_is_msvc():
+ if not self.compiler.initialized:
+ self.compiler.initialize()
+ return [self.compiler.linker]
+ else:
+ return self.compiler.linker_exe
+
def check_is_msvc(self):
return isinstance(self.compiler, MSVCCompiler)
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index abf2150e..efa18782 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -91,10 +91,6 @@ class DumpCompiler(object):
self._uninst_srcdir = os.environ.get('UNINSTALLED_INTROSPECTION_SRCDIR')
self._packages = ['gio-2.0', 'gmodule-2.0']
self._packages.extend(options.packages)
- if self._compiler.check_is_msvc():
- self._linker_cmd = ['link.exe']
- else:
- self._linker_cmd = self._compiler.compiler.linker_exe
# Public API
@@ -202,7 +198,7 @@ class DumpCompiler(object):
if self._options.quiet:
args.append('--silent')
- args.extend(self._linker_cmd)
+ args.extend(self._compiler.linker_cmd)
# We can use -o for the Microsoft compiler/linker,
# but it is considered deprecated usage
diff --git a/tests/scanner/test_ccompiler.py b/tests/scanner/test_ccompiler.py
index 5890aa9b..6c0674a1 100644
--- a/tests/scanner/test_ccompiler.py
+++ b/tests/scanner/test_ccompiler.py
@@ -62,6 +62,11 @@ class UnixCCompilerTest(unittest.TestCase):
except ValueError:
self.fail('%r is not a subsequence of %r' % (list1, list2))
+ def test_link_cmd(self):
+ with Environ(dict(CC="foobar")):
+ compiler = CCompiler()
+ self.assertEqual(compiler.linker_cmd[0], "foobar")
+
def test_link_args_override(self):
with Environ(dict(CC="foobar")):
compiler = CCompiler()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]