From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#64406: [PATCH] Improve commands to manage Python imports Date: Thu, 06 Jul 2023 10:28:14 +0300 Message-ID: <83leftijn5.fsf@gnu.org> References: <874jmnbd5v.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33507"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64406-done@debbugs.gnu.org To: Matthias Meulien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 06 09:29:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qHJQX-0008Vw-1C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jul 2023 09:29:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHJQF-0002sx-P3; Thu, 06 Jul 2023 03:29:03 -0400 Original-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 1qHJQE-0002sH-S1 for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2023 03:29:02 -0400 Original-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 1qHJQE-0004BL-IM for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2023 03:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qHJQE-0004D4-E1 for bug-gnu-emacs@gnu.org; Thu, 06 Jul 2023 03:29:02 -0400 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jul 2023 07:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 64406 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Mail-Followup-To: 64406@debbugs.gnu.org, eliz@gnu.org, orontee@gmail.com Original-Received: via spool by 64406-done@debbugs.gnu.org id=D64406.168862850216106 (code D ref 64406); Thu, 06 Jul 2023 07:29:02 +0000 Original-Received: (at 64406-done) by debbugs.gnu.org; 6 Jul 2023 07:28:22 +0000 Original-Received: from localhost ([127.0.0.1]:39462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHJPa-0004Bh-Ad for submit@debbugs.gnu.org; Thu, 06 Jul 2023 03:28:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHJPY-0004BS-LS for 64406-done@debbugs.gnu.org; Thu, 06 Jul 2023 03:28:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHJPT-00046s-ES; Thu, 06 Jul 2023 03:28:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=xTw1LyIoCW5QTkuFlYT7JpUlaXx4ei+9r3gKDVUyx5c=; b=Kxh3GQrIEdxB 8LObz2a3/VrBPyFg0KtTHOc6yDfI8ZeyEY/5munfHExNlZfMQIGnPsrRpzj2D+TRABTx8AkgEAp7l oF+tFUTZVTbV+nRoEMuTPKZHdzzSD5R4can0Oobs68k1JpwE7E/df82bIs+MiT03gba6wy83h1U5S VjjP8vl6iGrRIE3VIJR/uM+t5r5oQEi478XvrHm9r5WYpldin0ExQ2OYCN7FP9tsigQne/TdA/QNw NaQ8dlV1fCj82XfJYM8XbQ0AEwz/gA/wBBrJ+VLTm3/upxVatKQ2McerAh7szYN1vlMZi4nbuZRfj SmwU2EWioq45PdNjLT4E2w==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHJPR-0001uD-Va; Thu, 06 Jul 2023 03:28:15 -0400 In-Reply-To: <874jmnbd5v.fsf@gmail.com> (message from Matthias Meulien on Sat, 01 Jul 2023 22:16:28 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264660 Archived-At: > From: Matthias Meulien > Date: Sat, 01 Jul 2023 22:16:28 +0200 > > Commands python-add-import, python-remove-imports and > python-sort-imports run a short Python script stored in variable > python--list-imports; That script starts with: > > from isort import find_imports_in_stream, find_imports_in_paths > > But find_imports_in_stream and find_imports_in_paths were introduced in > version 5.7.0 of the isort library. > > Debian bookworm has isort version 5.6.4 in its package repositories. > Thus on such system commands python-add-import, python-remove-import > and python-sort-imports fail with error message: > > python exited with status 1 (maybe isort is missing?) > > This is misleading when the isort library is installed. > > I suggest to extend the Python script in order to catch the import > errors and return status 1 if the isort library is not found and status > 2 if the expected symbols aren't found. The error message can then be > specialized. This is what I implemented in the attached patch. Thanks, installed on the master branch and closing the bug.