Skip to content

Commit

Permalink
Use clearer FeatureNew names is the fs module
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan957 committed Oct 22, 2023
1 parent 9dfd1cd commit c82f51d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mesonbuild/modules/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def expanduser(self, state: 'ModuleState', args: T.Tuple[str], kwargs: T.Dict[st
@typed_pos_args('fs.is_absolute', (str, File))
def is_absolute(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> bool:
if isinstance(args[0], File):
FeatureNew('fs.is_absolute_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.is_absolute(file)', '0.59.0').use(state.subproject, location=state.current_node)
return PurePath(str(args[0])).is_absolute()

@noKwargs
Expand All @@ -130,7 +130,7 @@ def exists(self, state: 'ModuleState', args: T.Tuple[str], kwargs: T.Dict[str, T
@typed_pos_args('fs.is_symlink', (str, File))
def is_symlink(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> bool:
if isinstance(args[0], File):
FeatureNew('fs.is_symlink_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.is_symlink(file)', '0.59.0').use(state.subproject, location=state.current_node)
return self._absolute_dir(state, args[0]).is_symlink()

@noKwargs
Expand All @@ -147,7 +147,7 @@ def is_dir(self, state: 'ModuleState', args: T.Tuple[str], kwargs: T.Dict[str, T
@typed_pos_args('fs.hash', (str, File), str)
def hash(self, state: 'ModuleState', args: T.Tuple['FileOrString', str], kwargs: T.Dict[str, T.Any]) -> str:
if isinstance(args[0], File):
FeatureNew('fs.hash_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.hash(file)', '0.59.0').use(state.subproject, location=state.current_node)
file = self._resolve_dir(state, args[0])
if not file.is_file():
raise MesonException(f'{file} is not a file and therefore cannot be hashed')
Expand All @@ -163,7 +163,7 @@ def hash(self, state: 'ModuleState', args: T.Tuple['FileOrString', str], kwargs:
@typed_pos_args('fs.size', (str, File))
def size(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> int:
if isinstance(args[0], File):
FeatureNew('fs.size_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.size(file)', '0.59.0').use(state.subproject, location=state.current_node)
file = self._resolve_dir(state, args[0])
if not file.is_file():
raise MesonException(f'{file} is not a file and therefore cannot be sized')
Expand All @@ -176,7 +176,7 @@ def size(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Di
@typed_pos_args('fs.is_samepath', (str, File), (str, File))
def is_samepath(self, state: 'ModuleState', args: T.Tuple['FileOrString', 'FileOrString'], kwargs: T.Dict[str, T.Any]) -> bool:
if isinstance(args[0], File) or isinstance(args[1], File):
FeatureNew('fs.is_samepath_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.is_samepath(file)', '0.59.0').use(state.subproject, location=state.current_node)
file1 = self._resolve_dir(state, args[0])
file2 = self._resolve_dir(state, args[1])
if not file1.exists():
Expand All @@ -192,7 +192,7 @@ def is_samepath(self, state: 'ModuleState', args: T.Tuple['FileOrString', 'FileO
@typed_pos_args('fs.replace_suffix', (str, File), str)
def replace_suffix(self, state: 'ModuleState', args: T.Tuple['FileOrString', str], kwargs: T.Dict[str, T.Any]) -> str:
if isinstance(args[0], File):
FeatureNew('fs.replace_suffix_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.replace_suffix(file)', '0.59.0').use(state.subproject, location=state.current_node)
original = PurePath(str(args[0]))
new = original.with_suffix(args[1])
return str(new)
Expand All @@ -201,7 +201,7 @@ def replace_suffix(self, state: 'ModuleState', args: T.Tuple['FileOrString', str
@typed_pos_args('fs.parent', (str, File))
def parent(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> str:
if isinstance(args[0], File):
FeatureNew('fs.parent_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.parent(file)', '0.59.0').use(state.subproject, location=state.current_node)
original = PurePath(str(args[0]))
new = original.parent
return str(new)
Expand All @@ -210,7 +210,7 @@ def parent(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.
@typed_pos_args('fs.name', (str, File))
def name(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> str:
if isinstance(args[0], File):
FeatureNew('fs.name_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.name(file)', '0.59.0').use(state.subproject, location=state.current_node)
original = PurePath(str(args[0]))
new = original.name
return str(new)
Expand All @@ -220,7 +220,7 @@ def name(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Di
@FeatureNew('fs.stem', '0.54.0')
def stem(self, state: 'ModuleState', args: T.Tuple['FileOrString'], kwargs: T.Dict[str, T.Any]) -> str:
if isinstance(args[0], File):
FeatureNew('fs.stem_file', '0.59.0').use(state.subproject, location=state.current_node)
FeatureNew('fs.stem(file)', '0.59.0').use(state.subproject, location=state.current_node)
original = PurePath(str(args[0]))
new = original.stem
return str(new)
Expand Down

0 comments on commit c82f51d

Please sign in to comment.