Skip to content

Commit

Permalink
make external_project work again on MinGW
Browse files Browse the repository at this point in the history
On Python 3.12, self.prefix.relative_to(self.prefix.drive) no longer
works and raises error like:

```
ValueError: 'C:/msys64/mingw64' is not in the subpath of 'C:'
```
  • Loading branch information
MihailJP authored and eli-schwartz committed Nov 19, 2024
1 parent 33376ef commit fb2c3b3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mesonbuild/modules/external_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ..interpreter.type_checking import ENV_KW, DEPENDS_KW
from ..interpreterbase.decorators import ContainerTypeInfo, KwargInfo, typed_kwargs, typed_pos_args
from ..mesonlib import (EnvironmentException, MesonException, Popen_safe, MachineChoice,
get_variable_regex, do_replacement, join_args)
get_variable_regex, do_replacement, join_args, relpath)
from ..options import OptionKey

if T.TYPE_CHECKING:
Expand Down Expand Up @@ -93,10 +93,10 @@ def __init__(self,
# will install files into "c:/bar/c:/foo" which is an invalid path.
# Work around that issue by removing the drive from prefix.
if self.prefix.drive:
self.prefix = self.prefix.relative_to(self.prefix.drive)
self.prefix = Path(relpath(self.prefix, self.prefix.drive))

# self.prefix is an absolute path, so we cannot append it to another path.
self.rel_prefix = self.prefix.relative_to(self.prefix.root)
self.rel_prefix = Path(relpath(self.prefix, self.prefix.root))

self._configure(state)

Expand Down

0 comments on commit fb2c3b3

Please sign in to comment.