From 0c8b2b61c0807ac0aa10166d25749a0b457859f4 Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Sun, 3 Jan 2021 06:59:39 +0100 Subject: [PATCH] Prepare 2.4.2 release with an installation failure on Python 2.7 fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses a failure when trying to install the package for Python 2.7. Collecting pygtrie ⋮ Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-LyKc02/pygtrie/setup.py", line 177, in distutils.core.setup(**kwargs) ⋮ File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj cmd_obj = self.command_obj[command] = klass(self) TypeError: object() takes no parameters Developers who still use Python 2.7 are urged to migrate to Python 3.x. 2.7 is officially dead and at some point I’ll stop caring about bugs reported on that version of the language. Fixes: https://github.com/google/pygtrie/issues/33 --- setup.py | 8 +++++--- version-history.rst | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b4b91ca..dbc5946 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def run(self): shutil.rmtree(outdir) -class CommandMixin(object): +class CommandMixin: @classmethod def _read_and_stat(cls, src): from distutils.errors import DistutilsFileError @@ -75,8 +75,10 @@ def copy_file(self, src, dst, preserve_mode=1, preserve_times=1, link=None, data, re.MULTILINE) if not m: - return super(CommandMixin, self).copy_file( - src, dst, preserve_mode=preserve_mode, + # Not using super() for better Python 2.x compatibility (distutils + # uses old-style classes). + return distutils.core.Command.copy_file( + self, src, dst, preserve_mode=preserve_mode, preserve_times=preserve_times, link=link) if os.path.isdir(dst): diff --git a/version-history.rst b/version-history.rst index eae2b57..7a38a85 100644 --- a/version-history.rst +++ b/version-history.rst @@ -1,10 +1,17 @@ Version History --------------- +2.4.2: 2021/01/03 + +- Remove use of ‘super’ in ``setup.py`` to fix compatibility with + Python 2.7. This changes build code only; no changes to the library + itself. + 2.4.1: 2020/11/20 - Remove dependency on ``packaging`` module from ``setup.py`` to fix - installation on systems without that package. [Thanks to Eric + installation on systems without that package. This changes build + code only; no changes to the library itself. [Thanks to Eric McLachlan for reporting] 2.4.0: 2020/11/19 [pulled back from PyPi]