From owner-freebsd-python@freebsd.org Sun Apr 30 04:40:14 2017 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 348CCD561E6 for ; Sun, 30 Apr 2017 04:40:14 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 0EF03EAE for ; Sun, 30 Apr 2017 04:40:14 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 0E4CBD561E4; Sun, 30 Apr 2017 04:40:14 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BEEAD561E1; Sun, 30 Apr 2017 04:40:14 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D667CEAD; Sun, 30 Apr 2017 04:40:13 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf0-x241.google.com with SMTP id b23so7571216pfc.0; Sat, 29 Apr 2017 21:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=405xeTnP/i65hM+NLi5Tii9a9ZuTVinMXGSIj4FhnW8=; b=aYgNKFEhPG7Bol2YS6an5wtWSgxRgxF25q+TGk7xEvqE9orDqQTFy9TlXQ3OZm0/od /1O6WpNd45xlvbat7qVw8i/OdqYr9akVTP92Rjh4HFrhgvHyV+ZvG9WdbnjnAz1mEXRV VGJKecuKZQFoLpVS/TMsJY3cvSkbFy/gsTLMfib1P1a9pKk41LgnVeAFbr2YwBiktyBo Fm+5EdsOQEXk5hJ6vuMNML2Jcxzpu2W1ovWpbDKDLKizcSZ8a/1IQk4qM3EAAjScgM1f 1dH86FLEpjBYuGrAA3cFZJwq3TZQxOkIWnJ9KYABIMe5CkTYQNNf+3YrbqM6XhOWpcGr OUoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=405xeTnP/i65hM+NLi5Tii9a9ZuTVinMXGSIj4FhnW8=; b=Uugzc2NAw9wR134mXBZ7ckcLuAty0wqZkUuzM8DcGLtWfj9QSrYolWJAe/AbXg0vd8 SGaG4i8jusW8xHl20bdMwXz7nzw7/YfBlDD+ezWnvQGPMP9FtLbb+EUt09r1BQzPvMpK E69HLeNqxQFhYNxj5+YuZvPD1GJ1O3b/5vfGDq0e9Y+frbvVjh+qIWfWcsgzkBrtQewi LuUvdhnl+CAr8eyngr1E4c4c7GqfXiIQ8qjBUuuY2mVZitmc6eTVA3RfDruOHndirlea QZllQeQ6I3tgJDMmpn9TuyvS9pAwJo77esAEKHBX7j/sU9ndUKMx8BiGnOR7HCvFKj90 F3LA== X-Gm-Message-State: AN3rC/7AZMKjL2xO5x6GNyXZq3pvOjcMuAFYklBPk7HiLhOWotOPAvm5 F3GRNraiqvIGfRsExcM= X-Received: by 10.84.168.131 with SMTP id f3mr25956926plb.160.1493527213047; Sat, 29 Apr 2017 21:40:13 -0700 (PDT) Received: from ?IPv6:2001:44b8:31ae:7b01:2042:3e8:d7ce:9b9c? (2001-44b8-31ae-7b01-2042-03e8-d7ce-9b9c.static.ipv6.internode.on.net. [2001:44b8:31ae:7b01:2042:3e8:d7ce:9b9c]) by smtp.gmail.com with ESMTPSA id x5sm17299412pfd.94.2017.04.29.21.40.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Apr 2017 21:40:12 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: How to call easy_install argparse after installation To: Hongjiang Zhang , "freebsd-ports@freebsd.org" , python References: From: Kubilay Kocak Message-ID: <5f5c6c42-19c2-6ffe-cbd8-c6f2e7e5450d@FreeBSD.org> Date: Sun, 30 Apr 2017 14:36:12 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:54.0) Gecko/20100101 Thunderbird/54.0a2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2017 04:40:14 -0000 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