Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2017 14:36:12 +1000
From:      Kubilay Kocak <koobs@FreeBSD.org>
To:        Hongjiang Zhang <honzhan@microsoft.com>, "freebsd-ports@freebsd.org" <freebsd-ports@freebsd.org>, python <python@FreeBSD.org>
Subject:   Re: How to call easy_install argparse after installation
Message-ID:  <5f5c6c42-19c2-6ffe-cbd8-c6f2e7e5450d@FreeBSD.org>
In-Reply-To: <HK2P15301MB000356BC44C1046831EDE9A5B5130@HK2P15301MB0003.APCP153.PROD.OUTLOOK.COM>
References:  <HK2P15301MB000356BC44C1046831EDE9A5B5130@HK2P15301MB0003.APCP153.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4/28/17 7:06 PM, Hongjiang Zhang via freebsd-ports wrote:
> Hi all,
> 
> I'm trying to create a new ports app, which is a python application
> and depends on argparse. For python 2.7, argparse is builtin. 
> Unfortunately, when the app is starting, it complains:
> 
> pkg_resources.DistributionNotFound: The 'argparse' distribution was
> not found and is required by XXX
> 
> According to the argparse document, the fix is one of the followings.
> My question is how can I invoke "easy_install argparse" in my
> Makefile? By the way, argparse has already been removed from ports.
> 
> 1.  python setup.py install 2.  easy_install argparse 3.  pip install
> argparse 4.  putting argparse.py in some directory listed in sys.path
> should also work

Hi Hongjiang,

If the application or its author(s) need or want to maintain Python 2.6,
3.0, 3.1, 3.2 compatibility, the application needs to be fixed
(upstream) to only add the install_requires=['argparse'] dependency (in
setup.py) for versions ( < 2.7 OR ( > 3 AND < 3.2)). ie; only those
Python versions that *don't* contain argparse in their standard library.

In no cases should a FreeBSD port/package call easy_install, pip or
other respective setuptools/distutils functionality itself.

What I would try instead is to remove (patch out) the unconditional
install_requires=['argparse'] entry from setup.py, and test the
application functionality without it, as import argparse should "just
work" whether using the standard library or the package, and in
FreeBSD's case for all supported Python versions, argparse is available
built-in.

./koobs



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5f5c6c42-19c2-6ffe-cbd8-c6f2e7e5450d>