in mysqlx-connector-python/cpydist/__init__.py [0:0]
def run(self):
"""Run the command."""
# Generate docs/INFO_SRC
write_info_src(VERSION_TEXT)
disabled = [] # Extensions to be disabled
for ext in self.extensions:
# Add Protobuf include and library dirs
if not self.with_mysqlxpb_cext:
self.log.warning("The '_mysqlxpb' C extension will not be built")
disabled.append(ext)
continue
if platform.system() == "Darwin":
symbol_file = tempfile.NamedTemporaryFile()
ext.extra_link_args.extend(["-exported_symbols_list", symbol_file.name])
with open(symbol_file.name, "w") as fp:
fp.write("_PyInit__mysqlxpb")
fp.write("\n")
ext.include_dirs.append(self.with_protobuf_include_dir)
ext.library_dirs.append(self._build_protobuf_lib_dir)
ext.libraries.append("libprotobuf" if os.name == "nt" else "protobuf")
ext.libraries.extend(ABSL_LIBS)
if os.name != "nt":
# Add -std=c++14 needed for Protobuf 4.25.3
ext.extra_compile_args.append("-std=c++14")
self._run_protoc()
# Suppress unknown pragmas
if os.name == "posix":
ext.extra_compile_args.append("-Wno-unknown-pragmas")
if os.name != "nt":
is_macos = platform.system() == "Darwin"
cc = os.environ.get("CC", "clang" if is_macos else "gcc")
cxx = os.environ.get("CXX", "clang++" if is_macos else "g++")
cmd_cc_ver = [cc, "-v"]
self.log.info("Executing: %s", " ".join(cmd_cc_ver))
proc = Popen(cmd_cc_ver, stdout=PIPE, universal_newlines=True)
self.log.info(proc.communicate())
cmd_cxx_ver = [cxx, "-v"]
self.log.info("Executing: %s", " ".join(cmd_cxx_ver))
proc = Popen(cmd_cxx_ver, stdout=PIPE, universal_newlines=True)
self.log.info(proc.communicate())
# Remove disabled extensions
for ext in disabled:
self.extensions.remove(ext)
build_ext.run(self)
# Generate docs/INFO_BIN
if self.with_mysqlxpb_cext:
mysql_version = "N/A"
compiler = (
self.compiler.compiler_so[0]
if hasattr(self.compiler, "compiler_so")
else None
)
write_info_bin(mysql_version, compiler)