summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/fs.py
Commit message (Collapse)AuthorAgeFilesLines
* mass rewrite of string formatting to use f-strings everywhereEli Schwartz2021-03-041-2/+2
| | | | performed by running "pyupgrade --py36-plus" and committing the results
* various python neatness cleanupsEli Schwartz2021-03-041-1/+1
| | | | | | | | | | | | | | | | All changes were created by running "pyupgrade --py3-only --keep-percent-format" and committing the results. I have not touched string formatting for now. - use set literals - simplify .format() parameter naming - remove __future__ - remove default "r" mode for open() - use OSError rather than compatibility aliases - remove stray parentheses in function(generator) scopes
* Simplify module APIXavier Claessens2021-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - ModuleState is now a real class that will have methods in the future for actions modules needs, instead of using interpreter internal API. - New ModuleObject base class, similar to InterpreterObject, that should be used by all objects returned by modules. Its methods gets the ModuleState passed as first argument. It has a `methods` dictionary to define what is public API that can be called from build definition. - Method return value is not required to be a ModuleReturnValue any more, it can be any type that interpreter can holderify, including ModuleObject. - Legacy module API is maintained until we port all modules. In the future modules should be updated: - Use methods dict. - Remove snippets. - Custom objects returned by modules should all be subclass of ModuleObject to get the state iface in their methods. - Modules should never call into interpreter directly and instead state object should have wrapper API. - Stop using ModuleReturnValue in methods that just return simple objects like strings. Possibly remove ModuleReturnValue completely since all objects that needs to be processed by interpreter (e.g. CustomTarget) should be created through ModuleState API.
* modules/fs: Use typed_pos_argsDylan Baker2021-02-261-75/+40
|
* Introduce `fs.read` to read a file as a stringLuke Drummond2021-02-041-1/+64
| | | | | | | | | | | | | | | | | Following #7890, this patch introduces the ability to read the contents of a file to the fs module. This patch introduces the ability to read files at configure time, but has some restrictions: - binary files are not supported (I don't think this will prove a problem, and if people are wanting to do something with binary files, they should probably be shelling out to their own script). - Only files outside the build directory allowed. This limitation should prevent build loops. Given that reading an arbitrary file at configure time can affect the configuration in almost arbitrary ways, meson should force a reconfigure when the given file changes. This is non-configurable, but this can easily be changed with a future keyword argument.
* Fix misspellsAntonin Décimo2021-01-131-1/+1
| | | | Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
* use real pathlib moduleDylan Baker2020-11-201-1/+1
| | | | | We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
* pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger2020-10-041-1/+1
|
* typing: fully annotate fs moduleDaniel Mensinger2020-09-081-4/+4
|
* add FeatureNewMichael Hirsch, Ph.D2020-02-061-0/+5
|
* add fs.stem()Michael Hirsch, Ph.D2020-02-061-2/+11
|
* fs: add expanduser methodMichael Hirsch, Ph.D2020-02-061-1/+8
| | | | | this should help users specify leading `~` in various Meson options and variables without refactoring lots of places inside Meson itself.
* fs: add methods as_posix, is_absoluteMichael Hirsch, Ph.D2020-02-061-7/+43
| | | | | | | | | | fs: make exception specify method name fs: actually raise exceptions fs: resolve path e.g. /opt/foo/.. => /opt/foo fs: correct behavior of is_symlink
* types: import typing as T (fixes #6333)Daniel Mensinger2020-01-081-13/+13
|
* fs: rename samefile => is_samepathMichael Hirsch, Ph.D2019-12-191-5/+5
| | | | | | | | | | is_samepath better reflects the nature of this function--that files and directories can be compared. Also, instead of raising exceptions, simply return False when one or both .is_samepath(path1, path1) don't exist. This is more intuitive behavior and avoids having an extra if fs.exist() to go with every fs.is_samepath()
* Add raise at the start of MesonExceptionMichael Brockus2019-12-041-7/+7
|
* fs: Add parent() and name() methodsXavier Claessens2019-11-251-0/+17
|
* fs: make replace_suffix not expand file to absolute path, just manipulate ↵Michael Hirsch, Ph.D2019-11-171-1/+1
| | | | the string
* fs: replace_suffixMichael Hirsch, Ph.D2019-11-171-1/+1
|
* fs: get file sizeMichael Hirsch, Ph.D2019-11-171-2/+38
| | | | fs: add samefile
* fs: add hash compute methodMichael Hirsch, Ph.D2019-11-171-0/+18
|
* add fs.with_suffixMichael Hirsch, Ph.D2019-11-171-1/+11
|
* fs: improve exception feedbackMichael Hirsch, Ph.D2019-11-171-1/+1
|
* fs: use expanduserMichael Hirsch, Ph.D2019-11-171-1/+1
|
* fs: deduplicate functionsMichael Hirsch, Ph.D2019-11-171-8/+5
|
* fs: use pathlib.Path, add type hint checkMichael Hirsch, Ph.D2019-11-171-14/+17
|
* Created the filesystem module.Jussi Pakkanen2019-11-081-0/+59