Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marcus Hoffmann via buildroot <buildroot@buildroot.org>
To: buildroot@buildroot.org
Subject: [Buildroot] [next 1/2] package/pkg-download: add pypi helper for downloading packages from pypi.org
Date: Fri, 29 May 2026 23:36:47 +0200	[thread overview]
Message-ID: <20260529213651.548156-1-buildroot@bubu1.eu> (raw)

Pypi provides packages under a stable url (instead of the hash based one
that changes every version) but we don't currently make use of that a lot.

Introduce a pypi helper function analougous to the github and gitlab
helpers to make it easier to download packages from pypi using this url
scheme.

For that we introduce a firstchar function (written by Peter) which
returns the first character in a string without spawning a shell.

Co-developed-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
 package/pkg-download.mk | 3 +++
 support/misc/utils.mk   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index ce63ce9658..160c512599 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -56,6 +56,9 @@ github = https://github.com/$(1)/$(2)/archive/$(3)
 # gitlab(user,package,version): returns site of Gitlab-generated tarball
 gitlab = https://gitlab.com/$(1)/$(2)/-/archive/$(3)
 
+# pypi(package): returns site of pypi.org hosted packge
+pypi = https://files.pythonhosted.org/packages/source/$(call firstchar,$(1))/$(1)
+
 # Expressly do not check hashes for those files
 BR_NO_CHECK_HASH_FOR =
 
diff --git a/support/misc/utils.mk b/support/misc/utils.mk
index 5275006d6d..3caf06274f 100644
--- a/support/misc/utils.mk
+++ b/support/misc/utils.mk
@@ -62,6 +62,9 @@ endef
 $(eval $(call caseconvert-helper,UPPERCASE,$(join $(addsuffix :,$([FROM])),$([TO]))))
 $(eval $(call caseconvert-helper,LOWERCASE,$(join $(addsuffix :,$([TO])),$([FROM]))))
 
+# extracts the first character of a string
+firstchar = $(if $(1),$(strip $(foreach c,$([FROM]) / $([TO]),$(if $(patsubst $(c)%,,$(1)),,$(c)))))
+
 # Reverse the orders of words in a list. Again, inspired by the gmsl
 # 'reverse' macro.
 reverse = $(if $(1),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)))
-- 
2.54.0

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

             reply	other threads:[~2026-05-29 21:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 21:36 Marcus Hoffmann via buildroot [this message]
2026-05-29 21:36 ` [Buildroot] [next 2/2] package: switch all pypi download urls to pypi helper Marcus Hoffmann via buildroot
2026-05-31 12:20 ` [Buildroot] [next 1/2] package/pkg-download: add pypi helper for downloading packages from pypi.org Titouan Christophe via buildroot
2026-05-31 21:27 ` James Hilliard
2026-06-15 20:26   ` Marcus Hoffmann via buildroot
2026-06-16  0:18     ` James Hilliard

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=20260529213651.548156-1-buildroot@bubu1.eu \
    --to=buildroot@buildroot.org \
    --cc=buildroot@bubu1.eu \
    /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