[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python and propagation
From: |
Andreas Enge |
Subject: |
Re: Python and propagation |
Date: |
Thu, 18 Feb 2016 15:28:23 +0100 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Thu, Feb 18, 2016 at 01:21:48PM +0100, Ricardo Wurmus wrote:
> 2) avoid PYTHONPATH, patch all Python files invasively!
> import sys
> sys.path.append("/gnu/store/cabba9e...-numpy.../lib/...")
That sounds great! It appears to me as if you have found the equivalent of
a RUNPATH for python scripts.
It could more or less be done like the patch-shebangs phase. To me it
does not look difficult to implement. Assume it is done in a separate
phase after patching shebangs:
- Create a list of all the python inputs of the package; these are the
inputs the package name of which starts with "python-". Or the directory
names "/gnu/store/xxx-python-xxx", depending on what is available in
the phase.
- Construct the corresponding string to add to the python scripts.
- Look for files starting with a shebang and having "python" as part
of the interpreter. Then add the string after the first, shebang line
in all these files.
Or is it more complicated than that?
Andreas