From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id Hb5eDe6zrWTDRgAASxT56A (envelope-from ) for ; Tue, 11 Jul 2023 21:56:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id SGGRC+6zrWSyTAEAG6o9tA (envelope-from ) for ; Tue, 11 Jul 2023 21:56:30 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A67163850A for ; Tue, 11 Jul 2023 21:56:29 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=koszko.org header.s=mail header.b=SbepEovk; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1689105389; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=P4j8jnmrCkTEWrV7StmOn94mZDOakLmy64o7dC1jpIM=; b=eq0tf28HdgXoCSmbpTKXabFGU5QLSi2BVQl6j59A/5Va0fCv7utzigOGlN1ouK3IzDVMca HskIs1qqG+iRYr69aG7PkHUSMkpVHTf9pnyEfEcUJ1H+UpgNcJ9QA580QAuB4bcdpEA7qh EshtLSNXJ4YCBP6w1rOyLrhTWM9PGbVOeORJIhJKrQBifV/oJ6vmdeaL+9+QiVKDmA9Xne tcHpXO/T00hXDHBXcHRI1tFrc/dRdw8RDQ/3+jbx6fsQtE1hEc2CH4/1J9DyS2T3fY9sxi IWnevmgMt/IvbnPOa8D3qSmAOamp4xCpxS4N4TcXbPDdlGs5iB9fwH0K30MdVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=koszko.org header.s=mail header.b=SbepEovk; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1689105389; a=rsa-sha256; cv=none; b=l7ed6/SCzfCy5luQeHspvBwP6XDNSlwcL8zH+rdqel8jjs2Ej1ilstRYEjIay++9l38Ox5 BIUtyopG9ZEcda/Eh6q3S8xdlRCfgr7FT7hNCJQFqQ10zT/J2q90va+MMBz7hAdghCB44a LYTl9o0IbW5LdeUL+X8MBdAN4567zDDn3DALbRsMM0PqDGBULGXGRchPonMZmFP8oBDBvL QmiNauqMiaw8yxDjGwjWD61bi6/ie73TS43rqiXb064CNl+NWYKC48hYwLWCHNN/pmmbhg Z/xaryWh3DTlrFaGx/O1ucLUm2fEsgScNvaNItyDiDUTEYadNpUMl1s69UWQ6g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJJSy-000749-QY; Tue, 11 Jul 2023 15:56:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJHtB-0005lL-FR for guix-patches@gnu.org; Tue, 11 Jul 2023 14:15:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJHtA-0008Vc-RZ for guix-patches@gnu.org; Tue, 11 Jul 2023 14:15:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qJHt8-00070p-MQ; Tue, 11 Jul 2023 14:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64573] [PATCH 3/3] guix: build: python-build-system: Honor disable-user-site? argument Resent-From: Wojtek Kosior Original-Sender: "Debbugs-submit" Resent-CC: lars@6xq.net, jgart@dismail.de, guix-patches@gnu.org Resent-Date: Tue, 11 Jul 2023 18:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64573 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64573@debbugs.gnu.org Cc: Wojtek Kosior , Lars-Dominik Braun , jgart X-Debbugs-Original-Xcc: Lars-Dominik Braun , jgart Received: via spool by 64573-submit@debbugs.gnu.org id=B64573.168909929626907 (code B ref 64573); Tue, 11 Jul 2023 18:15:02 +0000 Received: (at 64573) by debbugs.gnu.org; 11 Jul 2023 18:14:56 +0000 Received: from localhost ([127.0.0.1]:51013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJHt2-0006zv-74 for submit@debbugs.gnu.org; Tue, 11 Jul 2023 14:14:56 -0400 Received: from koszko.org ([93.95.227.159]:49662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qJHsz-0006ze-LY for 64573@debbugs.gnu.org; Tue, 11 Jul 2023 14:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=koszko.org; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=P4j8jnmrCkTEWrV7StmOn94mZDOakLmy64o7dC1jpIM=; b=SbepEovkyAc6neIJLybIFEAJmB WBBWnKFwDpl1wBIzNRwK5yBbq8LQLYOmb+f//N9gdCl6ALRLmzSx6SIfLGS0KYOiAPAIS7S7YoItl g/OI0P7WkH5czQp5UWLsOXitqU0JRzqXrH2MW+8o1ie71a6IiVySQkLm6HinMRxRZsf4nl9rfDaIf ecZkZpKIi1R533yKsEH9ZixZGWa4NYUezv47W+yVB7LUWe50ZNTSw0tb8b2BZYR5lLmzaP5WmkkPt IXq6SPBqp8zNDThOzADMdqqmJuiDZKa3tQ8EfeA3ev+0YlytMKjRmId+FuL0DRrFnM1KGY7RUjdtf zLRpIHO/C2Pdxs8Q2ouefbeX9Hu2TR8tsGWVgsLD1S/wCGXKgYRUbcg4oGHczignO3SYwD1iBlyCu U9/j4Nl+JmIPbrvnferqR4nviMKWkIHAOsW1cfoO3uXG+4ZPmNMoFjtkV4BcD0jmxNme/UXH7lkQQ e4URWIvA5Fj7ea2986qAK7UXnmnppAG7j/c98IE0fYzY31pfgt+rcwEjEOnN752eQ1kI1JQHismN1 uTEGXUtrjLkn32VQgGgeOEcRcQdbirHhoCBkKk+v2noJJMkH5q+s+PZZex9viQBbkbgYuIv2FTrgC WjZh6UtUXraSaO93T/PgaSy+/XEAXG5hcAu450s08=; Received: from [77.252.47.107] (helo=localhost.localdomain) by koszko.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJHsy-0007hX-Td; Tue, 11 Jul 2023 20:14:53 +0200 Date: Tue, 11 Jul 2023 20:14:40 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Tue, 11 Jul 2023 15:56:06 -0400 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Wojtek Kosior X-ACL-Warn: , Wojtek Kosior via Guix-patches From: Wojtek Kosior via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.80 X-Spam-Score: -6.80 X-Migadu-Queue-Id: A67163850A X-Migadu-Scanner: mx1.migadu.com X-TUID: Ii4vYs1KMYtC * guix/build/python-build-system.scm (wrap): Only define the PYTHONNOUSERSITE wrapper variable if keyword argument disable-user-site? evaluates to true. * guix/build-system/python.scm (python-build): Pass disable-user-site? argument to the build side with the default of #t. --- guix/build-system/python.scm | 2 ++ guix/build/python-build-system.scm | 31 +++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm index cca009fb28..dd86cbd4bf 100644 --- a/guix/build-system/python.scm +++ b/guix/build-system/python.scm @@ -171,6 +171,7 @@ (define* (python-build name inputs (tests? #t) (test-target "test") (use-setuptools? #t) + (disable-user-site? #t) (configure-flags ''()) (phases '%standard-phases) (outputs '("out")) @@ -192,6 +193,7 @@ (define* (python-build name inputs #:source #+source #:configure-flags #$configure-flags #:use-setuptools? #$use-setuptools? + #:disable-user-site? #$disable-user-site? #:system #$system #:test-target #$test-target #:tests? #$tests? diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 93aafc4aa9..959d062bb2 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2021 Lars-Dominik Braun ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2023 Wojtek Kosior ;;; ;;; This file is part of GNU Guix. ;;; @@ -222,7 +223,7 @@ (define* (install #:key inputs outputs (configure-flags '()) use-setuptools? (invoke "python" "-m" "compileall" "--invalidation-mode=unchecked-hash" out)))) -(define* (wrap #:key inputs outputs #:allow-other-keys) +(define* (wrap #:key inputs outputs disable-user-site? #:allow-other-keys) (define (list-of-files dir) (find-files dir (lambda (file stat) (and (eq? 'regular (stat:type stat)) @@ -241,18 +242,22 @@ (define* (wrap #:key inputs outputs #:allow-other-keys) (define %sh (delay (search-input-file inputs "bin/bash"))) (define (sh) (force %sh)) - (let* ((var-pythonpath `("GUIX_PYTHONPATH" prefix - ,(search-path-as-string->list - (or (getenv "GUIX_PYTHONPATH") "")))) - ;; Harden applications by preventing Python from automatically - ;; picking up libraries in user site directory. - (var-usersite '("PYTHONNOUSERSITE" = ("GUIX_WRAPPER")))) - (for-each (lambda (dir) - (let ((files (list-of-files dir))) - (for-each (cut wrap-program <> #:sh (sh) - var-pythonpath var-usersite) - files))) - bindirs))) + (let ((vars (filter identity + `(("GUIX_PYTHONPATH" prefix + ,(search-path-as-string->list + (or (getenv "GUIX_PYTHONPATH") ""))) + ;; Harden applications by preventing Python from + ;; automatically picking up libraries in user site + ;; directory. + ,(and disable-user-site? + '("PYTHONNOUSERSITE" = ("GUIX_WRAPPER"))))))) + (for-each (lambda (var) + (for-each (lambda (dir) + (let ((files (list-of-files dir))) + (for-each (cut wrap-program <> #:sh (sh) var) + files))) + bindirs)) + vars))) (define* (rename-pth-file #:key name inputs outputs #:allow-other-keys) "Rename easy-install.pth to NAME.pth to avoid conflicts between packages -- 2.40.1