# fix python3 detection. python2 is ignored even if installed.

Index: scconfig/src/scripts/find_python.c
--- scconfig/src/scripts/find_python.c.orig
+++ scconfig/src/scripts/find_python.c
@@ -46,10 +46,10 @@ static int find_script_python_(const char *name, int l
 		NL "print ('-I' + distutils.sysconfig.get_python_inc().replace('\\\\','/'))"
 		NL;
 	char *lib_py =
-		NL "import distutils.sysconfig;"
-		NL "print ('-L' + distutils.sysconfig.PREFIX.replace('\\\\','/') + '/libs')"
+		NL "import sysconfig;"
+		NL "print ('-L' + sysconfig.get_config_var('LIBDIR'))"
 		NL "import sys;"
-		NL "print ('-lpython' + str(sys.version_info[0]) + str(sys.version_info[1]))"
+		NL "print ('-lpython' + str(sys.version_info[0]) + '.' + str(sys.version_info[1]))"
 		NL;
 
 
@@ -75,8 +75,8 @@ static int find_script_python_(const char *name, int l
 	if (try_icl(logdepth, nodedir, test_c, NULL, NULL, "-lpython")) return 0;
 
 	/* Ask python using the python executables on path; use + so both runs and can free out of both */
-	if (run_script(logdepth, "python", inc_py, ".py", &cflags) + run_script(logdepth, "python", lib_py, ".py", &ldflags) == 0)
-		res = try_icl(logdepth, nodedir, test_c, NULL, strip(cflags), strip(ldflags));
+	if (run_script(logdepth, "/usr/local/bin/python3", inc_py, ".py", &cflags) + run_script(logdepth, "/usr/local/bin/python3", lib_py, ".py", &ldflags) == 0)
+    		res = try_icl(logdepth, nodedir, test_c, NULL, strip(cflags), strip(ldflags));
 	else
 		res = 0;
 
