From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: Re: [PATCH 1/1] gnu: Add python-betamax. Date: Sun, 16 Oct 2016 21:22:06 +0100 Message-ID: <87shrwnixd.fsf@duckhunt.i-did-not-set--mail-host-address--so-tickle-me> References: <7303d3cdb0afa8e657039a476c4a13048ecb748e.1476638200.git.leo@famulari.name> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvrwj-00086S-Ju for guix-devel@gnu.org; Sun, 16 Oct 2016 16:22:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvrwg-00024W-Eo for guix-devel@gnu.org; Sun, 16 Oct 2016 16:22:13 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:43781) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bvrwg-00024M-9x for guix-devel@gnu.org; Sun, 16 Oct 2016 16:22:10 -0400 In-Reply-To: <7303d3cdb0afa8e657039a476c4a13048ecb748e.1476638200.git.leo@famulari.name> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari , guix-devel@gnu.org Leo Famulari writes: > This is a build time dependency of python-requests-toolbelt when using > Python 3.5. > > * gnu/packages/python.scm (python-betamax, python2-betamax): New variables. This LGTM, but I have a couple of off-topic remarks. The requests input/reference was a bit odd and seems to come from a python PTH [0] file that sets up the full path to the requests library: $ cat /gnu/store/q73wijsf2bapjwy47z5cl3jbq9rydmim-python-betamax-0.8.0/lib/python3.4/site-packages/python-betamax-0.8.0.pth import sys; sys.__plen = len(sys.path) ./betamax-0.8.0-py3.4.egg /gnu/store/4yxlmdi684axj11dxf0d905dfrjvaw3s-python-requests-2.9.1/lib/python3.4/site-packages/requests-2.9.1-py3.4.egg import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) I can load this from a pure environment: $ ./pre-inst-env guix environment --container --pure --ad-hoc python-betamax python [...] [env]# python3 -c 'import betamax' [env]# Doing the same when applied to wip-python-build-system results in: [env]# python3 -c 'import betamax' Traceback (most recent call last): File "", line 1, in File "/gnu/store/gs8jwja6d5k96l32v5psvxwzvwk61rll-profile/lib/python3.4/site-packages/betamax/__init__.py", line 13, in from .decorator import use_cassette File "/gnu/store/gs8jwja6d5k96l32v5psvxwzvwk61rll-profile/lib/python3.4/site-packages/betamax/decorator.py", line 4, in import requests ImportError: No module named 'requests' Can we leverage this mechanism instead of propagating everything? Are there any drawbacks to doing that? I'll have to do some more investigation around how those .pth files are created, but food for thought. Perhaps it only works with eggs? 0: https://docs.python.org/3/library/site.html