Initial multiple repository support
And lots of code reshuffling which likely should've been done in separate commits..
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import bpy
|
||||
from . import bpkg
|
||||
from pathlib import Path
|
||||
import logging
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
def fmt_version(version_number: tuple) -> str:
|
||||
"""Take version number as a tuple and format it as a string"""
|
||||
@@ -7,16 +12,18 @@ def fmt_version(version_number: tuple) -> str:
|
||||
vstr += "." + str(component)
|
||||
return vstr
|
||||
|
||||
def parse_repository_url(url: str) -> str:
|
||||
def sanitize_repository_url(url: str) -> str:
|
||||
"""Sanitize repository url"""
|
||||
from urllib.parse import urlsplit, urlunsplit
|
||||
parsed_url = urlsplit(url)
|
||||
new_path = parsed_url.path.rstrip("repo.json")
|
||||
# new_path = parsed_url.path.rstrip("repo.json")
|
||||
new_path = parsed_url.path
|
||||
return urlunsplit((parsed_url.scheme, parsed_url.netloc, new_path, parsed_url.query, parsed_url.fragment))
|
||||
|
||||
def add_repojson_to_url(url: str) -> str:
|
||||
"""Add repo.json to a url"""
|
||||
"""Add `repo.json` to the path component of a url"""
|
||||
from urllib.parse import urlsplit, urlunsplit
|
||||
parsed_url = urlsplit(url)
|
||||
new_path = str(Path(parsed_url.path) / "repo.json")
|
||||
return urlunsplit((parsed_url.scheme, parsed_url.netloc, new_path, parsed_url.query, parsed_url.fragment))
|
||||
|
||||
|
Reference in New Issue
Block a user