Skip to content

Commit 57cbc34

Browse files
OlivierLenoirdpgeorge
authored andcommitted
mip: Add support to mip install from GitLab.
Modify _rewrite_url() to allow mip install from `gitlab:` repository. Signed-off-by: Olivier Lenoir <[email protected]>
1 parent 583bc0d commit 57cbc34

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

micropython/mip/mip/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ def _rewrite_url(url, branch=None):
7373
+ "/"
7474
+ "/".join(url[2:])
7575
)
76+
elif url.startswith("gitlab:"):
77+
url = url[7:].split("/")
78+
url = (
79+
"https://gitlab.com/"
80+
+ url[0]
81+
+ "/"
82+
+ url[1]
83+
+ "/-/raw/"
84+
+ branch
85+
+ "/"
86+
+ "/".join(url[2:])
87+
)
7688
return url
7789

7890

@@ -128,6 +140,7 @@ def _install_package(package, index, target, version, mpy):
128140
package.startswith("http://")
129141
or package.startswith("https://")
130142
or package.startswith("github:")
143+
or package.startswith("gitlab:")
131144
):
132145
if package.endswith(".py") or package.endswith(".mpy"):
133146
print("Downloading {} to {}".format(package, target))

0 commit comments

Comments
 (0)