From 9acf2b5cda2bc11d3bd558625892c3ab64332bd8 Mon Sep 17 00:00:00 2001
From: David Anderson <dvander@alliedmods.net>
Date: Wed, 19 Aug 2020 00:39:54 -0700
Subject: [PATCH] Use Python 3.8 on the Windows buildbot.

---
 AMBuildScript                | 6 ++++++
 tools/buildbot/bootstrap.pl  | 2 +-
 tools/buildbot/startbuild.pl | 6 +++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/AMBuildScript b/AMBuildScript
index 95bc6813..fa6600d5 100644
--- a/AMBuildScript
+++ b/AMBuildScript
@@ -667,6 +667,12 @@ class SMConfig(object):
     self.ConfigureForExtension(context, binary.compiler)
     return binary
 
+if getattr(builder, 'target', None) is not None:
+    sys.stderr.write("Your output folder was configured for AMBuild 2.1, and SourceMod is now\n")
+    sys.stderr.write("configured to use AMBuild 2.2. Please remove your output folder and\n")
+    sys.stderr.write("reconfigure to continue.\n")
+    os._exit(1)
+
 SM = SMConfig()
 SM.detectProductVersion()
 SM.detectSDKs()
diff --git a/tools/buildbot/bootstrap.pl b/tools/buildbot/bootstrap.pl
index d0372f21..9c93406e 100755
--- a/tools/buildbot/bootstrap.pl
+++ b/tools/buildbot/bootstrap.pl
@@ -74,7 +74,7 @@ if ($argn > 0 && $^O !~ /MSWin/) {
 	$result = `CC=$ARGV[0] CXX=$ARGV[1] python ../build/configure.py $conf_args`;
 } else {
 	if ($^O =~ /MSWin/) {
-		$result = `C:\\Python27\\Python.exe ..\\build\\configure.py $conf_args`;
+		$result = `C:\\Python38\\Python.exe ..\\build\\configure.py $conf_args`;
 	} else {
 		$result = `CC=clang CXX=clang python ../build/configure.py $conf_args`;
 	}
diff --git a/tools/buildbot/startbuild.pl b/tools/buildbot/startbuild.pl
index 3e4bf3b5..1964193b 100755
--- a/tools/buildbot/startbuild.pl
+++ b/tools/buildbot/startbuild.pl
@@ -16,7 +16,11 @@ if ($argn > 0) {
 	$ENV{CXX} = $ARGV[1];
 }
 
-system("ambuild --no-color 2>&1");
+if ($^O !~ /MSWin/) {
+	system("ambuild --no-color 2>&1");
+} else {
+	system("C:\\Python38\\scripts\\ambuild --no-color 2>&1");
+}
 
 if ($? != 0)
 {