Force setuptools to be new enough

- setuptools_scm would like setuptools to be >= version 61 -- Install it
  before we process our requirements file so it's available to the
  setup process. Also add it to the requirements file, just in case.

Change-Id: I4e9ea19c9d19efa810563755b331680a0bae2452
diff --git a/python-requirements.txt b/python-requirements.txt
index c21675e..a7953de 100644
--- a/python-requirements.txt
+++ b/python-requirements.txt
@@ -74,3 +74,6 @@
 
 # Working version for CentOS 7
 urllib3==1.26.15
+
+setuptools==62
+setuptools_scm==8.1.0
diff --git a/sanitized_requirements.txt b/sanitized_requirements.txt
index 40012e2..8cbcd69 100644
--- a/sanitized_requirements.txt
+++ b/sanitized_requirements.txt
@@ -58,6 +58,8 @@
 PyYAML==6.0
 requests==2.31.0
 rich==12.5.1
+setuptools==62
+setuptools_scm==8.1.0
 simplesat==0.8.2
 six==1.16.0
 smmap==5.0.1
diff --git a/third_party/python/pip.bzl b/third_party/python/pip.bzl
index 32eb1c4..d077ff6 100644
--- a/third_party/python/pip.bzl
+++ b/third_party/python/pip.bzl
@@ -52,6 +52,25 @@
     if result.return_code:
         fail("pip_wheel failed: {} ({})".format(result.stdout, result.stderr))
 
+    # Install a modern-enough setuptools before the rest of our requirements.
+    args = [
+        rctx.path(rctx.attr.python_interpreter),
+        "-m",
+        "pip",
+        "install",
+        "-U",
+        "--ignore-installed",
+        "setuptools==62",
+    ]
+    rctx.report_progress("Installing the Python setuptools package")
+    result = rctx.execute(
+        args,
+        timeout = rctx.attr.timeout,
+        quiet = rctx.attr.quiet,
+    )
+    if result.return_code:
+        fail("pip_wheel failed: {} ({})".format(result.stdout, result.stderr))
+
     # Next, we download/build all the Python wheels for each requirement.
     args = [
         rctx.path(rctx.attr.python_interpreter),