mirror of
https://github.com/mesonbuild/meson.git
synced 2026-06-30 19:57:45 +00:00
add FeatureNew
This commit is contained in:
committed by
Michael Hirsch, Ph.D
parent
5bbeab8ed4
commit
2bbd57092f
@@ -42,6 +42,8 @@ by the string is a symbolic link.
|
||||
|
||||
### is_absolute
|
||||
|
||||
*since 0.54.0*
|
||||
|
||||
Return a boolean indicating if the path string specified is absolute, WITHOUT expanding `~`.
|
||||
|
||||
Examples:
|
||||
@@ -104,18 +106,22 @@ The files need not actually exist yet for these path string manipulation methods
|
||||
|
||||
### expanduser
|
||||
|
||||
*since 0.54.0*
|
||||
|
||||
A path string with a leading `~` is expanded to the user home directory
|
||||
|
||||
Examples:
|
||||
|
||||
```meson
|
||||
fs.expanduser('~') # home directory
|
||||
fs.expanduser('~') # user home directory
|
||||
|
||||
fs.expanduser('~/foo') # <homedir>/foo
|
||||
```
|
||||
|
||||
### as_posix
|
||||
|
||||
*since 0.54.0*
|
||||
|
||||
`fs.as_posix(path)` assumes a Windows path, even if on a Unix-like system.
|
||||
Thus, all `'\'` or `'\\'` are turned to '/', even if you meant to escape a character.
|
||||
|
||||
@@ -180,6 +186,8 @@ fs.name('foo/bar/baz.dll.a') # baz.dll.a
|
||||
|
||||
### stem
|
||||
|
||||
*since 0.54.0*
|
||||
|
||||
Returns the last component of the path, dropping the last part of the suffix
|
||||
|
||||
```meson
|
||||
|
||||
@@ -20,6 +20,7 @@ from .. import mlog
|
||||
from . import ExtensionModule
|
||||
from . import ModuleReturnValue
|
||||
from ..mesonlib import MesonException
|
||||
from ..interpreterbase import FeatureNew
|
||||
|
||||
from ..interpreterbase import stringArgs, noKwargs
|
||||
if T.TYPE_CHECKING:
|
||||
@@ -62,6 +63,7 @@ class FSModule(ExtensionModule):
|
||||
|
||||
@stringArgs
|
||||
@noKwargs
|
||||
@FeatureNew('fs.expanduser', '0.54.0')
|
||||
def expanduser(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
|
||||
if len(args) != 1:
|
||||
raise MesonException('fs.expanduser takes exactly one argument.')
|
||||
@@ -69,6 +71,7 @@ class FSModule(ExtensionModule):
|
||||
|
||||
@stringArgs
|
||||
@noKwargs
|
||||
@FeatureNew('fs.is_absolute', '0.54.0')
|
||||
def is_absolute(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
|
||||
if len(args) != 1:
|
||||
raise MesonException('fs.is_absolute takes exactly one argument.')
|
||||
@@ -76,6 +79,7 @@ class FSModule(ExtensionModule):
|
||||
|
||||
@stringArgs
|
||||
@noKwargs
|
||||
@FeatureNew('fs.as_posix', '0.54.0')
|
||||
def as_posix(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
|
||||
"""
|
||||
this function assumes you are passing a Windows path, even if on a Unix-like system
|
||||
@@ -181,6 +185,7 @@ class FSModule(ExtensionModule):
|
||||
|
||||
@stringArgs
|
||||
@noKwargs
|
||||
@FeatureNew('fs.stem', '0.54.0')
|
||||
def stem(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
|
||||
if len(args) != 1:
|
||||
raise MesonException('fs.stem takes exactly one argument.')
|
||||
|
||||
Reference in New Issue
Block a user