From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 21 23:48:39 2021 Received: (at submit) by debbugs.gnu.org; 22 Jan 2021 04:48:39 +0000 Received: from localhost ([127.0.0.1]:59880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oND-0004PV-JJ for submit@debbugs.gnu.org; Thu, 21 Jan 2021 23:48:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:42198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oNB-0004PN-AJ for submit@debbugs.gnu.org; Thu, 21 Jan 2021 23:48:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2oNB-0000Z3-2N for guix-patches@gnu.org; Thu, 21 Jan 2021 23:48:37 -0500 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]:36528) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l2oN9-0001si-0k for guix-patches@gnu.org; Thu, 21 Jan 2021 23:48:36 -0500 Received: by mail-qt1-x834.google.com with SMTP id e17so3332592qto.3 for ; Thu, 21 Jan 2021 20:48:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kLYp3/rtUqbkTEoDvXKMZzOP2+Nf7lcUfkpHefjRgV4=; b=CAckXwjOmxLd58vUn7fNKMO4RwXxTFLMq7gjv/apsAZcmt5Ebie2rjCOJuEF7I81nP hnpDsokRxL3SbyAkbMu7C3/vznoFwG17OqBKnLEHOKXYx6nvBfKhNeCljamSnspueLMQ hdfboWNdfq6WWea/WgXf7GYI0hUxkBGWe08pkWlHXyOi4SfgUA1KadY+HlayVF7QN94L W2/BTH9xCPQvvzzbPYDF3c8qNyNg5j2uKBcS5zWCU19GjlbQ5rc1X8HAw4ODLCsyLGd7 R38HA6X452mldhy4r5noGVgXbxelP00kxk0xPM1+lBBaQwB9mX4NWPtUHN2WsM98YJlp dTDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kLYp3/rtUqbkTEoDvXKMZzOP2+Nf7lcUfkpHefjRgV4=; b=KjDJpo8lPwYHuqcWBZsr1Omjuiif7UBUJNcvA9LPMCFJYakQPrZRloThNr3sG7xSQX lJP1BAkJnNpnMKQUalpJSu8lElANhDJJEJYa9SVvGxG3ZzPaGLZTHItnq3FbRUILpK/G kytRrF8jLKJ5huIV30LeX/mGVWnKu3/AXGqbvPLs3LVx6rWhToPteBHYZQQWqM575wnQ 3ztAKkXw2uFQdHG47FtD8tcUck9QTyiUcfNV86oeieYyA/Fjwfp7UWJUg1pAzSWCN5YA 9/JmKniAkpIyz8XqQa2XFveT2V9iFFJtnVpKKJI6e924sfnR8HGlOCSRsqZ8nBou9XQb Fi8A== X-Gm-Message-State: AOAM530Dxe+aYqht5+cIKL3d1N6VsXLsAUizgAesAzVOZ3urhmQmxKU5 YXpKXKndei5h4Qej+McvLKYijfY2w70= X-Google-Smtp-Source: ABdhPJywiZm0srWy63UiD8msmtD0UNJ4IqFltQm8mGCbkOHjqmRidkL7fehTPF1h3XpmDOEY45/pOg== X-Received: by 2002:a05:622a:2c4:: with SMTP id a4mr2926683qtx.201.1611290913840; Thu, 21 Jan 2021 20:48:33 -0800 (PST) Received: from localhost.localdomain (dsl-152-143.b2b2c.ca. [66.158.152.143]) by smtp.gmail.com with ESMTPSA id j188sm1410484qke.67.2021.01.21.20.48.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 20:48:33 -0800 (PST) From: Maxim Cournoyer To: guix-patches@gnu.org Subject: [PATCH core-updates 0/2] Farewell to PYTHONPATH. Date: Thu, 21 Jan 2021 23:48:16 -0500 Message-Id: <20210122044816.30058-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x834.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Farewell to PYTHONPATH. Maxim Cournoyer (2): utils: Add a version-minor procedure. gnu: python: Replace PYTHONPATH by GUIX_PYTHONPATH_X_Y. gnu/packages/python.scm | 37 +++++++++++++++++++++++++++++++++---- guix/utils.scm | 15 ++++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) -- 2.29.2 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 21 23:51:24 2021 Received: (at 46028) by debbugs.gnu.org; 22 Jan 2021 04:51:24 +0000 Received: from localhost ([127.0.0.1]:59885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oPs-0004US-3F for submit@debbugs.gnu.org; Thu, 21 Jan 2021 23:51:24 -0500 Received: from mail-qt1-f172.google.com ([209.85.160.172]:41855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oPr-0004UE-6t for 46028@debbugs.gnu.org; Thu, 21 Jan 2021 23:51:23 -0500 Received: by mail-qt1-f172.google.com with SMTP id j26so3312590qtq.8 for <46028@debbugs.gnu.org>; Thu, 21 Jan 2021 20:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BnUvdc6F7dARSUrR/n00PIxJaMIUGiN35ztDYge8pag=; b=sdaEQ0n8HnNiPdT+8imHMxddgJ4bMNTWiEEa6lHVO5CMtoz+eAHl4yhvzCif++rr7N Y2nHH8mdMdClgMFqN0KwbaCcWqa0u+olvfC/dsF7c/5NHUtkyFUMeDJWy5V+j1ejEOFt dCCB9wr7/aZmhEhs4MkP3HYep6vT7LvZXRdlEt1/9fhaE+Tem3rg2p8hZJTtR0rcPJvF gfJo0SaBWMuFWuAmiqb7M6HEq3Y8Tu0OGkBAHNmhQBL99a8hJkBCAjA4Be2XTvdZchvE 1B3W1l+M7MxpL0iqW7jzx9duoJHr5zHZWQUm0uavexbj7roLJt/hM7xF5Wb7ybNpZ62c /SVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BnUvdc6F7dARSUrR/n00PIxJaMIUGiN35ztDYge8pag=; b=m7NLBQ8/MWixIS3lZEuvSAytt5RPuFRRf8IAILgNri3zVbiIYOBDPar8c6OSmPPulw lj7dcvI13td6cBov4RB2LFVl2RT0kCLfksttvSpLu9jLiYUSCBI7Wgv7lGD8Gqiarue6 Xyrn0SgFeJfYE5NDhFwYrCQ+fsAPR1MVd0rPTEkqZhY93sjnEGyhGG2bkxrldt7IJgbJ hzx7DzKWwnxBFoSUnilqBp/yI07zlK8MjIFKO9gKNq/hOp+25aNfX/ZLF2zBLzXpgr2Q gntCzp1EAUR8j2f77CvKGlEKOMG4CH7F2oRDjJKIerK/f1pIsBFWsrFjWguYGhmULzkV GatQ== X-Gm-Message-State: AOAM5328hMxHk+7oCCdmJxzBBQlBvx1HaIY3vDkQFITZzgzDbwED/C+r HSKiRFkA2Gfb6wn7fQ+I4j4caEJkgsM= X-Google-Smtp-Source: ABdhPJxiMBa2JLKH60R7QTj7Oh6PkfKBDUMUyWvhgWAVHpeJKqqR1IuMqDJS3X5VjEKPGu0LZLeQ/g== X-Received: by 2002:ac8:782:: with SMTP id l2mr2813930qth.271.1611291077360; Thu, 21 Jan 2021 20:51:17 -0800 (PST) Received: from localhost.localdomain (dsl-152-143.b2b2c.ca. [66.158.152.143]) by smtp.gmail.com with ESMTPSA id h8sm5162004qtm.5.2021.01.21.20.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 20:51:16 -0800 (PST) From: Maxim Cournoyer To: 46028@debbugs.gnu.org Subject: [PATCH core-updates 1/2] utils: Add a version-minor procedure. Date: Thu, 21 Jan 2021 23:51:03 -0500 Message-Id: <20210122045104.30229-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028 Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/utils.scm (version-components): New procedure. (version-prefix): Use it. (version-major): Likewise. (version-minor): New procedure. --- guix/utils.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/guix/utils.scm b/guix/utils.scm index 678954dbfa..cd4e595f7e 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -8,7 +8,7 @@ ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2018, 2020 Marius Bakke ;;; Copyright © 2020 Efraim Flashner -;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -93,6 +93,7 @@ version-major+minor+point version-major+minor version-major + version-minor guile-version>? version-prefix? string-replace-substring @@ -573,10 +574,14 @@ or '= when they denote equal versions." ((negative? result) '<) (else '=)))))) +(define (version-components version-string) + "Return the dot-separated version components as a list." + (string-split version-string #\.)) + (define (version-prefix version-string num-parts) "Truncate version-string to the first num-parts components of the version. For example, (version-prefix \"2.1.47.4.23\" 3) returns \"2.1.47\"" - (string-join (take (string-split version-string #\.) num-parts) ".")) + (string-join (take (version-components version-string) num-parts) ".")) (define (version-major+minor+point version-string) "Return \"major>..\", where major, minor and point are the @@ -595,7 +600,11 @@ minor version numbers from version-string." (define (version-major version-string) "Return the major version number as string from the version-string." - (version-prefix version-string 1)) + (first (version-components version-string))) + +(define (version-minor version-string) + "Return the minor version number as string from the version-string." + (second (version-components version-string))) (define (version>? a b) "Return #t when A denotes a version strictly newer than B." -- 2.29.2 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 21 23:51:27 2021 Received: (at 46028) by debbugs.gnu.org; 22 Jan 2021 04:51:27 +0000 Received: from localhost ([127.0.0.1]:59888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oPv-0004Uh-C7 for submit@debbugs.gnu.org; Thu, 21 Jan 2021 23:51:27 -0500 Received: from mail-qt1-f175.google.com ([209.85.160.175]:40816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2oPt-0004UH-Er for 46028@debbugs.gnu.org; Thu, 21 Jan 2021 23:51:25 -0500 Received: by mail-qt1-f175.google.com with SMTP id z22so3314434qto.7 for <46028@debbugs.gnu.org>; Thu, 21 Jan 2021 20:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DAKsMQUxZaW1nzVfX9e16+bw2XOIs+QM18RH8UFP5us=; b=dx+c4Aa6kMmmOT+O7r4sNYI4fuYDWwNFVbwESXXBe2KXZnFH7u4RNi3mcD492/HEiE soYTlTXM0sCXAlldT70bFyHk3Ml5waRH06X4LFWQJxuxud7sZITIlwm1PXEhPGpNUtHY kBSlhby0tiTM72ecV7pvGtJFyVS4jHY46ghW8LR75ENNn5hyH+VJ/5ESZuNrL+K0NUTu acFwOKVR995ot+B8m57ct48e+E1+xO39N/kECztXPMT83d/y0wzMqjue+b2Hb2SLAZWd 3Phe8Cfp2C3OpQ1yDpxgh5xWkVdfEfEWo6ADjOYWrbi2gl7yZzOsaUGZn135OZZjqQl7 T0Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DAKsMQUxZaW1nzVfX9e16+bw2XOIs+QM18RH8UFP5us=; b=ZKvkhUGEbjNWmXbB0ujMnHn/IdMU+rAldVPfdU+mFiaC7wnsCZ+XllHPhEowLKmZ/j bpBglONnhF9EfL5/I2IFVLOihFa0Xwzh24gQHwt/tZmCYMyma5Hq1hyqPden72rucneO Afde33UXPGi3KlZo20FmoB8WVzMeIMeM4O5t1KfzrjKVM4HFj5c3/Cv5WbSy4wZAXCif w9Z3wLoH0AkKsVT06LvNBCB/PCFaOytN0BjA965sOSokVNb9mqUPcivlL8hJYJNcROj5 Nv9wc0y3NMmjtL62OQRDH87tTYJd/v8IUL9PKMoiKOQGAw37viEupOZlQkG+A8VF7JNv TFEw== X-Gm-Message-State: AOAM532NheShAmuFlvCobv7fTOYXbq088+vpM8EyqCDaO2heoHy30gDg 1Za6M0iYpLtKBRxxhHPi1z2EpIH6I2c= X-Google-Smtp-Source: ABdhPJyTWvRGeXSx+wUFb1LPpOHSJD2U1NA9wiZrV1s5i4zha62levbFjdpLYsVLKXM5NgG9TsQTqw== X-Received: by 2002:ac8:2adb:: with SMTP id c27mr2921611qta.145.1611291079730; Thu, 21 Jan 2021 20:51:19 -0800 (PST) Received: from localhost.localdomain (dsl-152-143.b2b2c.ca. [66.158.152.143]) by smtp.gmail.com with ESMTPSA id h8sm5162004qtm.5.2021.01.21.20.51.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jan 2021 20:51:19 -0800 (PST) From: Maxim Cournoyer To: 46028@debbugs.gnu.org Subject: [PATCH core-updates 2/2] gnu: python: Replace PYTHONPATH by GUIX_PYTHONPATH_X_Y. Date: Thu, 21 Jan 2021 23:51:04 -0500 Message-Id: <20210122045104.30229-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210122045104.30229-1-maxim.cournoyer@gmail.com> References: <20210122045104.30229-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028 Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Using PYTHONPATH as a mean to discover the Python packages had the following issues: 1. It is not versioned, so different versions of Python would clash if installed in a shared profile. 2. It would interfere with the host Python site on foreign distributions, sometimes preventing a a user to login their GDM session (!). 3. It would take precedence over user installed Python packages installed through pip. 4. It would leak into Python virtualenvs, which are supposed to create isolated Python environments. This changes fixes the above issues by making use of a sitecustomize.py module. The newly introduced GUIX_PYTHONPATH_X_Y environment variable, where X is the major and Y the minor version numbers, is read from the environment and spliced in 'sys.path' just before Python's own site location, which provides the expected behavior. * gnu/packages/python.scm (python-2.7)[phases]{customize-site}: Add phase. [native-search-paths]: Modify so that GUIX_PYTHONPATH_X_Y is used. * gnu/packages/python.scm (python-3.9)[native-search-paths]: Likewise. --- gnu/packages/python.scm | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index d3df1a4dab..79cea3d43a 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -313,7 +313,30 @@ "/site-packages"))) (install-file tkinter.so target) (delete-file tkinter.so))))) - #t)))))) + #t))) + (add-after 'install 'customize-site + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (site-packages (string-append + out "/lib/python" + ,(version-major+minor version) + "/site-packages")) + (pythonpath (format #f "GUIX_PYTHONPATH_~a_~a" + ,(version-major version) + ,(version-minor version))) + (sitecustomize.py (string-append site-packages + "/sitecustomize.py"))) + (with-output-to-file sitecustomize.py + (lambda _ + (format #t "\ +import os +import sys + +# Insert the GUIX_PYTHONPATH_X_Y values just before Python's own site. +sys_path_absolute = [os.path.realpath(p) for p in sys.path] +index = sys_path_absolute.index(~s) +sys.path = sys.path[:index] + os.environ[~s].split(':') + sys.path[index:] +" site-packages pythonpath))))))))) (inputs `(("bzip2" ,bzip2) ("expat" ,expat) @@ -334,8 +357,12 @@ '()))) (native-search-paths (list (search-path-specification - (variable "PYTHONPATH") - (files '("lib/python2.7/site-packages"))))) + (variable (format #f "GUIX_PYTHONPATH_~a_~a" + (version-major version) + (version-minor version))) + (files (list (string-append "lib/python" + (version-major+minor version) + "/site-packages")))))) (home-page "https://www.python.org") (synopsis "High-level, dynamically-typed programming language") (description @@ -472,7 +499,9 @@ data types.") ,@(package-native-inputs python-2))) (native-search-paths (list (search-path-specification - (variable "PYTHONPATH") + (variable (format #f "GUIX_PYTHONPATH_~a_~a" + (version-major version) + (version-minor version))) (files (list (string-append "lib/python" (version-major+minor version) "/site-packages")))) -- 2.29.2 From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 22 08:19:22 2021 Received: (at 46028) by debbugs.gnu.org; 22 Jan 2021 13:19:23 +0000 Received: from localhost ([127.0.0.1]:60189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2wLS-0002RM-Ge for submit@debbugs.gnu.org; Fri, 22 Jan 2021 08:19:22 -0500 Received: from mail-qv1-f43.google.com ([209.85.219.43]:36724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l2wLP-0002R6-K9 for 46028@debbugs.gnu.org; Fri, 22 Jan 2021 08:19:21 -0500 Received: by mail-qv1-f43.google.com with SMTP id j18so2593647qvu.3 for <46028@debbugs.gnu.org>; Fri, 22 Jan 2021 05:19:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+7HUvB3DghWtR8jpiJZY+mvU+2vvErPx90cn1tQlCxQ=; b=IdvHrPGRzcUyaJZpTGrbnVdPED6v/OTTNM9v+ASeS+bmp4ggjbVw0dtLqGWHy6Ki7v 0KUjCDg6Iw0T4wG4xHrF14PaT25yiRNxzo6NomwJaPIhPYWkCSvl01sHvrOgfpaOZIG2 UACPDkAE0iSoclWX/YgsomxesVnDh/bEBNYUnChlfCb4alnL3b8cHeg6mXv+B5Vrk81h fIxMeIUWDkwbzQbsQwCUr+/Xmz91vIIK6kvD2b7r4mYPRg+DpBdaQfpOa9JlxMMhky9j zA4uQWcs6S/km/GtPMpd67jdgS6k80RObsKDT04/Q8KOSOTqJM++7/kNF0r4d7jQ0Ps6 dtrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+7HUvB3DghWtR8jpiJZY+mvU+2vvErPx90cn1tQlCxQ=; b=cYHe7MJojWEOBr3TcVcCve5msUriSqXJWaeT70970+LwjCRHV6PE5zc9cCD8UEyTNO KHE5QcQ4z+QxyuZaIMFxZfQijkE22JVgpSygg9CiWiQ9xkvnyvdhAD/VTL15i0JPxIw3 cLj2JPGnpArq+QEBSdE5N1SQ6wioDh/S8R+OwEwnDeJ9fULIx2kaXZzV9VrdbKKrafn9 mo+gFdADpvETQRqEMomLs6Hwi0/cd0JprhHhPweDJbLZG0uDJQuNu2VRXvQZ+vEpyIgE RCuyqlq3O22rBksBqRDvH83FvfKrYtc8jLN0QNS7O3+H4pGM8GpgmMOCDhKlx0Ku7SjN Gp8Q== X-Gm-Message-State: AOAM5323Rar6WyrFsvK/eHvTG5nyT+KoDkAiiu8FtsSvwndsMk+sPObW 6wJkf13lBJ4dlCEVCI3LomsMStU4Bw8= X-Google-Smtp-Source: ABdhPJyMkMhvT0M6ir48TPFiNJCKd78gU/sBWNTEeUI+3jeOvBn414EdeeN1PYjVPqE8tUwyYL/+LQ== X-Received: by 2002:ad4:452f:: with SMTP id l15mr4335148qvu.49.1611321553675; Fri, 22 Jan 2021 05:19:13 -0800 (PST) Received: from localhost.localdomain (dsl-152-143.b2b2c.ca. [66.158.152.143]) by smtp.gmail.com with ESMTPSA id u65sm6440485qkb.58.2021.01.22.05.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 05:19:12 -0800 (PST) From: Maxim Cournoyer To: 46028@debbugs.gnu.org Subject: [PATCH core-updates v2] gnu: python: Replace PYTHONPATH by GUIX_PYTHONPATH_X_Y. Date: Fri, 22 Jan 2021 08:18:58 -0500 Message-Id: <20210122131858.11206-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210122045104.30229-2-maxim.cournoyer@gmail.com> References: <20210122045104.30229-2-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028 Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Using PYTHONPATH as a mean to discover the Python packages had the following issues: 1. It is not versioned, so different versions of Python would clash if installed in a shared profile. 2. It would interfere with the host Python site on foreign distributions, sometimes preventing a a user to login their GDM session (!). 3. It would take precedence over user installed Python packages installed through pip. 4. It would leak into Python virtualenvs, which are supposed to create isolated Python environments. This changes fixes the above issues by making use of a sitecustomize.py module. The newly introduced GUIX_PYTHONPATH_X_Y environment variable, where X is the major and Y the minor version numbers, is read from the environment and spliced in 'sys.path' just before Python's own site location, which provides the expected behavior. * gnu/packages/python.scm (customize-site) (guix-pythonpath-search-path): New procedures. * gnu/packages/python.scm (python-2.7)[phases]{customize-site}: New phase. [native-search-paths]: Adjust. * gnu/packages/python.scm (python-3.9)[native-search-paths]: Likewise. [phases]{customize-site}: Override the inherited phase, so that it uses the correct version. * gnu/packages/commencement.scm (python-boot0) [phases]{customize-site}: Likewise. [native-search-paths]: Override the inherited one. --- gnu/packages/commencement.scm | 4 ++- gnu/packages/python.scm | 57 +++++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 0713bcb843..6d7593e223 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3176,6 +3176,7 @@ memoized as a function of '%current-system'." ;; built, since it requires Linux headers. (("'linux', ") "")))) (delete 'set-TZDIR) + (replace 'customize-site ,(customize-site version)) ,@(if (hurd-system?) `((add-before 'build 'fix-regen (lambda* (#:key inputs #:allow-other-keys) @@ -3184,7 +3185,8 @@ memoized as a function of '%current-system'." (("/usr/include/") (string-append libc "/include/"))))))) '()))) - ((#:tests? _ #f) #f)))))) + ((#:tests? _ #f) #f)))) + (native-search-paths (list (guix-pythonpath-search-path version))))) (define/system-dependent ld-wrapper-boot0 ;; The first 'ld' wrapper, defined with 'define/system-dependent' because diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index d3df1a4dab..c3453d63a9 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -102,7 +102,44 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (srfi srfi-1) - #:use-module (srfi srfi-26)) + #:use-module (srfi srfi-26) + #:export (customize-site + guix-pythonpath-search-path)) + +(define* (customize-site version) + "Generate a sitecustomize.py phase, using VERSION." + `(lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (site-packages (string-append + out "/lib/python" + ,(version-major+minor version) + "/site-packages")) + (pythonpath (format #f "GUIX_PYTHONPATH_~a_~a" + ,(version-major version) + ,(version-minor version))) + (sitecustomize.py (string-append site-packages + "/sitecustomize.py"))) + (with-output-to-file sitecustomize.py + (lambda _ + (format #t "\ +import os +import sys + +# Insert the GUIX_PYTHONPATH_X_Y values just before Python's own site. +sys_path_absolute = [os.path.realpath(p) for p in sys.path] +index = sys_path_absolute.index(~s) +sys.path = sys.path[:index] + os.environ[~s].split(':') + sys.path[index:] +" site-packages pythonpath)))))) + +(define (guix-pythonpath-search-path version) + "Generate a GUIX_PYTHONPATH_X_Y search path specification, using VERSION." + (search-path-specification + (variable (format #f "GUIX_PYTHONPATH_~a_~a" + (version-major version) + (version-minor version))) + (files (list (string-append "lib/python" + (version-major+minor version) + "/site-packages"))))) (define-public python-2.7 (package @@ -313,7 +350,9 @@ "/site-packages"))) (install-file tkinter.so target) (delete-file tkinter.so))))) - #t)))))) + #t))) + (add-after 'install 'customize-site + ,(customize-site version))))) (inputs `(("bzip2" ,bzip2) ("expat" ,expat) @@ -332,10 +371,7 @@ `(("python2" ,this-package) ("which" ,which)) '()))) - (native-search-paths - (list (search-path-specification - (variable "PYTHONPATH") - (files '("lib/python2.7/site-packages"))))) + (native-search-paths (list (guix-pythonpath-search-path version))) (home-page "https://www.python.org") (synopsis "High-level, dynamically-typed programming language") (description @@ -463,7 +499,8 @@ data types.") "-x" "lib2to3/.*" ,out)))) (list "none" "-O" "-OO")) - #t))))))) + #t))) + (replace 'customize-site ,(customize-site version)))))) (native-inputs `(("tzdata" ,tzdata-for-tests) ,@(if (%current-target-system) @@ -471,11 +508,7 @@ data types.") '()) ,@(package-native-inputs python-2))) (native-search-paths - (list (search-path-specification - (variable "PYTHONPATH") - (files (list (string-append "lib/python" - (version-major+minor version) - "/site-packages")))) + (list (guix-pythonpath-search-path version) ;; Used to locate tzdata by the zoneinfo module introduced in ;; Python 3.9. (search-path-specification -- 2.29.2 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 25 02:08:23 2021 Received: (at 46028) by debbugs.gnu.org; 25 Jan 2021 07:08:23 +0000 Received: from localhost ([127.0.0.1]:37764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3vz5-0005Bb-14 for submit@debbugs.gnu.org; Mon, 25 Jan 2021 02:08:23 -0500 Received: from mail-qv1-f42.google.com ([209.85.219.42]:43543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l3vz3-0005BM-Is for 46028@debbugs.gnu.org; Mon, 25 Jan 2021 02:08:21 -0500 Received: by mail-qv1-f42.google.com with SMTP id j13so408181qvu.10 for <46028@debbugs.gnu.org>; Sun, 24 Jan 2021 23:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=RxPOJ8Do3/EPZ0W8z6FEpCoznHTuyLv+jhqRdjASC+E=; b=YZbKpFFygPi/oG8cZwnMmwsbJnDA81AGAc9DPsaQ0Pls4gEWs7iPvwFqP3o8HYCq6p rFes6caR0GgHX9N6o12GGhiy5SFLya1jNj1BHFDut1kg2jFMiFVEAWUkk1JiS4nZMChs 7yIR2B55DbiiGZYID+3qUfUGq4AAJBGrdwKeMfi+iSWkzQhLrHpIZ4Bpth3k/BFmQXvh Eb3urKFwhwIngpDICTGHaT6Jc3mrKYD7aEPJ5iAKCX8WXWD+xrIoMfMt2k36r2a1RXk9 yZILtcv8fqNctCiqK/sGciRe5hZnpB0qN58uJZpmO1bC2YbS5hYYQ3SOA8TOmVI7EhCV +YtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=RxPOJ8Do3/EPZ0W8z6FEpCoznHTuyLv+jhqRdjASC+E=; b=Dfr/9yze9CjXijVa5xTWth/C93JPWIQLFCWXWcFqESO6ezRDa+fsC2CMoFohDyLAeF PVFTTdxoeR3iyDGZdqp1B3vpBEXep5o3teZs295TbOq3fOQwH0qnt1ctS5N0EKfVmExD h7wb2kDqTIDwof1FEjTWdrUxfcYkdVOFnfnI0wQp9zqKf6nlIbnDBTT6lkw09trcHQvC 62SLmqF+YE5K0Zbhg5P64nc8XlIWrY483VRMwH+CvA8JrahqYOUGJ3V4c7c4ioonPW6x OYd88UEPVG32Ug9oyfZUafC04pwyh98quFsKXG48q7dPJ6cnB5ibfZpZBKPp4F6rypLs aEaQ== X-Gm-Message-State: AOAM530BHPmN5DxtNFwxGMW1NYMnfrCzu28LUik7OKfQX9CyU5kbXgkD gh1UhXxpVYJxqQnAtDMtqM/xDZlLp1M= X-Google-Smtp-Source: ABdhPJz74Js9nf45F4kwgpX0d9nIfm0sD7OuEagyy5AIRAl4eTYk240siYQCAnlxVme5+q1B8Dd1gw== X-Received: by 2002:a0c:c384:: with SMTP id o4mr52559qvi.21.1611558495766; Sun, 24 Jan 2021 23:08:15 -0800 (PST) Received: from hurd (dsl-149-111.b2b2c.ca. [66.158.149.111]) by smtp.gmail.com with ESMTPSA id e1sm11647140qkd.135.2021.01.24.23.08.14 for <46028@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 23:08:15 -0800 (PST) From: Maxim Cournoyer To: 46028@debbugs.gnu.org Subject: Re: [PATCH core-updates v2] gnu: python: Replace PYTHONPATH by GUIX_PYTHONPATH_X_Y. References: <20210122045104.30229-2-maxim.cournoyer@gmail.com> <20210122131858.11206-1-maxim.cournoyer@gmail.com> Date: Mon, 25 Jan 2021 02:08:14 -0500 In-Reply-To: <20210122131858.11206-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Fri, 22 Jan 2021 08:18:58 -0500") Message-ID: <87lfch4hpd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Maxim Cournoyer writes: > Using PYTHONPATH as a mean to discover the Python packages had the following > issues: > > 1. It is not versioned, so different versions of Python would clash if > installed in a shared profile. > > 2. It would interfere with the host Python site on foreign > distributions, sometimes preventing a a user to login their GDM > session (!). > > 3. It would take precedence over user installed Python packages > installed through pip. > > 4. It would leak into Python virtualenvs, which are supposed to create > isolated Python environments. I've adapted the most problematic uses of PYTHONPATH in the code base (mostly (getenv "PYTHONPATH"), which would typically now return #f and pushed the branch to cu/farewell-to-pythonpath (it contains ~160 commits, so I thought it'd be easier to review as a branch). Thanks! Maxim From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 29 12:12:58 2021 Received: (at 46028) by debbugs.gnu.org; 29 Jan 2021 17:12:58 +0000 Received: from localhost ([127.0.0.1]:52880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5XKM-0003n2-7S for submit@debbugs.gnu.org; Fri, 29 Jan 2021 12:12:58 -0500 Received: from mail-qk1-f173.google.com ([209.85.222.173]:43829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5XKJ-0003mq-Rz for 46028@debbugs.gnu.org; Fri, 29 Jan 2021 12:12:56 -0500 Received: by mail-qk1-f173.google.com with SMTP id a12so9383339qkh.10 for <46028@debbugs.gnu.org>; Fri, 29 Jan 2021 09:12:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=nmMCglx+yspdIYxYSQUGJhgUNCUyIyV5eP1tW8S4DPU=; b=RTuaOobDxn/H7qJrbo7oVwroVY7E+CLNxPSPaTIZ1hI+ILNKU2DG6mcDPPLPms1lq6 3nYZLie0gCstk69qvtpATRFxRBLQKGJZ0b5d2fLZFM4WRS/1pYNdERYf1u+8SjoYw8Mk JW3L8rpYLY9dRzCnBrRRVMLqHujo9DONxL8HB7muABoUXuVAxfjPHnV8DRdlEJPJFGld glndii5nk35j3sEzNHkQfYyPb2ThKAK0q7swtFmjveKDIWmUJT9DSffPEE/4UYJwo0Ng oLTsOL1cc5es01d86WMnsJBPLx7Z3T/nyjApTQ1a0YA8dHBu2kBXdk1dfmFkAxwUA+hW rzlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=nmMCglx+yspdIYxYSQUGJhgUNCUyIyV5eP1tW8S4DPU=; b=uHLiNMhnxhuEh5xNe59jwziwlb4wqipTTkGcyeggYeywUBG7dhuCUv96gk2yXdavgq mCQEmaPCW6GMg5seSpbwW9BbRz3u0ISa+1a6MEY4mVQS3rwZAeT4tLh4MZIUAoYs7zVC PTSI5/6HHc4X0QOaYQ6g5I3pioN68azafu0U8UJtA0d//Du52Ppf6RzLUX5f9N6gvtVU GaOfxKxCODa12+ckKhkYDSWtJ9OpRIGNbMZuIa21zYSzrBbaf3zK48ccg8DV8d62fJyT KP6ZkE5dHFK52BkaFdzIoiqpzjUkL1LHzhejRDWv2Ftts54fh013PfcbZYVFHa8K0e/1 id+g== X-Gm-Message-State: AOAM532cLxkAjcrpRFOkt2cWjJfVaAZOCvYRdUfdBFkw8o1AflKx0wS1 zvrU9yojGrG56S9H9Nq/0gPgs9y2Rs4= X-Google-Smtp-Source: ABdhPJxLFbXgHORkpInOVm2Wg0DHj2YGmVlvgtCqOTI5q2BnVZyHp4oGC211zwjVpmSFISS6fX+yzQ== X-Received: by 2002:a37:2f44:: with SMTP id v65mr5040731qkh.135.1611940369908; Fri, 29 Jan 2021 09:12:49 -0800 (PST) Received: from hurd (dsl-148-165.b2b2c.ca. [66.158.148.165]) by smtp.gmail.com with ESMTPSA id h8sm6145614qtm.5.2021.01.29.09.12.48 for <46028@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 09:12:49 -0800 (PST) From: Maxim Cournoyer To: 46028@debbugs.gnu.org Subject: Re: bug#46028: [PATCH core-updates 0/2] Farewell to PYTHONPATH. References: <20210122045104.30229-2-maxim.cournoyer@gmail.com> <20210122131858.11206-1-maxim.cournoyer@gmail.com> <87lfch4hpd.fsf@gmail.com> Date: Fri, 29 Jan 2021 12:12:47 -0500 In-Reply-To: <87lfch4hpd.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 25 Jan 2021 02:08:14 -0500") Message-ID: <878s8by8ds.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Maxim Cournoyer writes: > Hi, > > Maxim Cournoyer writes: > >> Using PYTHONPATH as a mean to discover the Python packages had the following >> issues: >> >> 1. It is not versioned, so different versions of Python would clash if >> installed in a shared profile. >> >> 2. It would interfere with the host Python site on foreign >> distributions, sometimes preventing a a user to login their GDM >> session (!). >> >> 3. It would take precedence over user installed Python packages >> installed through pip. >> >> 4. It would leak into Python virtualenvs, which are supposed to create >> isolated Python environments. > > I've adapted the most problematic uses of PYTHONPATH in the code base > (mostly (getenv "PYTHONPATH"), which would typically now return #f and > pushed the branch to cu/farewell-to-pythonpath (it contains ~160 > commits, so I thought it'd be easier to review as a branch). There's now a third version of this that I pushed to the cu/farewell-to-pythonpath branch. It now uses GUIX_PYTHONPATH instead of GUIX_PYTHONPATH_X_Y, which makes it easier to use in any package definition (as there's no longer a need to import the (guix build python-build-system) module for packages not using the Python build system). I'll merge it soon if nobody has an objection. Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 01 13:36:03 2021 Received: (at 46028-done) by debbugs.gnu.org; 1 Feb 2021 18:36:03 +0000 Received: from localhost ([127.0.0.1]:33132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6e3P-0007l1-Hu for submit@debbugs.gnu.org; Mon, 01 Feb 2021 13:36:03 -0500 Received: from mail-qv1-f54.google.com ([209.85.219.54]:37905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6e3M-0007kU-3O for 46028-done@debbugs.gnu.org; Mon, 01 Feb 2021 13:36:02 -0500 Received: by mail-qv1-f54.google.com with SMTP id n14so8630284qvg.5 for <46028-done@debbugs.gnu.org>; Mon, 01 Feb 2021 10:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=s3YcPgHocru9zr6ns69keb34QO5mbQvYNeBYLHNmqcs=; b=tOBADkELpeTfX2xujLV9Ik2fH7AwGSDbT/E+zUDUCtJI6E9mgb34A+Hu4UiVU8d8GO q8YCIIIzt+FNyoTzzE+6tBQTvNkHmY2Tr80mYOZeCNPElifSymfMBmah26rAv5l2dohf dKH5VKMHhK+eBBFuuCJG6lvIObGolCuGdmvnAmS/FigZFMUs288yaQQe4PcLE7oMNxRg NBVNMTM06bBLXTBa/hZXyMl6ILlXO1Ff0psByHrl7zTMSLOyGfwsb/b301Gjlg1kmZEf htNeXOrOChIzID5PHSbkLkt499V8rsGecdfbd0tdTAl28heINXDG80g7jGBOqbwV4Wmz 0KCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=s3YcPgHocru9zr6ns69keb34QO5mbQvYNeBYLHNmqcs=; b=GugZkP+nyctCK8woiuXwtW5Yq5hYZqFhFYt10pF5vb//7sfIoa6bFfsXKVnz4xlCbQ pEE8orDCi42rQ6JGXbTTtdyXiPBtt4cCfWTHvEb02JQcmPRbJr8SDRPooJCQ2SiMEGpe ebIXmmDVW3xm5eI8q89rrdMVHgfsPoHwVtOajbULwrsShteEfUWOX4q3/7YvjKb84zEE GOhbe/XSEEL8+4oqzA2C36WuRgnOSTvNU9/vLes6iFP2EQrU7GteXBZ3w67bcDpM4egA nRtuxlnJZLMXEi512IAN4daptnGuU55lXb0O2xdx7uLtBwseU97hHpkdzS690hcl+xgg Tzng== X-Gm-Message-State: AOAM530rUXef/gNBOU6tZvYtauYEBaHAnjFE6YmtZvprEk0kdNPBMn5G KJOjNP2Mra3LYeHaRZdwyCVHY6QlfYM= X-Google-Smtp-Source: ABdhPJzIvxNRnl1cP/mTzroROUgU2Z4XmlocPJR9tOXM8280EUO+4lvMFpe+dUUPw+N5Rzj9M/VJgQ== X-Received: by 2002:a05:6214:b2c:: with SMTP id w12mr16513407qvj.54.1612204554502; Mon, 01 Feb 2021 10:35:54 -0800 (PST) Received: from hurd (dsl-205-236-230-168.b2b2c.ca. [205.236.230.168]) by smtp.gmail.com with ESMTPSA id v19sm15227226qkj.48.2021.02.01.10.35.53 for <46028-done@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:35:53 -0800 (PST) From: Maxim Cournoyer To: 46028-done@debbugs.gnu.org Subject: Re: bug#46028: [PATCH core-updates 0/2] Farewell to PYTHONPATH. References: <20210122045104.30229-2-maxim.cournoyer@gmail.com> <20210122131858.11206-1-maxim.cournoyer@gmail.com> <87lfch4hpd.fsf@gmail.com> <878s8by8ds.fsf_-_@gmail.com> Date: Mon, 01 Feb 2021 13:35:52 -0500 In-Reply-To: <878s8by8ds.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Fri, 29 Jan 2021 12:12:47 -0500") Message-ID: <878s87skjb.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46028-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Maxim Cournoyer writes: > Maxim Cournoyer writes: > >> Hi, >> >> Maxim Cournoyer writes: >> >>> Using PYTHONPATH as a mean to discover the Python packages had the following >>> issues: >>> >>> 1. It is not versioned, so different versions of Python would clash if >>> installed in a shared profile. >>> >>> 2. It would interfere with the host Python site on foreign >>> distributions, sometimes preventing a a user to login their GDM >>> session (!). >>> >>> 3. It would take precedence over user installed Python packages >>> installed through pip. >>> >>> 4. It would leak into Python virtualenvs, which are supposed to create >>> isolated Python environments. >> >> I've adapted the most problematic uses of PYTHONPATH in the code base >> (mostly (getenv "PYTHONPATH"), which would typically now return #f and >> pushed the branch to cu/farewell-to-pythonpath (it contains ~160 >> commits, so I thought it'd be easier to review as a branch). > > There's now a third version of this that I pushed to the > cu/farewell-to-pythonpath branch. It now uses GUIX_PYTHONPATH instead > of GUIX_PYTHONPATH_X_Y, which makes it easier to use in any package > definition (as there's no longer a need to import the (guix build > python-build-system) module for packages not using the Python build > system). > > I'll merge it soon if nobody has an objection. I've now pushed this to core-updates. Closing! Maxim From unknown Tue Aug 19 21:02:56 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 02 Mar 2021 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator