Compare commits

..

No commits in common. "fdea0af27cac6284832d96f735aeaad6120966a6" and "678d9e0e4d792256e53b505706620eda76c7dba0" have entirely different histories.

3 changed files with 4 additions and 13 deletions

View file

@ -4,8 +4,7 @@ from __future__ import annotations
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from urllib.parse import urljoin
from spcd.util import add_url_path
if TYPE_CHECKING: if TYPE_CHECKING:
from spcd.projects import Projects from spcd.projects import Projects
@ -40,7 +39,7 @@ class Project:
if value := projects.environment.get(variable, None): if value := projects.environment.get(variable, None):
self.root = value self.root = value
# url # url
self.url = add_url_path(projects.url, self.name) self.url = urljoin(projects.url, self.name)
def __str__(self: Project) -> str: def __str__(self: Project) -> str:
return f"""\ return f"""\

View file

@ -4,8 +4,7 @@ from __future__ import annotations
import os import os
from pathlib import Path from pathlib import Path
from urllib.parse import urljoin
from spcd.util import add_url_path
GROUP_AND_NAME = [ GROUP_AND_NAME = [
"GITHUB_REPOSITORY", "GITHUB_REPOSITORY",
@ -29,7 +28,7 @@ class Projects:
# url # url
for variable in SERVER_URL: for variable in SERVER_URL:
if value := self.environment.get(variable, None): if value := self.environment.get(variable, None):
self.url = add_url_path(value, self.group) self.url = urljoin(value, self.group)
def __str__(self: Projects) -> str: def __str__(self: Projects) -> str:
return f"""\ return f"""\

View file

@ -1,18 +1,11 @@
import os import os
from pathlib import Path from pathlib import Path
from urllib.parse import urlparse, urlunparse
import env import env
from rwx import fs from rwx import fs
from rwx.log import stream as log from rwx.log import stream as log
def add_url_path(url: str, extra_path: str) -> str:
parts = urlparse(url)
parts._replace(path=Path(parts.path) / extra_path)
return urlunparse(parts)
def browse(root: str) -> None: def browse(root: str) -> None:
paths = [] paths = []
for directory, _, files in os.walk(root): for directory, _, files in os.walk(root):