rocky/python-xdis

Cannot install under Python 2.7

pzelnip opened this issue · 1 comments

Description

Can no longer install under Python 2.7 even though the trove classifiers indicate this package is compatible with 2.7.

How to Reproduce

$ docker run -it --rm python:2.7-slim-buster /bin/bash

root@76ae375f4fb4:/# python2 -m pip install xdis
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting xdis
  Downloading xdis-5.0.13.tar.gz (293 kB)
     |████████████████████████████████| 293 kB 1.9 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9TfIIi/xdis/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9TfIIi/xdis/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-9TfIIi/xdis/pip-egg-info
         cwd: /tmp/pip-install-9TfIIi/xdis/
    Complete output (12 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-9TfIIi/xdis/setup.py", line 3, in <module>
        from xdis.version import __version__
      File "xdis/__init__.py", line 73, in <module>
        from xdis.load import (
      File "xdis/load.py", line 22, in <module>
        import xdis.unmarshal
      File "xdis/unmarshal.py", line 98
        def compat_str(s: str) -> str:
                        ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.3.4 is available.
You should consider upgrading via the '/usr/local/bin/python2 -m pip install --upgrade pip' command.
root@76ae375f4fb4:/# 

Expected behavior

It to install correctly.

Environment

Above I reproduced in a Python 2.7 docker image, specifically: python:2.7-slim-buster

Additional Environment or Context

It looks like there's a type annotation in unmarshal.py, which would make the code not compatible with anything pre-3.5 (I think?)

Note that I can install 5.0.12 successfully, but not 5.0.13 (same issue), so looks like it was introduced as part of 5.0.13

rocky commented

For xdis on 2.7, you should not install from source tarball, but from the 2.7 egg. The source tarball isn't on PyPI but it is a github release file https://github.com/rocky/python-xdis/releases/download/6.0.2/xdis_24-6.0.2.tar.gz

At some point I will probably also have a Python 2 wheel, but I don't have that right now.

Finally, I should mention that I did update README.rst to reflect all of this.

This reorganization alas had to be made at some point, and to support Python 3.10 there was enough upheaval the tip the scales.