guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/1] gnu: Add python-betamax.


From: Marius Bakke
Subject: Re: [PATCH 1/1] gnu: Add python-betamax.
Date: Sun, 16 Oct 2016 21:22:06 +0100

Leo Famulari <address@hidden> 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 "<string>", line 1, in <module>
  File 
"/gnu/store/gs8jwja6d5k96l32v5psvxwzvwk61rll-profile/lib/python3.4/site-packages/betamax/__init__.py",
 line 13, in <module>
    from .decorator import use_cassette
  File 
"/gnu/store/gs8jwja6d5k96l32v5psvxwzvwk61rll-profile/lib/python3.4/site-packages/betamax/decorator.py",
 line 4, in <module>
    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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]