alecthomas / importmagic

A Python library for finding unresolved symbols in Python code, and the corresponding imports
BSD 2-Clause "Simplified" License
120 stars 20 forks source link

Installation failing on Python 2.6 #35

Closed sonictk closed 8 years ago

sonictk commented 8 years ago

Hi:

For work reasons, we are locked to Python 2.6 here at work. When trying to install importmagic, I get the following error:

Collecting importmagic
  Using cached importmagic-0.1.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-U3vJv4/importmagic/setup.py", line 5, in <module>
        import importmagic
      File "./importmagic/__init__.py", line 10, in <module>
        from importmagic.index import SymbolIndex
      File "./importmagic/index.py", line 34, in <module>
        _PYTHON_VERSION = 'python{}.{}'.format(sys.version_info.major, sys.version_info.minor)
    AttributeError: 'tuple' object has no attribute 'major'

Would it be possible to edit sys.version_info.major to be sys.version_info[0](and sys.version_info.minor as well, respectively) in order to support Python 2.6 backwards compatibility?

alecthomas commented 8 years ago

Have you tried changing it and seeing if the rest of importmagic works?

If that's the only change required, I don't really have a problem with it.