All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2, 1/1] package/python-pycli: fix build with python >= 3.10
@ 2022-02-15 13:29 Fabrice Fontaine
  2022-02-16 21:02 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2022-02-15 13:29 UTC (permalink / raw)
  To: buildroot; +Cc: Geoffrey Ragot, Fabrice Fontaine, Asaf Kahlon

Fix the following build failure raised since bump of python3 to version
3.10.1 in commit 25b1fc2898d68ddf2674b14c738045875fc5a2dc due to the new
"Multiple Exception types without parentheses" exception
(https://docs.python.org/3/whatsnew/3.10.html)

error:   File "/usr/lib/python3.10/site-packages/cli/app.py", line 242
    except Exception, e:
           ^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

Fixes:
 - http://autobuild.buildroot.org/results/8d7b0c23472abffc9447e4a6de273bdd04486d39

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2:
 - Add upstream commits instead of dropping package (even if repository
   has been archived)

 ...aise-exceptions-in-wrapped-functions.patch | 26 ++++++++++++
 ...pt-statement-changed-slightly-in-2-6.patch | 41 +++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
 create mode 100644 package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch

diff --git a/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch b/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
new file mode 100644
index 0000000000..7ac9d7af9f
--- /dev/null
+++ b/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
@@ -0,0 +1,26 @@
+From 57c563f8b47a56feefc0a8bcbef05f4b54280549 Mon Sep 17 00:00:00 2001
+From: mmbutter <mario.butter@gmail.com>
+Date: Tue, 9 Jun 2020 11:50:41 -0500
+Subject: [PATCH] Fix problem with re-raise exceptions in wrapped functions.
+
+[Retrieved from:
+https://github.com/whilp/cli/commit/57c563f8b47a56feefc0a8bcbef05f4b54280549]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ lib/cli/app.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/cli/app.py b/lib/cli/app.py
+index 7b6db52..f487ab4 100644
+--- a/lib/cli/app.py
++++ b/lib/cli/app.py
+@@ -240,6 +240,9 @@ def run(self):
+         try:
+             returned = self.main(*args)
+         except Exception, e:
++        	elif isinstance(e, self.reraise):
++        	    # raising the last exception preserves traceback
++        	    raise
+             returned = e
+ 
+         return self.post_run(returned)
diff --git a/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch b/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch
new file mode 100644
index 0000000000..75869d6d23
--- /dev/null
+++ b/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch
@@ -0,0 +1,41 @@
+From 2af95cff5609142ec14efdf13b394f9b0121ab2e Mon Sep 17 00:00:00 2001
+From: mmbutter <mario.butter@gmail.com>
+Date: Thu, 11 Jun 2020 15:50:03 -0500
+Subject: [PATCH] except statement changed slightly in 2.6. This could cause
+ problems in newer versions. Updated to the new format.
+
+[Retrieved from:
+https://github.com/whilp/cli/commit/2af95cff5609142ec14efdf13b394f9b0121ab2e]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ lib/cli/app.py | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/lib/cli/app.py b/lib/cli/app.py
+index f487ab4..45256b8 100644
+--- a/lib/cli/app.py
++++ b/lib/cli/app.py
+@@ -239,10 +239,10 @@ def run(self):
+             args = ()
+         try:
+             returned = self.main(*args)
+-        except Exception, e:
+-        	elif isinstance(e, self.reraise):
+-        	    # raising the last exception preserves traceback
+-        	    raise
++        except self.reraise:
++            # raising the last exception preserves traceback
++            raise
++        except Exception as e:
+             returned = e
+ 
+         return self.post_run(returned)
+@@ -420,7 +420,7 @@ def pre_run(self):
+         """
+         try:
+             ns = self.argparser.parse_args()
+-        except SystemExit, e:
++        except SystemExit as e:
+             if self.exit_after_main:
+                 raise
+             else:
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH v2, 1/1] package/python-pycli: fix build with python >= 3.10
  2022-02-15 13:29 [Buildroot] [PATCH v2, 1/1] package/python-pycli: fix build with python >= 3.10 Fabrice Fontaine
@ 2022-02-16 21:02 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2022-02-16 21:02 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Geoffrey Ragot, Asaf Kahlon, buildroot

Fabrice, All,

On 2022-02-15 14:29 +0100, Fabrice Fontaine spake thusly:
> Fix the following build failure raised since bump of python3 to version
> 3.10.1 in commit 25b1fc2898d68ddf2674b14c738045875fc5a2dc due to the new
> "Multiple Exception types without parentheses" exception
> (https://docs.python.org/3/whatsnew/3.10.html)
> 
> error:   File "/usr/lib/python3.10/site-packages/cli/app.py", line 242
>     except Exception, e:
>            ^^^^^^^^^^^^
> SyntaxError: multiple exception types must be parenthesized
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/8d7b0c23472abffc9447e4a6de273bdd04486d39
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> Changes v1 -> v2:
>  - Add upstream commits instead of dropping package (even if repository
>    has been archived)
> 
>  ...aise-exceptions-in-wrapped-functions.patch | 26 ++++++++++++
>  ...pt-statement-changed-slightly-in-2-6.patch | 41 +++++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
>  create mode 100644 package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch
> 
> diff --git a/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch b/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
> new file mode 100644
> index 0000000000..7ac9d7af9f
> --- /dev/null
> +++ b/package/python-pycli/0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch
> @@ -0,0 +1,26 @@
> +From 57c563f8b47a56feefc0a8bcbef05f4b54280549 Mon Sep 17 00:00:00 2001
> +From: mmbutter <mario.butter@gmail.com>
> +Date: Tue, 9 Jun 2020 11:50:41 -0500
> +Subject: [PATCH] Fix problem with re-raise exceptions in wrapped functions.
> +
> +[Retrieved from:
> +https://github.com/whilp/cli/commit/57c563f8b47a56feefc0a8bcbef05f4b54280549]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + lib/cli/app.py | 3 +++
> + 1 file changed, 3 insertions(+)
> +
> +diff --git a/lib/cli/app.py b/lib/cli/app.py
> +index 7b6db52..f487ab4 100644
> +--- a/lib/cli/app.py
> ++++ b/lib/cli/app.py
> +@@ -240,6 +240,9 @@ def run(self):
> +         try:
> +             returned = self.main(*args)
> +         except Exception, e:
> ++        	elif isinstance(e, self.reraise):
> ++        	    # raising the last exception preserves traceback
> ++        	    raise
> +             returned = e
> + 
> +         return self.post_run(returned)
> diff --git a/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch b/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch
> new file mode 100644
> index 0000000000..75869d6d23
> --- /dev/null
> +++ b/package/python-pycli/0002-except-statement-changed-slightly-in-2-6.patch
> @@ -0,0 +1,41 @@
> +From 2af95cff5609142ec14efdf13b394f9b0121ab2e Mon Sep 17 00:00:00 2001
> +From: mmbutter <mario.butter@gmail.com>
> +Date: Thu, 11 Jun 2020 15:50:03 -0500
> +Subject: [PATCH] except statement changed slightly in 2.6. This could cause
> + problems in newer versions. Updated to the new format.
> +
> +[Retrieved from:
> +https://github.com/whilp/cli/commit/2af95cff5609142ec14efdf13b394f9b0121ab2e]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + lib/cli/app.py | 10 +++++-----
> + 1 file changed, 5 insertions(+), 5 deletions(-)
> +
> +diff --git a/lib/cli/app.py b/lib/cli/app.py
> +index f487ab4..45256b8 100644
> +--- a/lib/cli/app.py
> ++++ b/lib/cli/app.py
> +@@ -239,10 +239,10 @@ def run(self):
> +             args = ()
> +         try:
> +             returned = self.main(*args)
> +-        except Exception, e:
> +-        	elif isinstance(e, self.reraise):
> +-        	    # raising the last exception preserves traceback
> +-        	    raise
> ++        except self.reraise:
> ++            # raising the last exception preserves traceback
> ++            raise
> ++        except Exception as e:
> +             returned = e
> + 
> +         return self.post_run(returned)
> +@@ -420,7 +420,7 @@ def pre_run(self):
> +         """
> +         try:
> +             ns = self.argparser.parse_args()
> +-        except SystemExit, e:
> ++        except SystemExit as e:
> +             if self.exit_after_main:
> +                 raise
> +             else:
> -- 
> 2.34.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-16 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15 13:29 [Buildroot] [PATCH v2, 1/1] package/python-pycli: fix build with python >= 3.10 Fabrice Fontaine
2022-02-16 21:02 ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.