From unknown Fri Sep 05 09:10:57 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#74434 <74434@debbugs.gnu.org> To: bug#74434 <74434@debbugs.gnu.org> Subject: Status: [PATCH] py-compile: Allow user to disable python Reply-To: bug#74434 <74434@debbugs.gnu.org> Date: Fri, 05 Sep 2025 16:10:57 +0000 retitle 74434 [PATCH] py-compile: Allow user to disable python reassign 74434 automake-patches submitter 74434 Fr=C3=A9d=C3=A9ric B=C3=A9rat severity 74434 normal tag 74434 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 04:54:08 2024 Received: (at submit) by debbugs.gnu.org; 19 Nov 2024 09:54:08 +0000 Received: from localhost ([127.0.0.1]:41108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDKvw-0004m8-3j for submit@debbugs.gnu.org; Tue, 19 Nov 2024 04:54:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:36264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDKvt-0004m0-Fx for submit@debbugs.gnu.org; Tue, 19 Nov 2024 04:54:06 -0500 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 1tDKvt-0003AZ-6d for automake-patches@gnu.org; Tue, 19 Nov 2024 04:54:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDKvq-0005b8-V1 for automake-patches@gnu.org; Tue, 19 Nov 2024 04:54:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732010040; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dkOYwOXkmHuaSTxQFPayizk4wDNJxw8lmL3y1vAx7ys=; b=fGu43qborDg91BcFk4ZTUuVUSSm2GXUfLkBGGX7PK5G+ChS/dzE6JppDqJI8h+lrHEYVdW dSuAXhqNyOxjxOLawregJ3x6DmEsrO03w3e7x+K/gXfDTe/Fr4F7x2doRFOCMBhHe2IkpI Rzv2Vm14fhKiuJi04TNnyXsVuo3jToI= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-462-dOrXpFHUN0WQAlucGcng_A-1; Tue, 19 Nov 2024 04:52:10 -0500 X-MC-Unique: dOrXpFHUN0WQAlucGcng_A-1 X-Mimecast-MFC-AGG-ID: dOrXpFHUN0WQAlucGcng_A Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4723E1955E94 for ; Tue, 19 Nov 2024 09:52:09 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.192.53]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7841C19560A3 for ; Tue, 19 Nov 2024 09:52:08 +0000 (UTC) From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= To: automake-patches@gnu.org Subject: [PATCH] py-compile: Allow user to disable python Date: Tue, 19 Nov 2024 10:52:02 +0100 Message-ID: <20241119095202.2696082-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: pHsS5dyx8x4qAALbjHS6lVwJ_P2DyA95HCa9PGRJsuo_1732009929 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Received-SPF: pass client-ip=170.10.133.124; envelope-from=fberat@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit 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.4 (--) Hello, While integrating automake 1.17, I found that otf2 package build fails. The failure is due to: py-compile: could not determine : major version This is a side-effect of a rework of the py-compile script, which formerly defaulted to python3 if there was an error while getting the python version. The new code doesn't have this fallback, and if users want to disable python support by setting `PYTHON=:` as environment variable, the script bails out. I believe this is a common practice and that py-compile needs a fix. I therefore propose the one below. Feel free to tell me otherwise. Fred. -- 8< -- Subject: [PATCH] py-compile: Allow user to disable python Common practice is to set PYTHON=: to disable python support, which breaks the current version of this script. Check that the PYTHON variable contains `python`, early exit otherwise. --- lib/py-compile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/py-compile b/lib/py-compile index c9d4fde94..0238bab2c 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -33,6 +33,13 @@ fi me=py-compile +case "$PYTHON" in + *python*) ;; + *) + echo "$me: Python support disabled"; + exit 0;; +esac + usage_error () { echo "$me: $*" >&2 -- 2.47.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 19 16:28:54 2024 Received: (at 74434) by debbugs.gnu.org; 19 Nov 2024 21:28:54 +0000 Received: from localhost ([127.0.0.1]:44271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDVmI-0002db-8F for submit@debbugs.gnu.org; Tue, 19 Nov 2024 16:28:54 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:59514 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDVmH-0002dT-7X for 74434@debbugs.gnu.org; Tue, 19 Nov 2024 16:28:53 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.16.1/8.16.1) with ESMTPS id 4AJLSXVw2353335 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 19 Nov 2024 14:28:33 -0700 Received: (from apache@localhost) by freefriends.org (8.16.1/8.14.7/Submit) id 4AJLSXZr2353334; Tue, 19 Nov 2024 14:28:33 -0700 Date: Tue, 19 Nov 2024 14:28:33 -0700 Message-Id: <202411192128.4AJLSXZr2353334@freefriends.org> From: Karl Berry To: fberat@redhat.com Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python In-Reply-To: <20241119095202.2696082-1-fberat@redhat.com> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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 Frederic, I believe this is a common practice Well, clearly no one had thought of it nor was it tried at any point during the lengthy automake pretest sequence, but anyway, agreed that there's no reason to gratuitously fail in this case. As for disabling pythong, it doesn't seem to me that setting PYTHON=: can really be considered equivalent to something like a --without-python option, but since it helps in some cases, that's fine. --thanks, karl. From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 20 09:02:41 2024 Received: (at 74434) by debbugs.gnu.org; 20 Nov 2024 14:02:41 +0000 Received: from localhost ([127.0.0.1]:45859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDlI0-0005lc-SL for submit@debbugs.gnu.org; Wed, 20 Nov 2024 09:02:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:35839) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDlHw-0005lN-Uk for 74434@debbugs.gnu.org; Wed, 20 Nov 2024 09:02:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732111356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pEWraBHxB4uXaFM1RGdarTAlZrbYp8FZuR1epxeGD+0=; b=DaNUk+f8k1Pnmtky2WuN/YSJeswQ3qaQlPq2UKOxs5O65UunYf/jk+NXVPKCfvF8IJT2De whcEiOAzXjxJ/DP4wCkLgmWIRLY2OBrkElEC/RbrrnZX51ChMZKVvs3vC817Os2Lv0jaDt 2ab7lAHugP2xdeojtEWtok8voqyK5UA= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-h0SGMCl_NaKzryYe85RRaw-1; Wed, 20 Nov 2024 09:02:34 -0500 X-MC-Unique: h0SGMCl_NaKzryYe85RRaw-1 X-Mimecast-MFC-AGG-ID: h0SGMCl_NaKzryYe85RRaw Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5cfde9f622dso373886a12.1 for <74434@debbugs.gnu.org>; Wed, 20 Nov 2024 06:02:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732111352; x=1732716152; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pEWraBHxB4uXaFM1RGdarTAlZrbYp8FZuR1epxeGD+0=; b=CZ7WGiI/HHVLJVtKdA6CgMWAJgVJXALxHKeJHtSp8XhlPUBQDL6Nd16u7gnVBQ0epi 94S4beHvHZpHLdcQWXCpr8/Pdkt3WH3nKaQ/o30zSQhlzSV+9V8mT8fAtfNho2ylJmFQ 8t+SR3IFThNOLgB5O+3OzCUqwsUPitZYdNI/e3RBDYOlJ0qq+HCD6z2NOBvjz7t0GuDm 9he89FFsia/bvgF0VwiC0QRP8FVj+H6cFXHMpyfv/5wEg26o8QjnAuZVjHCB3dylttLo qWBa0M0Kc77IL5PqNy3nGoNc9sMWpUpD+5G7AwI6goJMI9/1C5OHIlpocUh29GeZ22Ae Qxvg== X-Gm-Message-State: AOJu0YwaMjPTv4KmMK8FCaaNHDoagkAHbySEXGdJL4oyNc1wDYqL+qtw ueAo9I6RYVIM8DWNkg5fja7igOSzQqxs620M4AiTkHx1lQOKPL2luz1M7ZnTB2nrNXVtJK3p8xF SroqBwZ+nHWgLZyaSuatNmr2Xdxf4SmSngj1FA+9xBVyNgscFHtIrzbxruGDhkp1N/cAfxp8wdg adtqybNvCEKsY6b4hCIUWBVvlTiB8= X-Gm-Gg: ASbGncv3Jbipfucm7YmxdVb4mGCWVRp/RJFJMb/crO33VwNdotR1nNGa+JjZvuXmeOn bl9aMqSaZKi2R1mt9GWVhYSlBrDh+LvTcz9S8CO+sMI/WNFKZqY44kp2TOHk5Dw== X-Received: by 2002:a17:907:318a:b0:a99:8642:4f41 with SMTP id a640c23a62f3a-aa4dd72c508mr118814566b.14.1732111351882; Wed, 20 Nov 2024 06:02:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW/tNNSsVuVzFXJT49hX6Xycmi6YCCO9IDr8kQChatIsOjYpooAWHUioJ0Tn4v7yoz2WNnvC90meFbz9b7nGM= X-Received: by 2002:a17:907:318a:b0:a99:8642:4f41 with SMTP id a640c23a62f3a-aa4dd72c508mr118805166b.14.1732111349764; Wed, 20 Nov 2024 06:02:29 -0800 (PST) MIME-Version: 1.0 References: <20241119095202.2696082-1-fberat@redhat.com> <202411192128.4AJLSXZr2353334@freefriends.org> In-Reply-To: <202411192128.4AJLSXZr2353334@freefriends.org> From: Frederic Berat Date: Wed, 20 Nov 2024 15:02:19 +0100 Message-ID: Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python To: Karl Berry X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: EHu6KjTq2GrJcf1Vn_3vsbdvyoWBNfOOlwnijF-1cCE_1732111352 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000b6e4e706275899cf" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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 (-) --000000000000b6e4e706275899cf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Nov 19, 2024 at 10:29=E2=80=AFPM Karl Berry = wrote: > Hi Frederic, > > I believe this is a common practice > > Well, clearly no one had thought of it nor was it tried at any point > during the lengthy automake pretest sequence, but anyway, agreed that > there's no reason to gratuitously fail in this case. > > As for disabling pythong, it doesn't seem to me that setting PYTHON=3D: > can really be considered equivalent to something like a --without-python > option, but since it helps in some cases, that's fine. --thanks, karl. > Well, to rephrase: that is a construct I've already seen, not that I agree or disagree with its usage in this usecase. There may be a bit more thoughts needed to get the py-compile-env.sh test to work properly though. --000000000000b6e4e706275899cf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Nov 19, 2024 at 10:29=E2=80= =AFPM Karl Berry <karl@freefrien= ds.org> wrote:
Hi Frederic,

