Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: buildroot@busybox.net, Francois Perrad <fperrad@gmail.com>
Subject: Re: [Buildroot] [PATCH v2] support/scripts/pkg-stats: prefers stable version from release-monitoring.org
Date: Mon, 25 Oct 2021 14:29:26 +0200	[thread overview]
Message-ID: <877de1wamx.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20211019200643.GY2400@scaer> (Yann E. MORIN's message of "Tue, 19 Oct 2021 22:06:43 +0200")

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > François, All,
 > On 2021-09-01 16:10 +0200, Francois Perrad spake thusly:
 >> for example with libpng: 1.6.37 instead of 1.7.0beta89
 >> 
 >> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
 >> ---
 >> support/scripts/pkg-stats | 1 +
 >> 1 file changed, 1 insertion(+)
 >> 
 >> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
 >> index cc91d1316..249cc6afe 100755
 >> --- a/support/scripts/pkg-stats
 >> +++ b/support/scripts/pkg-stats
 >> @@ -485,6 +485,7 @@ async def check_package_get_latest_version_by_distro(session, pkg, retry=True):
 >> 
 >> data = await resp.json()
 >> version = data['version'] if 'version' in data else None
 >> +            version = data['stable_versions'][0] if 'stable_versions' in data else version

 > I've changed that to fit all in a single line:

 >     version = data['stable_versions'][0] if 'stable_versions' in data else data['version'] if 'version' in data else None

 > And it all fits in the allowed 132-char limit! :-)

;)

NIT: dict.get is handy for such use cases, E.G.

version = data.get('version')

is equivalent but quite a bit easier to read than:

version = data['version'] if 'version' in data else None


For this change I guess we could look at versions instead of version and
do something like:

# first element is the latest version
version = data.get('stable_versions', data.get('versions', [None]))[0]

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2021-10-25 12:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 14:10 [Buildroot] [PATCH v2] support/scripts/pkg-stats: prefers stable version from release-monitoring.org Francois Perrad
2021-10-19  6:09 ` François Perrad
2021-10-19 20:06 ` Yann E. MORIN
2021-10-25 12:29   ` Peter Korsgaard [this message]

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=877de1wamx.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    --cc=fperrad@gmail.com \
    --cc=yann.morin.1998@free.fr \
    /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