Skip to content

Commit c16559a

Browse files
committed
Add Path.is_relative_to for python 3.8...
was added only in 3.9
1 parent 0fc02c8 commit c16559a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

developer/python/verify_signature.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ class Generator(Enum):
1818
# BUNDLED_APPS = []
1919

2020

21+
# Path.is_relative_to was added only in Python 3.9
22+
if not hasattr(Path, 'is_relative_to'):
23+
def _is_relative_to(self, other):
24+
if not isinstance(other, Path):
25+
other = Path(other)
26+
return other == self or other in self.parents
27+
Path.is_relative_to = _is_relative_to
28+
29+
2130
def get_cmake_install_prefix_for_generator(build_dir: Path, generator: Generator, component: str = None) -> Path:
2231
cpack_dir = build_dir / f"_CPack_Packages/Darwin/{generator.name}"
2332
if not cpack_dir.exists():

0 commit comments

Comments
 (0)