diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-17 23:56:51 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-17 23:56:51 -0400 |
commit | 84c8905d527893bedc673e8a036b8b2ec89368b4 (patch) | |
tree | ffe8f20e45a5d6fdcc19927ae237c1bea2d769e0 /mesonbuild | |
parent | 1fd70a2a004900b7d97d9fc560e87d33266ecfed (diff) | |
download | meson-84c8905d527893bedc673e8a036b8b2ec89368b4.zip meson-84c8905d527893bedc673e8a036b8b2ec89368b4.tar.gz meson-84c8905d527893bedc673e8a036b8b2ec89368b4.tar.bz2 |
Revert "Add fs.relative_to()"
This reverts commit f52bcaa27fc125ab9ae583af466ba99c164169f3.
It did not pass CI, and was merged anyway because there were two CI
errors in the same cygwin job. The other error was not the fault of this
commit, and since cygwin errors were glossed over because they were
"expected", the presence of a new error *added* by this commit was
overlooked.
Per the meson development policy, PRs which result in CI errors
can/should be reverted at will, no questions asked.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/modules/fs.py | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index 89aead0..53174d2 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.py @@ -20,16 +20,19 @@ import typing as T from . import ExtensionModule, ModuleReturnValue, ModuleInfo from .. import mlog -from ..build import BuildTarget, CustomTarget, CustomTargetIndex, InvalidArguments +from ..build import CustomTarget, InvalidArguments from ..interpreter.type_checking import INSTALL_KW, INSTALL_MODE_KW, INSTALL_TAG_KW, NoneType from ..interpreterbase import FeatureNew, KwargInfo, typed_kwargs, typed_pos_args, noKwargs -from ..mesonlib import File, MesonException, has_path_sep, path_is_in_root, relpath +from ..mesonlib import ( + File, + MesonException, + has_path_sep, + path_is_in_root, +) if T.TYPE_CHECKING: from . import ModuleState - from ..build import BuildTargetTypes from ..interpreter import Interpreter - from ..interpreterbase import TYPE_kwargs from ..mesonlib import FileOrString, FileMode from typing_extensions import TypedDict @@ -72,7 +75,6 @@ class FSModule(ExtensionModule): 'stem': self.stem, 'read': self.read, 'copyfile': self.copyfile, - 'relative_to': self.relative_to, }) def _absolute_dir(self, state: 'ModuleState', arg: 'FileOrString') -> Path: @@ -310,23 +312,6 @@ class FSModule(ExtensionModule): return ModuleReturnValue(ct, [ct]) - @FeatureNew('fs.relative_to', '1.3.0') - @typed_pos_args('fs.relative_to', (str, File, CustomTarget, CustomTargetIndex, BuildTarget), (str, File, CustomTarget, CustomTargetIndex, BuildTarget)) - @noKwargs - def relative_to(self, state: ModuleState, args: T.Tuple[T.Union[FileOrString, BuildTargetTypes], T.Union[FileOrString, BuildTargetTypes]], kwargs: TYPE_kwargs) -> str: - def to_path(arg: T.Union[FileOrString, CustomTarget, CustomTargetIndex, BuildTarget]) -> str: - if isinstance(arg, File): - return arg.absolute_path(state.environment.source_dir, state.environment.build_dir) - elif isinstance(arg, (CustomTarget, CustomTargetIndex, BuildTarget)): - return state.backend.get_target_filename_abs(arg) - else: - return os.path.join(state.environment.source_dir, state.subdir, arg) - - t = to_path(args[0]) - f = to_path(args[1]) - - return relpath(t, f) - def initialize(*args: T.Any, **kwargs: T.Any) -> FSModule: return FSModule(*args, **kwargs) |