[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] [python-apt] Remove references to Python 2



Hello,

I've used Debian derivatives for years but never submitted a patch before.  Might as well start somewhere :)

My understanding is `python-apt` is now Python 3.11+.  This patch removes references in docs and code to Python 2 or earlier versions of Python 3.

Regards,
Alex

---
 README.md                             | 1 -
 aptsources/distro.py                  | 4 ----
 doc/source/tutorials/contributing.rst | 4 ----
 setup.py                              | 2 +-
 4 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/README.md b/README.md
index a3ea8aa4..c8916631 100644
--- a/README.md
+++ b/README.md
@@ -46,4 +46,3 @@ To use the annotation with your source code, run:
 ```
 $ MYPYPATH=/usr/lib/python3/dist-packages/apt mypy ./my-program
 ```
-(adjust from python3 to python2.7 if you run there).
diff --git a/aptsources/distro.py b/aptsources/distro.py
index fea3b40e..8e70820e 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -163,10 +163,6 @@ class Distribution:
         fname = "/usr/share/xml/iso-codes/iso_3166.xml"
         if os.path.exists(fname):
             et = ElementTree(file=fname)
-            # python2.6 compat, the next two lines can get removed
-            # once we do not use py2.6 anymore
-            if getattr(et, "iter", None) is None:
-                et.iter = et.getiterator
             it = et.iter("iso_3166_entry")
             for elm in it:
                 try:
diff --git a/doc/source/tutorials/contributing.rst b/doc/source/tutorials/contributing.rst
index 33f16549..afd7d5fe 100644
--- a/doc/source/tutorials/contributing.rst
+++ b/doc/source/tutorials/contributing.rst
@@ -218,8 +218,6 @@ When writing code, use tools like pylint, pyflakes, pychecker and pycodestyle
 OK. Fix all the problems which seem reasonable, and mention the unfixed issues
 when asking for merge.
 
-All code must work on both Python 2 and Python 3.
-
 Submitting your patch
 ---------------------
 First of all, the patch you create should be based against the most current
@@ -235,7 +233,6 @@ Once you have made your change, check that it:
       can't fix them, but please tell so when requesting the merge, so it can
       be fixed before hitting one of the main branches).
     * does not change the behaviour of existing code in a non-compatible way.
-    * works on both Python 2 and Python 3.
 
 If your change follows all points of the checklist, you can commit it to your
 repository. (You could commit it first, and check later, and then commit the
@@ -301,7 +298,6 @@ package::
     user@pc:~/python-apt$ pycodestyle FILES # Check with pycodestyle
     user@pc:~/python-apt$ pylint -e FILES # Check with pylint
     user@pc:~/python-apt$ pyflakes FILES  # Check with pyflakes
-    user@pc:~/python-apt$ pychecker FILES # Check with pychecker
     user@pc:~/python-apt$ git commit -p
     user@pc:~/python-apt$ git format-patch origin/HEAD
     user@pc:~/python-apt$ reportbug --severity=wishlist --tag=patch --attach=<patch> ... python-apt
diff --git a/setup.py b/setup.py
index 9648d871..a9235ca2 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,4 @@
 #!/usr/bin/python3
-# Builds on python2.X and python3
 # $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $
 import glob
 import os
@@ -143,6 +142,7 @@ setup(
     name="python-apt",
     description="Python bindings for APT",
     version=get_version(),
+    python_requires='>3.11',
     author="APT Development Team",
     author_email="deity@lists.debian.org",
     ext_modules=[apt_pkg, apt_inst],
-- 
2.43.0


Reply to: