Skip to content

Commit 6eb19b9

Browse files
committed
BUG#34373612: Fix the assumption that gcc is the default compiler
When compiling Connector/Python C extension, it's assumed that gcc and g++ are the default when logging the compiler information. This patch fixes it by getting the CC and CXX environment variables. Thank you for your contribution. Change-Id: Id440e8f02fc34111372020357bcfa3b69585e72b
1 parent fb3cfbb commit 6eb19b9

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Full release notes:
1111
v8.0.31
1212
=======
1313

14+
- BUG#34373612: Fix the assumption that gcc is the default compiler
1415
- BUG#34283402: Binary data starting with 0x00 are returned as empty string
1516
- BUG#34217492: Exec of stored procedures with args fails when db prefix used
1617
- BUG#28491115: Connector/Python crashes on 0 time value

cpydist/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,13 +681,16 @@ def run(self):
681681
ext.extra_compile_args.append("-Wno-unknown-pragmas")
682682

683683
if os.name != "nt":
684-
cmd_gcc_ver = ["gcc", "-v"]
685-
self.log.info("Executing: {0}".format(" ".join(cmd_gcc_ver)))
686-
proc = Popen(cmd_gcc_ver, stdout=PIPE, universal_newlines=True)
684+
is_macos = platform.system() == "Darwin"
685+
cc = os.environ.get("CC", "clang" if is_macos else "gcc")
686+
cxx = os.environ.get("CXX", "clang++" if is_macos else "g++")
687+
cmd_cc_ver = [cc, "-v"]
688+
self.log.info("Executing: %s", " ".join(cmd_cc_ver))
689+
proc = Popen(cmd_cc_ver, stdout=PIPE, universal_newlines=True)
687690
self.log.info(proc.communicate())
688-
cmd_gpp_ver = ["g++", "-v"]
689-
self.log.info("Executing: {0}".format(" ".join(cmd_gcc_ver)))
690-
proc = Popen(cmd_gpp_ver, stdout=PIPE, universal_newlines=True)
691+
cmd_cxx_ver = [cxx, "-v"]
692+
self.log.info("Executing: %s", " ".join(cmd_cxx_ver))
693+
proc = Popen(cmd_cxx_ver, stdout=PIPE, universal_newlines=True)
691694
self.log.info(proc.communicate())
692695

693696
# Remove disabled extensions

0 commit comments

Comments
 (0)