mip: Add support to mip install from GitLab.

Modify _rewrite_url() to allow mip install from `gitlab:` repository.

Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
pull/848/head
Olivier Lenoir 2024-03-01 12:18:35 +01:00 zatwierdzone przez Damien George
rodzic 583bc0da70
commit 57cbc34840
1 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -73,6 +73,18 @@ def _rewrite_url(url, branch=None):
+ "/" + "/"
+ "/".join(url[2:]) + "/".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 return url
@ -128,6 +140,7 @@ def _install_package(package, index, target, version, mpy):
package.startswith("http://") package.startswith("http://")
or package.startswith("https://") or package.startswith("https://")
or package.startswith("github:") or package.startswith("github:")
or package.startswith("gitlab:")
): ):
if package.endswith(".py") or package.endswith(".mpy"): if package.endswith(".py") or package.endswith(".mpy"):
print("Downloading {} to {}".format(package, target)) print("Downloading {} to {}".format(package, target))