=C2=A0 =C2=A0 I believe this is a common practice

Well, clearly no one had thought of it nor was it tried at any point
during the lengthy automake pretest sequence, but anyway, agreed that
there's no reason to gratuitously fail in this case.
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
As for disabling pythong, it doesn't seem to me that setting PYTHON=3D:=
can really be considered equivalent to something like a --without-python option, but since it helps in some cases, that's fine. --thanks, karl.<= br>

Well, to rephrase: that is a construct = I've already seen, not that I agree or disagree with its usage in this = usecase.

There may be a bit more thoughts need= ed to get the py-compile-env.sh test to work properly though.
--000000000000b6e4e706275899cf-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 20 17:23:16 2024 Received: (at 74434) by debbugs.gnu.org; 20 Nov 2024 22:23:16 +0000 Received: from localhost ([127.0.0.1]:48110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDt6R-0003bv-M6 for submit@debbugs.gnu.org; Wed, 20 Nov 2024 17:23:15 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:59292 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDt6P-0003bm-SD for 74434@debbugs.gnu.org; Wed, 20 Nov 2024 17:23:14 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.16.1/8.16.1) with ESMTPS id 4AKMMkXj052969 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 20 Nov 2024 15:22:46 -0700 Received: (from apache@localhost) by freefriends.org (8.16.1/8.14.7/Submit) id 4AKMMkaw052968; Wed, 20 Nov 2024 15:22:46 -0700 Date: Wed, 20 Nov 2024 15:22:46 -0700 Message-Id: <202411202222.4AKMMkaw052968@freefriends.org> From: Karl Berry To: fberat@redhat.com Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python In-Reply-To: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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 (-) There may be a bit more thoughts needed to get the py-compile-env.sh test to work properly though. Yes, we should add an explicit check for this PYTHON=: setting. If you have time to munge around in the test(s), that would be great. Else I'll get to it when I get to it. --thanks, karl. From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 22 07:27:27 2024 Received: (at 74434) by debbugs.gnu.org; 22 Nov 2024 12:27:27 +0000 Received: from localhost ([127.0.0.1]:53532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tESkw-0007vB-RN for submit@debbugs.gnu.org; Fri, 22 Nov 2024 07:27:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tESkt-0007uv-K9 for 74434@debbugs.gnu.org; Fri, 22 Nov 2024 07:27:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732278443; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=8ZBSIGZ3d/vc0CDu9mDswgNO0Yg9F3lpyBj4U+wUEjQ=; b=ghYXX1cwFITtt3OYstr8kqlJY/2jBURrSZ4TH69A4AxYyKrTi4MpUuS736OvyRFU53kVPg McxbL+CijKITIWko5IOOXqnz64z1AwYCCCHBP2j1f1IURcM3O3p9yK5l04TPxgI1qu5B6U Lq1H1KwYQPXIl0BdlPVHqT3jES1lZ0M= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-MvuBaHC9Otm2SC625gtjZA-1; Fri, 22 Nov 2024 07:27:21 -0500 X-MC-Unique: MvuBaHC9Otm2SC625gtjZA-1 X-Mimecast-MFC-AGG-ID: MvuBaHC9Otm2SC625gtjZA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9E6B5195608C; Fri, 22 Nov 2024 12:27:19 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.192.53]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9203A30001A2; Fri, 22 Nov 2024 12:27:18 +0000 (UTC) From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= To: Karl Berry Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python Date: Fri, 22 Nov 2024 13:27:10 +0100 Message-ID: <20241122122710.2737628-1-fberat@redhat.com> In-Reply-To: <202411202222.4AKMMkaw052968@freefriends.org> References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: U4-iwUYJCsR0l7gqizQ8ciLpk8DvOCmvrc4nWG3_61M_1732278440 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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, Here is a revision of the patch, so that py-compile-en.sh test passes. I leave to you to decide if a test dedicated to "PYTHON=:" is truly necessary. Fred. -- 8< -- Subject: [PATCH v2] py-compile: Allow user to disable python Common practice is to set PYTHON=: to disable python support, which breaks the current version of this script. --- lib/py-compile | 8 ++++++++ t/py-compile-env.sh | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/py-compile b/lib/py-compile index c9d4fde94..332cb4b79 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -33,6 +33,14 @@ fi me=py-compile +case "$PYTHON" in + *python*) ;; + *) + echo "$me: Invalid python executable ${PYTHON}"; + echo "$me: Python support disabled"; + exit 0;; +esac + usage_error () { echo "$me: $*" >&2 diff --git a/t/py-compile-env.sh b/t/py-compile-env.sh index b4ba6dcbe..7d8766b30 100644 --- a/t/py-compile-env.sh +++ b/t/py-compile-env.sh @@ -21,17 +21,17 @@ cp "$am_scriptdir/py-compile" . \ || fatal_ "failed to fetch auxiliary script py-compile" -cat > my-py <<'END' +cat > my-python <<'END' #!/bin/sh echo 2 -: > my-py.run +: > my-python.run END -chmod a+x my-py +chmod a+x my-python mkdir sub1 cd sub1 -PYTHON=false ../py-compile foo.py && exit 1 +! PYTHON=false ../py-compile foo.py && exit 1 ls | grep . && exit 1 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py @@ -42,16 +42,16 @@ cd .. mkdir sub2 cd sub2 -PYTHON=../my-py ../py-compile foo.py -test -f my-py.run -ls | grep -v '^my-py\.run$' | grep . && exit 1 +PYTHON=../my-python ../py-compile foo.py +test -f my-python.run +ls | grep -v '^my-python\.run$' | grep . && exit 1 cd .. mkdir sub3 cd sub3 PATH=..$PATH_SEPARATOR$PATH; export PATH -PYTHON=my-py py-compile foo.py -test -f my-py.run -ls | grep -v '^my-py\.run$' | grep . && exit 1 +PYTHON=my-python py-compile foo.py +test -f my-python.run +ls | grep -v '^my-python\.run$' | grep . && exit 1 : -- 2.47.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Nov 23 21:04:59 2024 Received: (at 74434) by debbugs.gnu.org; 24 Nov 2024 02:04:59 +0000 Received: from localhost ([127.0.0.1]:60118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tF1ze-0003wy-Kb for submit@debbugs.gnu.org; Sat, 23 Nov 2024 21:04:59 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:46870 helo=freefriends.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tF1zc-0003wp-Ts for 74434@debbugs.gnu.org; Sat, 23 Nov 2024 21:04:57 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.16.1/8.16.1) with ESMTPS id 4AO24WDP363284 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 23 Nov 2024 19:04:32 -0700 Received: (from apache@localhost) by freefriends.org (8.16.1/8.14.7/Submit) id 4AO24WBc363282; Sat, 23 Nov 2024 19:04:32 -0700 Date: Sat, 23 Nov 2024 19:04:32 -0700 Message-Id: <202411240204.4AO24WBc363282@freefriends.org> From: Karl Berry To: fberat@redhat.com Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python In-Reply-To: <20241122122710.2737628-1-fberat@redhat.com> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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 (-) +case "$PYTHON" in + *python*) ;; + *) + echo "$me: Invalid python executable ${PYTHON}"; + echo "$me: Python support disabled"; + exit 0;; +esac Thanks. But I'm not sure about requiring the executable name to include "python". Apart from technically being against GNU standards, I can imagine people making a link named anything and then using that. For whatever reason. Maybe it would suffice to run $PYTHON -V and see if the result matches grep -i python? I don't have Python 2.0 (the oldest we claim to support, though I have my doubts), but it works with Python 2.7. $ python2.7 -V Python 2.7.18 Wdyt? --thanks, karl. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 25 02:14:59 2024 Received: (at 74434) by debbugs.gnu.org; 25 Nov 2024 07:14:59 +0000 Received: from localhost ([127.0.0.1]:37648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFTJD-0007Ri-Ep for submit@debbugs.gnu.org; Mon, 25 Nov 2024 02:14:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:24691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tFTJB-0007Ra-2J for 74434@debbugs.gnu.org; Mon, 25 Nov 2024 02:14:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732518896; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=shn6yUPhmlOZHQQWmHXEtkLqWzfIL8gMdSPkcoP7674=; b=QuHqYlanD+3rQTy4Amim89um0Pp8w+i/jK4+G5p4WWylyx328FOULUH4IHCuScd8areoAL /hBsaOvWYeUoCmhSw711WqD88mOeW7obD4hmat4kWJSzm8DHzAxaH4ETURzBD3L9OShMw/ oKsUrgnq/O+5eIAi43DdcvPatXW1SxM= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-371-PSPVjhYUP3KxtdtxAAK6lw-1; Mon, 25 Nov 2024 02:14:54 -0500 X-MC-Unique: PSPVjhYUP3KxtdtxAAK6lw-1 X-Mimecast-MFC-AGG-ID: PSPVjhYUP3KxtdtxAAK6lw Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-aa53a12746dso13265166b.0 for <74434@debbugs.gnu.org>; Sun, 24 Nov 2024 23:14:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732518893; x=1733123693; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=shn6yUPhmlOZHQQWmHXEtkLqWzfIL8gMdSPkcoP7674=; b=NPeuyzpqj8A4Y5noY60bYrQWm11Ngz4i00/6dFxNPEsDUXBFA1NacMivZSyoZ78Wqw G45llD1bHVWqamI1ZmcIgVFHio8VcN4hbn2DFC+wBy1lwAHyFvf7GcZusTxG9jjfBRow vCIVh1tcaaj6eVHVIy+HE2Ah68NYujvRx+UKhTkUV1EbQetqDlxOtb2dQyHY/4ROIopR Uv2a+tdlgH0ivSjCc2Wju2cu/C6f9tJ/yyZk5Cokkv7zRYyV6vxVFgYUqrzsP6alHB4z cZh+K2olo09XCO/MrSmg2YVBcniD4+bcUpV/1zEcRQTi/pl5mZsLp0604vmxRfjwtzE2 YreA== X-Gm-Message-State: AOJu0Yy5qWHdrseFku6CdQzuwdvZYm8QLxOdNpfySgwD8alskl8hbixN xoZ8Hn8KNzSy3SQNYxP+pzh2qF/5yaSZ/Yxn0lqVuH6VdTdag1Rwed1yLO1OzGV1CLGJu7sQEI9 1XsR0SjVrIZLdrLPv5APtn2OvV+Nqv+YPSsc/QVrs85EeO8th2XAE8IhausXOUKHjoOaw0U7ycE n5746ozpmngTAsl2SD9zp10QtthUIn4h/Y7Ls= X-Gm-Gg: ASbGncs4w05p6F+r7LH1ttxVNzl8TRu/k1jra8SfrEfUnDYvlYKcLB4DVmJwOqKjeUL /f7uPq8e0gIyq8sh3Vd3KrsBCooO5p/IheQHsfD/sXSbq71jlBP8V3J2mi8C3YA== X-Received: by 2002:a17:907:e8b:b0:aa5:3e81:5abc with SMTP id a640c23a62f3a-aa53e815e70mr219646166b.1.1732518892698; Sun, 24 Nov 2024 23:14:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1roLcNUL9OVFLgtrs9FU4uERZGKibsrvXSAse5hf+xqQpXhF6PqWT7Psm8MVGyIHhsrbjHACK+XeuNXvc/rM= X-Received: by 2002:a17:907:e8b:b0:aa5:3e81:5abc with SMTP id a640c23a62f3a-aa53e815e70mr219646066b.1.1732518892408; Sun, 24 Nov 2024 23:14:52 -0800 (PST) MIME-Version: 1.0 References: <20241122122710.2737628-1-fberat@redhat.com> <202411240204.4AO24WBc363282@freefriends.org> In-Reply-To: <202411240204.4AO24WBc363282@freefriends.org> From: Frederic Berat Date: Mon, 25 Nov 2024 08:14:41 +0100 Message-ID: Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python To: Karl Berry X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ini0VYT8oRw-F_L0U9fXnAT4rju3mz5FB6uyVmF10yg_1732518893 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000262d860627b77d80" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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 (-) --000000000000262d860627b77d80 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Nov 24, 2024 at 3:05=E2=80=AFAM Karl Berry w= rote: > +case "$PYTHON" in > + *python*) ;; > + *) > + echo "$me: Invalid python executable ${PYTHON}"; > + echo "$me: Python support disabled"; > + exit 0;; > +esac > > Thanks. But I'm not sure about requiring the executable name to include > "python". Apart from technically being against GNU standards, I can > imagine people making a link named anything and then using that. For > whatever reason. > > Maybe it would suffice to run $PYTHON -V and see if the result matches > grep -i python? > > I don't have Python 2.0 (the oldest we claim to support, though I have > my doubts), but it works with Python 2.7. > > $ python2.7 -V > Python 2.7.18 > > Wdyt? --thanks, karl. > That sounds reasonable. --000000000000262d860627b77d80 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sun, Nov 24, 2024 at 3:05=E2=80=AF= AM Karl Berry <karl@freefriends.= org> wrote:
=C2=A0 =C2=A0 +case "$PYTHON" in
=C2=A0 =C2=A0 +=C2=A0 *python*) ;;
=C2=A0 =C2=A0 +=C2=A0 *)
=C2=A0 =C2=A0 +=C2=A0 echo "$me: Invalid python executable ${PYTHON}&q= uot;;
=C2=A0 =C2=A0 +=C2=A0 echo "$me: Python support disabled";
=C2=A0 =C2=A0 +=C2=A0 exit 0;;
=C2=A0 =C2=A0 +esac

