Update src/Package.py

dev
anulax ago%!(EXTRA string=2 months)
parent 92f468bfa4
commit 18b5137083
  1. 12
      src/Package.py

@ -61,7 +61,7 @@ def reconfig():
f_linker.write(includes + links)
f_linker.close()
def install(author, package) -> None:
def install(author, package, repo) -> None:
Log.info(f"Installing package {package}")
if os.path.exists(f"./vendor/{package}"):
Log.warning(f"Package {package} already added")
@ -70,19 +70,19 @@ def install(author, package) -> None:
conf = json.loads(conf)
if len(conf["packages"]) > 0:
for pkg in conf["packages"]:
install(pkg["author"], pkg["name"])
install(pkg["author"], pkg["name"], pkg["repo"] if "repo" in pkg else "git.anulax.ch")
return
if not ToolChaine.tool_exist("git"):
Log.error("Tool missing git")
Command.exec(f"git clone --depth 5 https://github.com/{author}/{package} ./vendor/{package}")
Command.exec(f"git clone --depth 5 https://{repo}/{author}/{package} ./vendor/{package}")
if os.path.exists(f"./vendor/{package}/package.json"):
conf = open(f"./vendor/{package}/package.json", "r").read()
conf = json.loads(conf)
if len(conf["packages"]) > 0:
for pkg in conf["packages"]:
install(pkg["author"], pkg["name"])
install(pkg["author"], pkg["name"], pkg["repo"] if "repo" in pkg else "git.anulax.ch")
def add(author, package) -> None:
f_conf = open("./package.json", "r")
@ -149,7 +149,7 @@ def install_root() -> None:
conf = json.loads(f_conf.read())
f_conf.close()
for pkg in conf["packages"]:
install(pkg["author"], pkg["name"])
install(pkg["author"], pkg["name"], pkg["repo"] if "repo" in pkg else "git.anulax.ch")
reconfig()
def load_doc(package) -> None:
@ -158,4 +158,4 @@ def load_doc(package) -> None:
if not os.path.exists(f"./vendor/{package}/Doxyfile"):
Log.error("Doxygen config file not found")
Command.exec(f"doxygen ./vendor/{package}")
webbrowser.open("file://" + os.path.realpath(f"./vendor/{package}/docs/html/index.html"))
webbrowser.open("file://" + os.path.realpath(f"./vendor/{package}/docs/html/index.html"))

Loading…
Cancel
Save