Skip to content

Commit

Permalink
Fix undetected path issues on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dalito committed Jan 11, 2025
1 parent 141117f commit cf9e94b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions linkml_runtime/linkml_model/linkml_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pathlib import Path
from pathlib import Path, PurePath
from enum import Enum, auto
from typing import Dict, Optional, Union, Tuple, NamedTuple
from urllib.parse import urljoin
Expand Down Expand Up @@ -152,7 +152,7 @@ def LOCAL_PATH_FOR(source: Source, fmt: Format) -> str:


def GITHUB_IO_PATH_FOR(source: Source, fmt: Format, version="latest") -> str:
path = '/'.join([version, 'linkml_model', *_build_path(source, fmt)])
path = PurePath(version, 'linkml_model', *_build_path(source, fmt)).as_posix()
return urljoin(GITHUB_IO_BASE, path)


Expand All @@ -178,7 +178,7 @@ def tag_to_commit(tag: str) -> str:

# Return the absolute latest entry for branch
if release is ReleaseTag.LATEST or (release is ReleaseTag.CURRENT and branch != "main"):
path = '/'.join([branch, 'linkml_model', *_build_path(source, fmt)])
path = PurePath(branch, 'linkml_model', *_build_path(source, fmt)).as_posix()
return urljoin(GITHUB_BASE, path)

# Return the latest published version
Expand Down
5 changes: 3 additions & 2 deletions linkml_runtime/utils/schemaview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from functools import lru_cache
from copy import copy, deepcopy
from collections import defaultdict, deque
from pathlib import Path
from pathlib import Path, PurePath
from typing import Mapping, Optional, Tuple, TypeVar
import warnings

Expand Down Expand Up @@ -304,7 +304,8 @@ def imports_closure(self, imports: bool = True, traverse: Optional[bool] = None,
# we should treat the two `types.yaml` as separate schemas from the POV of the
# origin schema.
if sn.startswith('.') and ':' not in i:
i = os.path.normpath(str(Path(sn).parent / i))
# This cannot be simplified. os.path.normpath() must be called before .as_posix()
i = PurePath(os.path.normpath(PurePath(sn).parent / i)).as_posix()
todo.append(i)

# add item to closure
Expand Down

0 comments on commit cf9e94b

Please sign in to comment.