Skip to content

Commit d60d1a2

Browse files
committed
Fix undetected path issues on Windows
1 parent 3b86e10 commit d60d1a2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

linkml_runtime/linkml_model/linkml_files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pathlib import Path
1+
from pathlib import Path, PurePath
22
from enum import Enum, auto
33
from typing import Dict, Optional, Union, Tuple, NamedTuple
44
from urllib.parse import urljoin
@@ -152,7 +152,7 @@ def LOCAL_PATH_FOR(source: Source, fmt: Format) -> str:
152152

153153

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

158158

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

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

184184
# Return the latest published version

linkml_runtime/utils/schemaview.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from functools import lru_cache
66
from copy import copy, deepcopy
77
from collections import defaultdict, deque
8-
from pathlib import Path
8+
from pathlib import Path, PurePath
99
from typing import Mapping, Optional, Tuple, TypeVar
1010
import warnings
1111

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

310311
# add item to closure

0 commit comments

Comments
 (0)