Thanks. But I'm not sure about requiring the executable name to include=
"python". Apart from technically being against GNU standards, I c= an
imagine people making a link named anything and then using that. For
whatever reason.

Maybe it would suffice to run $PYTHON -V and see if the result matches
grep -i python?

I don't have Python 2.0 (the oldest we claim to support, though I have<= br> my doubts), but it works with Python 2.7.

$ python2.7 -V
Python 2.7.18

Wdyt? --thanks, karl.

That sounds reaso= nable.
--000000000000262d860627b77d80-- From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 03 13:08:30 2025 Received: (at 74434) by debbugs.gnu.org; 3 Feb 2025 18:08:30 +0000 Received: from localhost ([127.0.0.1]:41125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tf0s1-0005Nr-GY for submit@debbugs.gnu.org; Mon, 03 Feb 2025 13:08:30 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:54998 helo=freefriends.org) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tf0ry-0005Ne-Le for 74434@debbugs.gnu.org; Mon, 03 Feb 2025 13:08:27 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.16.1/8.16.1) with ESMTPS id 513I7s6x1103521 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 3 Feb 2025 11:07:54 -0700 Received: (from apache@localhost) by freefriends.org (8.16.1/8.14.7/Submit) id 513I7sIx1103520; Mon, 3 Feb 2025 11:07:54 -0700 Date: Mon, 3 Feb 2025 11:07:54 -0700 Message-Id: <202502031807.513I7sIx1103520@freefriends.org> From: Karl Berry To: fberat@redhat.com Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python In-Reply-To: <20241122122710.2737628-1-fberat@redhat.com> X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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.7 (-) Here is a revision of the patch, so that py-compile-en.sh test passes. Here's another attempt at the patch, calling $PYTHON -V instead of using the name of $0 to decide if it's really Python. Wdyt? The result is that $PYTHON can be set to anything at all and py-compile will succeed. Since the goal is to support "disabling" via PYTHON=:. I can't see how to reasonably support the previous behavior of PYTHON=: succeeding and PYTHON=false failing, unless we make a special case for : (and true and ...?), which seems undesirable. Do you (or anyone) think we need to worry about this, or is it ok for py-compile to now succeed with any value of $PYTHON? I worry people assumed the previous bizarre behavior in their Makefiles. Thanks, Karl diff --git a/lib/py-compile b/lib/py-compile index 9659beca6..d68a4431e 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -33,6 +33,15 @@ fi me=py-compile +# People apparently set PYTHON=: and expect the result to be true. +# This means setting PYTHON=false will also exit true, but what can we do? +# For the same reason, we output to stdout instead of stderr. Bizarre. +if $PYTHON -V 2>/dev/null | grep -i python; then :; else + echo "$me: Invalid python executable (according to -V): $PYTHON" + echo "$me: Python support disabled" + exit 0 +fi + usage_error () { echo "$me: $*" >&2 diff --git a/t/py-compile-env.sh b/t/py-compile-env.sh index 564fb98c6..fc82df43a 100644 --- a/t/py-compile-env.sh +++ b/t/py-compile-env.sh @@ -31,7 +31,13 @@ chmod a+x my-py mkdir sub1 cd sub1 -PYTHON=false ../py-compile foo.py && exit 1 +# This should succeed and do nothing. +PYTHON=: ../py-compile foo.py +ls | grep . && exit 1 + +# This command will also succeed, since we intentionally allow PYTHON to +# be set to anything. +PYTHON=false ../py-compile foo.py ls | grep . && exit 1 PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py compile finished at Mon Feb 3 10:04:09 2025 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 09 12:37:28 2025 Received: (at 74434) by debbugs.gnu.org; 9 Feb 2025 17:37:28 +0000 Received: from localhost ([127.0.0.1]:46125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1thBFH-0006bF-Uu for submit@debbugs.gnu.org; Sun, 09 Feb 2025 12:37:28 -0500 Received: from frenzy.freefriends.org ([198.99.81.75]:56834 helo=freefriends.org) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1thBFE-0006au-QL; Sun, 09 Feb 2025 12:37:25 -0500 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (localhost [127.0.0.1]) by freefriends.org (8.16.1/8.16.1) with ESMTPS id 519HalP1136228 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 9 Feb 2025 10:36:47 -0700 Received: (from apache@localhost) by freefriends.org (8.16.1/8.14.7/Submit) id 519HalFW136227; Sun, 9 Feb 2025 10:36:47 -0700 Date: Sun, 9 Feb 2025 10:36:47 -0700 Message-Id: <202502091736.519HalFW136227@freefriends.org> From: Karl Berry To: fberat@redhat.com Subject: Re: [bug#74434] [PATCH] py-compile: Allow user to disable python In-Reply-To: X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 74434 Cc: 74434@debbugs.gnu.org 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.7 (-) Hi Frederic and all - I installed the following patch to py-compile. Hopefully it restores the previous behavior of setting the PYTHON envvar to whatever and "disabling" the compilation (but exiting succesfully). Hope it flies, let me know if problems. --thanks, karl. ----------------------------------------------------------------------------- python: restore more compatible behavior for $PYTHON. For https://bugs.gnu.org/74434. * lib/py-compile: if $PYTHON -V does not include the string "python" (case-insensitive), consider the support intentionally disabled and exit successfully, unless PYTHON is set to false, in which case exit unsuccessfully. This is closer to the old behavior. Mention this in the help message. * t/py-compile-env.sh: add test for PYTHON=:. * NEWS: mention this. (And, en passant, add some past bug#s and clarify that only RCS/SCCS pattern rules were disabled, not all.) diff --git a/NEWS b/NEWS index f667c8727..22bd6a585 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,7 @@ New in 1.x: * New supported languages - - Support for Algol 68 added, based on the GNU Algol 68 compiler. + - Support for Algol 68 added, based on the GNU Algol 68 compiler. (bug#75807) * Miscellaneous changes @@ -19,7 +19,14 @@ New in 1.x: - Avoid Perl 5.41.8+ precedence warning for use of !!. - - The compile script is more robust to various Windows configurations. + - The py-compile script once again does nothing (successfully) if the + PYTHON environment variable is set to ":", or anything that isn't a + Python interpreter (according to $PYTHON -V). Exception: if PYTHON + is set to "false", do nothing but exit unsuccessfully, also to match + previous behavior. (bug#74434) + + - The compile script is more robust to Windows configurations; + specifically, avoiding double-path translation on MSYS. (bug#75939) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -51,8 +58,8 @@ New in 1.17: retained when appended. GNU Make & BSD Makes are known to support it. (bug#7610) - - GNU Make's default pattern rules are disabled, for speed and debugging. - (.SUFFIXES was already cleared.) (bug#64743) + - GNU Make's default pattern rules for RCS and SCCS are disabled, for + speed and debugging. (.SUFFIXES was already cleared.) (bug#64743) - For Texinfo documents, if a .texi.in file exists, but no .texi, the .texi.in will be read. Texinfo source files need not be present at diff --git a/lib/py-compile b/lib/py-compile index 9659beca6..0cfddedb6 100755 --- a/lib/py-compile +++ b/lib/py-compile @@ -33,6 +33,23 @@ fi me=py-compile +# People apparently set PYTHON=: and expect the result to be true. +# For the same reason, we output to stdout instead of stderr. Bizarre. +if $PYTHON -V 2>/dev/null | grep -i python >/dev/null; then :; else + echo "$me: Invalid python executable (according to -V): $PYTHON" + echo "$me: Python support disabled" + if test x"$PYTHON" = xfalse; then + # But, as a special case, make PYTHON=false exit unsuccessfully, + # since that was the traditional behavior. + exit 1 + # In the past, setting PYTHON to any command that exited unsuccessfully + # caused py-compile to exit unsuccessfully. Let's not try to + # replicate that unless and until needed. + else + exit 0 + fi +fi + usage_error () { echo "$me: $*" >&2 @@ -64,7 +81,7 @@ while test $# -ne 0; do cat <<\EOF Usage: py-compile [options] FILES... -Byte compile some python scripts FILES. Use --destdir to specify any +Byte compile FILES as Python scripts. Use --destdir to specify a leading directory path to the FILES that you don't want to include in the byte compiled file. Specify --basedir for any additional path information you do want to be shown in the byte compiled file. @@ -78,6 +95,14 @@ Options: Example: py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py +The Python interpreter to use is taken from the environment variable +PYTHON, or "python" by default. + +For compatibility: as a special case, if PYTHON=false (that is, the +command named "false"), this script will exit unsuccessfully. Otherwise, +if $PYTHON -V does not include the string "Python", this script will +emit a message to standard output and exit successfully. + Report bugs to . GNU Automake home page: . General help using GNU software: . diff --git a/t/py-compile-env.sh b/t/py-compile-env.sh index 564fb98c6..3411ddd5d 100644 --- a/t/py-compile-env.sh +++ b/t/py-compile-env.sh @@ -31,9 +31,15 @@ chmod a+x my-py mkdir sub1 cd sub1 +# This py-compile invocation should succeed and do nothing. +PYTHON=: ../py-compile foo.py +ls | grep . && exit 1 + +# This py-compile invocation should fail and do nothing. PYTHON=false ../py-compile foo.py && exit 1 ls | grep . && exit 1 +# These should also do nothing, and succeed. PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo' ls | grep . && exit 1 compile finished at Sun Feb 9 09:36:24 2025 From unknown Fri Sep 05 09:10:57 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 10 Mar 2025 11:24:08 +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