~postmarketos/pmbootstrap-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH pmbootstrap v3] pmb.config.sudo: Use type union compatible with Python 3.7

Details
Message ID
<20230605063142.6843-1-newbyte@postmarketos.org>
DKIM signature
missing
Download raw message
Patch: +2 -1
The Type | OtherType syntax for writing unions was introduced in Python
3.10. We want to support Python 3.7, so use an Optional type hint
instead which declares the same thing and is supported by 3.7.

Fixes d31313f7dc8018aeb92eeb8caf2dccf71a443a43
---
 pmb/config/sudo.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pmb/config/sudo.py b/pmb/config/sudo.py
index 1e227534..baa5963e 100644
--- a/pmb/config/sudo.py
+++ b/pmb/config/sudo.py
@@ -3,10 +3,11 @@
import os
import shutil
from functools import lru_cache
from typing import Optional


@lru_cache()
def which_sudo() -> str | None:
def which_sudo() -> Optional[str]:
    """Returns a command required to run commands as root, if any.

    Find whether sudo or doas is installed for commands that require root.
-- 
2.40.1

[pmbootstrap/patches/.build.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CT4IEWVG0I8J.36FDR23D1E75L@cirno2>
In-Reply-To
<20230605063142.6843-1-newbyte@postmarketos.org> (view parent)
DKIM signature
missing
Download raw message
pmbootstrap/patches/.build.yml: FAILED in 5m24s

[pmb.config.sudo: Use type union compatible with Python 3.7][0] v3 from [Newbyte][1]

[0]: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/41651
[1]: newbyte@postmarketos.org

✗ #1001625 FAILED pmbootstrap/patches/.build.yml https://builds.sr.ht/~postmarketos/job/1001625

Re: [PATCH pmbootstrap v3] pmb.config.sudo: Use type union compatible with Python 3.7

Details
Message ID
<2873318.ElGaqSPkdT@z3ntu.xyz>
In-Reply-To
<20230605063142.6843-1-newbyte@postmarketos.org> (view parent)
DKIM signature
missing
Download raw message
On Montag, 5. Juni 2023 08:31:43 CEST Newbyte wrote:
> The Type | OtherType syntax for writing unions was introduced in Python
> 3.10. We want to support Python 3.7, so use an Optional type hint
> instead which declares the same thing and is supported by 3.7.
> 
> Fixes d31313f7dc8018aeb92eeb8caf2dccf71a443a43

Fixes: d31313f7 ("Don't use 'sudo' when running as root")

With that fixed:

Reviewed-by: Luca Weiss <luca@z3ntu.xyz>

> ---
>  pmb/config/sudo.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/pmb/config/sudo.py b/pmb/config/sudo.py
> index 1e227534..baa5963e 100644
> --- a/pmb/config/sudo.py
> +++ b/pmb/config/sudo.py
> @@ -3,10 +3,11 @@
>  import os
>  import shutil
>  from functools import lru_cache
> +from typing import Optional
> 
> 
>  @lru_cache()
> -def which_sudo() -> str | None:
> +def which_sudo() -> Optional[str]:
>      """Returns a command required to run commands as root, if any.
> 
>      Find whether sudo or doas is installed for commands that require root.
Details
Message ID
<168596393293.2614.15327103246336102787.b4-ty@postmarketos.org>
In-Reply-To
<20230605063142.6843-1-newbyte@postmarketos.org> (view parent)
DKIM signature
missing
Download raw message
On Mon, 05 Jun 2023 08:31:43 +0200, Newbyte wrote:
> The Type | OtherType syntax for writing unions was introduced in Python
> 3.10. We want to support Python 3.7, so use an Optional type hint
> instead which declares the same thing and is supported by 3.7.
> 
> Fixes d31313f7dc8018aeb92eeb8caf2dccf71a443a43
> 
> 
> [...]

Applied, thanks!

[1/1] pmb.config.sudo: Use type union compatible with Python 3.7
      commit: c6a8a2614d34148176a737887dbb56d66bdedcb6

Best regards,
-- 
Oliver Smith <ollieparanoid@postmarketos.org>
Reply to thread Export thread (mbox)