From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hartmut Goebel Subject: Re: Down with PYTHONPATH! Date: Sat, 15 Jun 2019 15:35:56 +0200 Message-ID: References: <87muikr3bq.fsf@mdc-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:43171) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hc8qi-0007FV-Cc for guix-devel@gnu.org; Sat, 15 Jun 2019 09:36:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hc8qg-0001KA-Bs for guix-devel@gnu.org; Sat, 15 Jun 2019 09:36:04 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:59227) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hc8qf-0001Ew-8i for guix-devel@gnu.org; Sat, 15 Jun 2019 09:36:02 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45Qz594m9sz1rBnV for ; Sat, 15 Jun 2019 15:35:57 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45Qz594gMzz1qqkh for ; Sat, 15 Jun 2019 15:35:57 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id EmS0GTqa3fLe for ; Sat, 15 Jun 2019 15:35:56 +0200 (CEST) Received: from hermia.goebel-consult.de (ppp-188-174-61-239.dynamic.mnet-online.de [188.174.61.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for ; Sat, 15 Jun 2019 15:35:56 +0200 (CEST) Received: from [192.168.110.2] (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id CEDAB60243 for ; Sat, 15 Jun 2019 15:36:17 +0200 (CEST) In-Reply-To: <87muikr3bq.fsf@mdc-berlin.de> Content-Language: en-US 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: guix-devel@gnu.org Am 14.06.19 um 10:14 schrieb Ricardo Wurmus: I welcome your initiative. Fixing this finally is on my todo-list since long. > here=E2=80=99s a half-baked idea that I think is worth considering: let= =E2=80=99s patch > our Python package to respect GUIX_PYTHONPATH and use GUIX_PYTHONPATH i= n > our wrappers. I have a *strong* opinion against this, as this would just replace one cludge by another one. See below for rational. IMO the only sustainable solution it to patch the interpreter (Modules/getpath.c) to determine the correct "installation path" (profile). I did quite some work on this last year, but had no time to finish it. I still have no time for finishing, but I should be able to hand-over my results (including prepared patches for Python 3.7). Rational for GUIX_PYTHONPATH being a cludge (IMHO) - Constraint: We must keep the expected behavior of PYTHONPATH as documented for CPython. This esp. means, we must not simply substitute in the source PYTHON_PATH by GUIX_PYTHONPATH, but need to *add* code. - When implementing GUIX_PYTHONPATH in site.py or site-cutomize.py, it will fail if python is run using -S (disable the import of the module site, and thus site-customize). - When implementing GUIX_PYTHONPATH in getpath.c, we need to copy the current code for PYTHONPATH, which means we will end up with a not so short patch. And even then, this special care needs to be taken to not leak GUIX_PYTHONPATH from one profile to the other. - We still need a wrapper (which caused a lot of problems, we already solve. But maybe other problem will arise). - If patching getpath.c anyway, we could go for interpreter to determine the correct "installation path" (see above). --=20 Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |