diff --git a/micropython/mip/mip/__init__.py b/micropython/mip/mip/__init__.py index 68daf32f..309d8674 100644 --- a/micropython/mip/mip/__init__.py +++ b/micropython/mip/mip/__init__.py @@ -1,5 +1,6 @@ # MicroPython package installer # MIT license; Copyright (c) 2022 Jim Mussared +# Implement gitlab, Copyrigh (c) 2024 Olivier Lenoir from micropython import const import requests @@ -73,6 +74,18 @@ def _rewrite_url(url, branch=None): + "/" + "/".join(url[2:]) ) + if url.startswith("gitlab:"): + url = url[7:].split("/") + url = ( + "https://gitlab.com/" + + url[0] + + "/" + + url[1] + + "/-/raw/" + + branch + + "/" + + "/".join(url[2:]) + ) return url @@ -128,6 +141,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))