From 3ca34171a99e4329c30da9a85f42840ecc7825ed Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Oct 21 2024 11:52:11 +0000
Subject: [PATCH 1/2] fix unittest without /usr/bin/python on newer os


---

diff --git a/devtools/check-api b/devtools/check-api
index 2b442de..d185358 100755
--- a/devtools/check-api
+++ b/devtools/check-api
@@ -1,11 +1,10 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 import inspect
 import json
 import os
 import os.path
 import subprocess
 import sys
-
 from collections import OrderedDict
 
 # import koji code from our checkout
@@ -18,7 +17,7 @@ sys.path.insert(0, kojitop)
 
 setup = kojitop + '/setup.py'
 try:
-    proc = subprocess.Popen(['python', setup, '--version'], stdout=subprocess.PIPE)
+    proc = subprocess.Popen([sys.executable, setup, '--version'], stdout=subprocess.PIPE)
     (out, _) = proc.communicate()
     VERSTR = out.decode().strip()
     VERSION = tuple([int(x) for x in VERSTR.split('.')])
@@ -30,10 +29,10 @@ except Exception:
 
 import koji
 import koji.arch
+import koji.plugin
+import koji.tasks
 import koji.util
 import koji.xmlrpcplus
-import koji.tasks
-import koji.plugin
 
 if VERSION >= (1, 32, 0):
     from kojihub import kojixmlrpc

From 5413ff5c12e079557b69a92840b120fbd6fae4d4 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Oct 21 2024 11:52:11 +0000
Subject: [PATCH 2/2] setuptools is required by devtools/check-api (py3)


---

diff --git a/devtools/containers/Dockerfile.centos8 b/devtools/containers/Dockerfile.centos8
index 5962967..4c43ac7 100644
--- a/devtools/containers/Dockerfile.centos8
+++ b/devtools/containers/Dockerfile.centos8
@@ -10,6 +10,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.centos9 b/devtools/containers/Dockerfile.centos9
index 7135a64..7faa988 100644
--- a/devtools/containers/Dockerfile.centos9
+++ b/devtools/containers/Dockerfile.centos9
@@ -10,6 +10,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f34 b/devtools/containers/Dockerfile.f34
index de76eb3..ce9b7b6 100644
--- a/devtools/containers/Dockerfile.f34
+++ b/devtools/containers/Dockerfile.f34
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f35 b/devtools/containers/Dockerfile.f35
index c12171c..b16e937 100644
--- a/devtools/containers/Dockerfile.f35
+++ b/devtools/containers/Dockerfile.f35
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f36 b/devtools/containers/Dockerfile.f36
index 0e6e8d4..93b5e84 100644
--- a/devtools/containers/Dockerfile.f36
+++ b/devtools/containers/Dockerfile.f36
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f37 b/devtools/containers/Dockerfile.f37
index 8884937..75d8b81 100644
--- a/devtools/containers/Dockerfile.f37
+++ b/devtools/containers/Dockerfile.f37
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f38 b/devtools/containers/Dockerfile.f38
index 580d5a7..b241903 100644
--- a/devtools/containers/Dockerfile.f38
+++ b/devtools/containers/Dockerfile.f38
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.f39 b/devtools/containers/Dockerfile.f39
index fdd84c7..7ecb136 100644
--- a/devtools/containers/Dockerfile.f39
+++ b/devtools/containers/Dockerfile.f39
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/devtools/containers/Dockerfile.rawhide b/devtools/containers/Dockerfile.rawhide
index 3f907c6..ee5fa76 100644
--- a/devtools/containers/Dockerfile.rawhide
+++ b/devtools/containers/Dockerfile.rawhide
@@ -8,6 +8,7 @@ RUN \
   python3-defusedxml \
   python3-devel \
   python3-librepo \
+  python3-setuptools \
   python3-tox \
   rpm-build && \
   dnf clean all
diff --git a/test-requirements.txt b/test-requirements.txt
index 62ebc50..91ed887 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -11,3 +11,4 @@ Cheetah3
 psycopg2-binary
 python-multilib
 python-qpid-proton
+setuptools

