guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 1/4] build/python-build-system: Fix easy-install.pth collisio


From: Federico Beffa
Subject: Re: [PATCH 1/4] build/python-build-system: Fix easy-install.pth collisions.
Date: Mon, 15 Dec 2014 21:36:27 +0100

On Sun, Dec 14, 2014 at 9:28 PM, Ludovic Courtès <address@hidden> wrote:
>> +(define* (fix-pth #:key name inputs outputs #:allow-other-keys)
>
> What about calling it ‘rename-pth-file’, which should be more
> descriptive?  Also please add a docstring.

Agreed.

>> +  (let* ((out (assoc-ref outputs "out"))
>> +         (python (assoc-ref inputs "python"))
>> +         (site-packages (string-append out "/lib/python"
>> +                                       (get-python-version python)
>> +                                       "/site-packages"))
>> +         (easy-install-pth (string-append site-packages 
>> "/easy-install.pth"))
>> +         (new-pth (string-append site-packages "/" name ".pth")))
>> +    (if (file-exists? easy-install-pth)
>> +        (rename-file easy-install-pth new-pth))))
>
> Please use ‘when’ instead of ‘if’, and add a trailing #t, to make it
> clear that the phase succeeds.

OK

> Is PACKAGE.pth a common convention?  I mean, does Python (or
> setuptools?) actually use files called PYTHON.pth?

Yes, the basename of path configuration files with extension .pth does
not matter. The site module will load them all. Setuptools, on top of
easy-install.pth, installs a site.py file. This program adds (with
site.addsitedir) all directories in PYTHONPATH to the list of
directories to be processed by the site module.

https://docs.python.org/2/library/site.html

Before writing the path I had conflicts, e.g., between matplotlib and
cairocffi resulting in import failures. After the patch they work
nicely together.

Using NAME.pth  instead of easy-install.pth should guarantee that no
package configuration file collisions occurs between different
packages installed with setuptools, nor between two versions of the
same library.

Attached the amended patch.
Regards,
Fede

Attachment: 0001-build-python-build-system-Fix-easy-install.pth-colli.patch
Description: Text Data


reply via email to

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