From 02dc442fa09893f93046fa96d127e3429b7ae39e Mon Sep 17 00:00:00 2001
From: Sandro Tosi <morph@debian.org>
Date: Fri, 13 Mar 2020 13:36:42 -0400
Subject: [PATCH] Drop python2 support; Closes: #937942

---
 debian/changelog                              |  6 +++++
 debian/control                                | 27 ++-----------------
 debian/python-netaddr.lintian-overrides       |  2 --
 ...addr.manpages => python3-netaddr.manpages} |  0
 debian/rules                                  | 13 +++++----
 5 files changed, 14 insertions(+), 34 deletions(-)
 delete mode 100644 debian/python-netaddr.lintian-overrides
 rename debian/{python-netaddr.manpages => python3-netaddr.manpages} (100%)

diff --git a/debian/changelog b/debian/changelog
index 663930f..a9b578c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+python-netaddr (0.7.19-4) UNRELEASED; urgency=medium
+
+  * Drop python2 support; Closes: #937942
+
+ -- Sandro Tosi <morph@debian.org>  Fri, 13 Mar 2020 13:16:23 -0400
+
 python-netaddr (0.7.19-3) unstable; urgency=medium
 
   * d/control: build-depends on python-all. Closes: #950362.
diff --git a/debian/control b/debian/control
index ea1a7b4..d15c067 100644
--- a/debian/control
+++ b/debian/control
@@ -8,9 +8,6 @@ Build-Depends: debhelper-compat (= 9),
                ieee-data,
                localehelper,
                dh-python,
-               python-all (>= 2.6.5),
-               python-pytest,
-               python-setuptools (>= 0.6b3),
                python3-sphinx (>= 1.0.7+dfsg),
                python3-all (>= 3.2),
                python3-pytest,
@@ -19,32 +16,12 @@ Homepage: https://github.com/drkjam/netaddr/
 Vcs-Git: https://salsa.debian.org/python-team/modules/python-netaddr.git
 Vcs-Browser: https://salsa.debian.org/python-team/modules/python-netaddr
 
-Package: python-netaddr
-Architecture: all
-Depends: ieee-data, ${misc:Depends}, ${python:Depends}
-Suggests: ipython, python-netaddr-docs
-Description: manipulation of various common network address notations (Python 2)
- netaddr is a Python library for the manipulation of various common
- network address notations and representations.
- .
- It takes the hassle out of fiddling with enumerable variations of
- network addresses presenting a consistent, extensible, easy-to-use
- and (above all) Pythonic API.
- .
- With it you can validate, convert, categorise, iterate, generate,
- slice (and dice):
-  - MAC (Media Access Control)
-  - IEEE EUI-48 and EUI-64
-  - IP version 4
-  - IP version 6
-  - CIDR (Classless Inter-Domain Routing)
- .
- This is the Python 2 version of the package.
-
 Package: python3-netaddr
 Architecture: all
 Depends: ieee-data, ${misc:Depends}, ${python3:Depends}
 Suggests: ipython3, python-netaddr-docs
+Conflicts: python-netaddr (<< 0.7.19-4)
+Replaces: python-netaddr (<< 0.7.19-4)
 Description: manipulation of various common network address notations (Python 3)
  netaddr is a Python library for the manipulation of various common
  network address notations and representations.
diff --git a/debian/python-netaddr.lintian-overrides b/debian/python-netaddr.lintian-overrides
deleted file mode 100644
index 5eac6a3..0000000
--- a/debian/python-netaddr.lintian-overrides
+++ /dev/null
@@ -1,2 +0,0 @@
-python-netaddr: package-install-ieee-data usr/lib/python2.7/dist-packages/netaddr/eui/iab.idx
-python-netaddr: package-install-ieee-data usr/lib/python2.7/dist-packages/netaddr/eui/oui.idx
diff --git a/debian/python-netaddr.manpages b/debian/python3-netaddr.manpages
similarity index 100%
rename from debian/python-netaddr.manpages
rename to debian/python3-netaddr.manpages
diff --git a/debian/rules b/debian/rules
index 69a63d2..5179867 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,22 +5,18 @@ export PYBUILD_NAME=netaddr
 export LC_ALL=C.UTF-8
 
 %:
-	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
+	dh $@ --with python3,sphinxdoc --buildsystem=pybuild
 
 override_dh_installdocs:
 	dh_installdocs
 	PYTHONPATH=. python3 -m sphinx -N -q -E -b html docs/source/ \
 		debian/python-netaddr-docs/usr/share/doc/python-netaddr-docs/api/
 
-override_dh_install:
-	dh_install
-	rm -rf debian/python3-netaddr/usr/bin
-
 # Replace EUI files with the appropriate symlinks
-override_dh_link: dh_link/python-netaddr dh_link/python3-netaddr
+override_dh_link: dh_link/python3-netaddr
 	dh_link
 python_module_path=usr/lib/python*/dist-packages
-dh_link/python-netaddr dh_link/python3-netaddr:
+dh_link/python3-netaddr:
 	rm debian/$(@:dh_link/%=%)/$(python_module_path)/netaddr/eui/iab.*
 	rm debian/$(@:dh_link/%=%)/$(python_module_path)/netaddr/eui/oui.*
 	ln -s /var/lib/ieee-data/oui.txt debian/$(@:dh_link/%=%)/$(python_module_path)/netaddr/eui/
@@ -28,6 +24,9 @@ dh_link/python-netaddr dh_link/python3-netaddr:
 	PYTHONPATH=$(CURDIR) python3 \
 		debian/$(@:dh_link/%=%)/$(python_module_path)/netaddr/eui/ieee.py
 
+override_dh_python3:
+	dh_python3 --shebang=/usr/bin/python3
+
 # Tests
 override_dh_auto_test:
 	localehelper LANG=en_US.UTF-8 dh_auto_test -- \
-- 
GitLab