Compare commits
No commits in common. "fdea0af27cac6284832d96f735aeaad6120966a6" and "678d9e0e4d792256e53b505706620eda76c7dba0" have entirely different histories.
fdea0af27c
...
678d9e0e4d
3 changed files with 4 additions and 13 deletions
|
@ -4,8 +4,7 @@ from __future__ import annotations
|
|||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from spcd.util import add_url_path
|
||||
from urllib.parse import urljoin
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from spcd.projects import Projects
|
||||
|
@ -40,7 +39,7 @@ class Project:
|
|||
if value := projects.environment.get(variable, None):
|
||||
self.root = value
|
||||
# url
|
||||
self.url = add_url_path(projects.url, self.name)
|
||||
self.url = urljoin(projects.url, self.name)
|
||||
|
||||
def __str__(self: Project) -> str:
|
||||
return f"""\
|
||||
|
|
|
@ -4,8 +4,7 @@ from __future__ import annotations
|
|||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from spcd.util import add_url_path
|
||||
from urllib.parse import urljoin
|
||||
|
||||
GROUP_AND_NAME = [
|
||||
"GITHUB_REPOSITORY",
|
||||
|
@ -29,7 +28,7 @@ class Projects:
|
|||
# url
|
||||
for variable in SERVER_URL:
|
||||
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:
|
||||
return f"""\
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
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