[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64406: [PATCH] Improve commands to manage Python imports
From: |
Eli Zaretskii |
Subject: |
bug#64406: [PATCH] Improve commands to manage Python imports |
Date: |
Thu, 06 Jul 2023 10:28:14 +0300 |
> From: Matthias Meulien <orontee@gmail.com>
> 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.