From 57cbc3484060f646deb0f4f652abcca4732b3458 Mon Sep 17 00:00:00 2001 From: Olivier Lenoir Date: Fri, 1 Mar 2024 12:18:35 +0100 Subject: [PATCH] mip: Add support to mip install from GitLab. Modify _rewrite_url() to allow mip install from `gitlab:` repository. Signed-off-by: Olivier Lenoir --- micropython/mip/mip/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/micropython/mip/mip/__init__.py b/micropython/mip/mip/__init__.py index 68daf32f..0c3c6f20 100644 --- a/micropython/mip/mip/__init__.py +++ b/micropython/mip/mip/__init__.py @@ -73,6 +73,18 @@ def _rewrite_url(url, branch=None): + "/" + "/".join(url[2:]) ) + elif url.startswith("gitlab:"): + url = url[7:].split("/") + url = ( + "https://gitlab.com/" + + url[0] + + "/" + + url[1] + + "/-/raw/" + + branch + + "/" + + "/".join(url[2:]) + ) return url @@ -128,6 +140,7 @@ def _install_package(package, index, target, version, mpy): package.startswith("http://") or package.startswith("https://") or package.startswith("github:") + or package.startswith("gitlab:") ): if package.endswith(".py") or package.endswith(".mpy"): print("Downloading {} to {}".format(package, target))