From 0ee32b7618e3cdfb864cdaeeef388a4f3b8a4ff6 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sat, 4 Apr 2020 20:14:53 -0400
Subject: [PATCH] Remove Python 2 support from dnfdaemon

Python 2 is dead in Fedora and other Linux distributions as Python 2
is now EOL per the CPython developers.

Thus, we no longer will support Python 2 dnfdaemon clients.

Reference: https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
---
 Makefile                         |  4 ++--
 dnfdaemon.spec                   | 19 -------------------
 python/dnfdaemon/Makefile        |  7 -------
 python/dnfdaemon/client/Makefile |  7 -------
 4 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/Makefile b/Makefile
index bb96c2b..8d0eedf 100644
--- a/Makefile
+++ b/Makefile
@@ -87,10 +87,10 @@ run-tests-unit: FORCE
 	@PYTHONPATH=$(TESTLIBS) nosetests-$(PYVER3) -v -s test/test_common.py
 
 instdeps:
-	sudo dnf install python2-nose python3-gobject pygobject3 python3-nose
+	sudo dnf install python3-gobject pygobject3 python3-nose
 
 get-builddeps:
-	sudo dnf install perl-TimeDate gettext intltool rpmdevtools python2-devel python3-devel python3-nose tito
+	sudo dnf install perl-TimeDate gettext intltool rpmdevtools python3-devel python3-nose tito
 	
 
 build-setup:
diff --git a/dnfdaemon.spec b/dnfdaemon.spec
index 92e72e2..bcb1b29 100644
--- a/dnfdaemon.spec
+++ b/dnfdaemon.spec
@@ -65,22 +65,6 @@ Metapackage customizing the SELinux policy to ensure dnfdaemon works with
 SELinux enabled in enforcing mode.
 
 
-%package -n python2-%{name}
-Summary:        Python 2 API for communicating with %{name}
-
-BuildRequires:  python2-devel
-Requires:       %{name} = %{version}-%{release}
-%if 0%{?mageia}
-Requires:       python-gobject3
-%else
-Requires:       python-gobject
-%endif
-%{?python_provide:%python_provide python2-%{name}}
-
-%description -n python2-%{name}
-Python 2 API for communicating with %{name}.
-
-
 %package -n python3-%{name}
 Summary:        Python 3 API for communicating with %{name}
 
@@ -124,9 +108,6 @@ make install DESTDIR=%{buildroot} DATADIR=%{_datadir} SYSCONFDIR=%{_sysconfdir}
 %files selinux
 # empty metapackage
 
-%files -n  python2-%{name}
-%{python2_sitelib}/%{name}/
-
 %files -n  python3-%{name}
 %{python3_sitelib}/%{name}/client
 
diff --git a/python/dnfdaemon/Makefile b/python/dnfdaemon/Makefile
index 15b22c7..7222514 100644
--- a/python/dnfdaemon/Makefile
+++ b/python/dnfdaemon/Makefile
@@ -1,11 +1,6 @@
-PYTHON2=python2
 PYTHON3=python3
 PACKAGE = dnfdaemon
 PYFILES = $(wildcard *.py)
-PYVER2 := $(shell $(PYTHON2) -c 'import sys; print("%.3s" %(sys.version))')
-PYSYSDIR2 := $(shell $(PYTHON2) -c 'import sys; print(sys.prefix)')
-PYLIBDIR2 = $(PYSYSDIR2)/lib/python$(PYVER2)
-PKGDIR2 = $(PYLIBDIR2)/site-packages/$(PACKAGE)
 PYVER3 := $(shell $(PYTHON3) -c 'import sys; print("%.3s" %(sys.version))')
 PYSYSDIR3 := $(shell $(PYTHON3) -c 'import sys; print(sys.prefix)')
 PYLIBDIR3 = $(PYSYSDIR3)/lib/python$(PYVER3)
@@ -19,9 +14,7 @@ clean:
 	
 
 install:
-	mkdir -p $(DESTDIR)/$(PKGDIR2)
 	mkdir -p $(DESTDIR)/$(PKGDIR3)
 	for p in $(PYFILES) ; do \
-		install -m 644 $$p $(DESTDIR)/$(PKGDIR2)/$$p; \
 		install -m 644 $$p $(DESTDIR)/$(PKGDIR3)/$$p; \
 	done
diff --git a/python/dnfdaemon/client/Makefile b/python/dnfdaemon/client/Makefile
index 7f01919..b4ea9ed 100644
--- a/python/dnfdaemon/client/Makefile
+++ b/python/dnfdaemon/client/Makefile
@@ -1,11 +1,6 @@
-PYTHON2=python2
 PYTHON3=python3
 PACKAGE = dnfdaemon/client
 PYFILES = $(wildcard *.py)
-PYVER2 := $(shell $(PYTHON2) -c 'import sys; print("%.3s" %(sys.version))')
-PYSYSDIR2 := $(shell $(PYTHON2) -c 'import sys; print(sys.prefix)')
-PYLIBDIR2 = $(PYSYSDIR2)/lib/python$(PYVER2)
-PKGDIR2 = $(PYLIBDIR2)/site-packages/$(PACKAGE)
 PYVER3 := $(shell $(PYTHON3) -c 'import sys; print("%.3s" %(sys.version))')
 PYSYSDIR3 := $(shell $(PYTHON3) -c 'import sys; print(sys.prefix)')
 PYLIBDIR3 = $(PYSYSDIR3)/lib/python$(PYVER3)
@@ -19,9 +14,7 @@ clean:
 	
 
 install:
-	mkdir -p $(DESTDIR)/$(PKGDIR2)
 	mkdir -p $(DESTDIR)/$(PKGDIR3)
 	for p in $(PYFILES) ; do \
-		install -m 644 $$p $(DESTDIR)/$(PKGDIR2)/$$p; \
 		install -m 644 $$p $(DESTDIR)/$(PKGDIR3)/$$p; \
 	done
-- 
GitLab