From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Enge Subject: Re: Python and propagation Date: Thu, 18 Feb 2016 15:28:23 +0100 Message-ID: <20160218142823.GA1618@solar> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWPZI-0002hX-4v for guix-devel@gnu.org; Thu, 18 Feb 2016 09:28:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWPZD-0006N3-VY for guix-devel@gnu.org; Thu, 18 Feb 2016 09:28:32 -0500 Received: from mailrelay2.public.one.com ([91.198.169.125]:20717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWPZD-0006Mq-JV for guix-devel@gnu.org; Thu, 18 Feb 2016 09:28:27 -0500 Content-Disposition: inline In-Reply-To: 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-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel 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