a8 icon indicating copy to clipboard operation
a8 copied to clipboard

setup.py requires 'argparse' package on py2.7 while it is a built-in module

Open dbarnett opened this issue 11 years ago • 1 comments

Reported by [email protected], Apr 7, 2013

The 'argparse' package has been merged into Python in Python 2.7. This means that Python has a built-in 'argparse' module and there is no real reason to install the external 'argparse' on top of that.

For that reason, we have dropped the external 'argparse' for Python 2.7 in Gentoo. Sadly, this means that a8 fails to start because of the 'install_requires' clause in setup.py:

$ a8
Traceback (most recent call last):
  File "/usr/bin/a8-python2.7", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 2803, in <module>
    working_set.require(__requires__)
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 697, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 595, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: argparse
$ python -c 'import argparse; print "Yay!"'
Yay!

For that reason, I'd like to request that 'argparse' is listed in package dependencies only when the external argparse is really necessary. That is, in Python 2.6 and older (and 3.0 + 3.1 if those versions are supported).

I'm attaching a patch doing that.

dbarnett avatar Jan 31 '14 23:01 dbarnett

a8-argparse-require-in-py2.7.patch: https://abominade.googlecode.com/issues/attachment?aid=260001000&name=a8-argparse-require-in-py2.7.patch&token=yyhVnmFoeneHf2ugZ6pelqLM13o%3A1391210418967

dbarnett avatar Jan 31 '14 23:01 dbarnett