kopia lustrzana https://github.com/micropython/micropython-lib
Update __init__.py implement gitlab:
Implement gitlab: def _rewrite_url(url, branch=None): if not branch: branch = "HEAD" if url.startswith("github:"): url = url[7:].split("/") url = ( "https://raw.githubusercontent.com/" + url[0] + "/" + url[1] + "/" + branch + "/" + "/".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 #... def _install_package(package, index, target, version, mpy): if ( package.startswith("http://") or package.startswith("https://") or package.startswith("github:") or package.startswith("gitlab:") ): #...pull/815/head
rodzic
ffb07dbce5
commit
ef7610b762
|
@ -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))
|
||||
|
|
Ładowanie…
Reference in New Issue