bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Paulo Neves <paulo@myneves.com>, bitbake-devel@lists.openembedded.org
Subject: Re: [bitbake-devel] [PATCH 3/5] git: Remove is None check on _find_git_lfs
Date: Wed, 22 Feb 2023 12:03:05 +0000	[thread overview]
Message-ID: <7508e1a2be0154ba2357fe44e6d614428cbcb965.camel@linuxfoundation.org> (raw)
In-Reply-To: <20230217170009.58707-3-paulo@myneves.com>

On Fri, 2023-02-17 at 17:00 +0000, Paulo Neves wrote:
> shutil.which returns None when the argument is not found.
> As per documentation[1] None is evaluated to False and everything
> else is True, so it is safe to have _find_git_lfs just return
> the value of shutil.which
> 
> [1] https://docs.python.org/3/library/stdtypes.html#truth-value-testing
> 
> Signed-off-by: Paulo Neves <paulo@myneves.com>
> ---
>  lib/bb/fetch2/git.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 2e3d32515..a3f29d2b9 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -687,7 +687,7 @@ class Git(FetchMethod):
>          Return True if git-lfs can be found, False otherwise.
>          """
>          import shutil
> -        return shutil.which("git-lfs", path=d.getVar('PATH')) is not None
> +        return shutil.which("git-lfs", path=d.getVar('PATH'))
> 
>      def _get_repo_url(self, ud):
>          """

I don't agree with this change since currently the function does return
True/False as it says in the docstring but after your change, it
returns other things.

Yes, evaluating these in python will result in True/False and that is
safe but that isn't what it is documented to return.

Cheers,

Richard


  reply	other threads:[~2023-02-22 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 17:00 [PATCH 1/5] tests: git-lfs: Restore _find_git_lfs Paulo Neves
2023-02-17 17:00 ` [PATCH 2/5] test: Add real git lfs tests and decorator Paulo Neves
2023-02-17 17:00 ` [PATCH 3/5] git: Remove is None check on _find_git_lfs Paulo Neves
2023-02-22 12:03   ` Richard Purdie [this message]
2023-02-17 17:01 ` [PATCH 4/5] git.py: @_contains_lfs: Removed unused variables Paulo Neves
2023-02-17 17:01 ` [PATCH 5/5] git.py Replace mkdtemp with TemporaryDirectory and avoid exception masking Paulo Neves
2023-02-22 12:01 ` [bitbake-devel] [PATCH 1/5] tests: git-lfs: Restore _find_git_lfs Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7508e1a2be0154ba2357fe44e6d614428cbcb965.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=paulo@myneves.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).