Compare commits

...

3 commits

Author SHA1 Message Date
fdea0af27c
.parse
Some checks failed
/ job (push) Failing after 7m55s
2024-07-14 20:04:59 +02:00
685d3a31e0
project,projects 2024-07-14 20:02:56 +02:00
77e9dc6601
util.add_url_path 2024-07-14 20:00:30 +02:00
3 changed files with 13 additions and 4 deletions

View file

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

View file

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

View file

@ -1,11 +1,18 @@
import os
from pathlib import Path
from urllib.parse import urlparse, urlunparse
import env
from rwx import fs
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:
paths = []
for directory, _, files in os.walk(root):