+ # Note: starting in Python 3.8 the --embed flag is required to get the
+ # -lpython3.8 linker flag
+ retcode, cmd_stdout = readCommandWithReturn(
+ [python_config, '--ldflags', '--embed'], exception='')
+ if retcode != 0:
+ # If --embed isn't detected then we're running python <3.8
+ retcode, cmd_stdout = readCommandWithReturn(
+ [python_config, '--ldflags'], exception='')
+
+ # Checking retcode again
+ if retcode != 0:
+ error("Failing on python-config --ldflags command")
+
+ py_ld_flags = cmd_stdout.split()
+