Skip to content

Commit

Permalink
Prepare 2.4.2 release with an installation failure on Python 2.7 fix
Browse files Browse the repository at this point in the history
This addresses a failure when trying to install the package for
Python 2.7.

    Collecting pygtrie
    ⋮
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-LyKc02/pygtrie/setup.py", line 177, in <module>
        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: google#33
  • Loading branch information
mina86 committed Jan 3, 2021
1 parent 4f2476e commit 0c8b2b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
9 changes: 8 additions & 1 deletion version-history.rst
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 0c8b2b6

Please sign in to comment.