Compare commits
3 commits
678d9e0e4d
...
fdea0af27c
Author | SHA1 | Date | |
---|---|---|---|
fdea0af27c | |||
685d3a31e0 | |||
77e9dc6601 |
3 changed files with 13 additions and 4 deletions
|
@ -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"""\
|
||||
|
|
|
@ -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"""\
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue