Commit Graph

27 Commits

Author SHA1 Message Date
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
Dylan Baker 6843f56f6b modules: use module level information about new and deprecation
Instead of using FeatureNew/FeatureDeprecated in the module.

The goal here is to be able to handle information about modules in a
single place, instead of having to handle it separately. Each module
simply defines some metadata, and then the interpreter handles the rest.
2022-08-17 16:25:36 -04:00
Eli Schwartz 9c7868e343
python 3 module: type-check all posargs
Yes, it's deprecated, but we can still stop people doing the wrong thing
with it if they are still using it.
2022-03-24 02:07:02 -04:00
Eli Schwartz 688b4bac76 add FeatureNew decorators for various modules that were lacking them
Going back to 0.38, though some of them are far older. The original
implementation of FeatureNew only added backdated feature checks that
far, anyway.
2021-12-31 12:03:57 +02:00
Xavier Claessens 2e02ef6592 modules: Add methods dict everywhere
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
2021-05-28 15:17:10 -04:00
Xavier Claessens a734bcfc83 modules: Stop using ModuleReturnValue where it's not needed
It is only needed in functions that need to add targets to the
interpreter.
2021-05-28 15:17:10 -04:00
Xavier Claessens 723c5227a4 modules: Remove snippet methods
The only advantage they have is they have the interpreter in arguments,
but it's already available as self.interpreter. We should discourage
usage of the interpreter API and rely on ModuleState object instead in
the future.

This also lift the restriction that a module method cannot add build
targets, but that was not enforced for snippet methods anyway (and some
modules were doing it) and it's really loose restriction as it should
check for many other things if we wanted to make it consistent.
2021-05-28 15:17:10 -04:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
John Ericson 3a4388e51d Fix legacy env var support with cross
Fix #3969
2020-03-23 17:51:36 +02:00
John Ericson 2b22576fb6 Remove cross_info; cross file is parsed up front and discarded 2019-01-02 16:22:47 -05:00
Dylan Baker 091452f8cd modules/python3: allow specifying in the native file 2018-11-14 15:57:37 -08:00
Xavier Claessens 047db1c64c Print warning when using deprecated 'python3' module 2018-10-07 19:22:43 +03:00
Nirbheek Chauhan 817dcaa23b Remove permittedSnippetKwargs, snippets are not special
All we needed to do was change _get_callee_args() to also support
snippets.
2018-07-02 07:05:08 +00:00
Jussi Pakkanen bdb57cf62a Convert Gnome module to use find_program from interpreter. 2018-04-15 13:32:38 +05:30
Xavier Claessens cf0e997167 Remove duplicated list of known kwargs for build targets 2018-04-03 15:20:19 -04:00
Jon Turney cd5dba5358 Fix flake8 'imported but unused' reports
$ flake8 | grep F401
./meson.py:17:1: F401 'mesonbuild.mesonlib' imported but unused
./meson.py:18:1: F401 'locale' imported but unused
./run_unittests.py:24:1: F401 'sys' imported but unused
./mesonbuild/minit.py:2:1: F401 'pyclbr.Function' imported but unused
./mesonbuild/minit.py:18:1: F401 'os' imported but unused
./mesonbuild/backend/vs2010backend.py:15:1: F401 'sys' imported but unused
./mesonbuild/backend/xcodebackend.py:19:1: F401 'sys' imported but unused
./mesonbuild/dependencies/ui.py:20:1: F401 'shutil' imported but unused
./mesonbuild/modules/python3.py:15:1: F401 'sys' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..compilers' imported but unused
./mesonbuild/modules/unstable_icestorm.py:15:1: F401 '..mlog' imported but unused
./test cases/common/98 gen extra/srcgen3.py:3:1: F401 'os' imported but unused
2018-03-03 21:06:45 +00:00
Jussi Pakkanen 9d67e5030b Changed code to use detected executables rather than hardcoding sys.executable. 2017-11-20 23:08:17 +02:00
Luke Shumaker 4dbbb4884c flake8: Clean up complained-about unused imports
This also adds a "# noqa: F401" comment on an unused "import lzma",
which we are using it in a try/except block that is being used to
check if the lzma module is importable; of course it is unused.

v2: This turned out to be a little tricky.

    mesonbuild/modules/__init__.py had the "unused" import:

        from ..interpreterbase import permittedKwargs, noKwargs

    However, that meant that the various modules could do things like:

        from . import noKwargs # "." is "mesonbuild.modules"

    Which breaks when you remove __init__.py's "unused" import.  I
    could have tagged that import with "# noqa: F401", but instead I
    chose to have each of the module import directly from
    "..interpreterbase" instead of ".".
2017-09-21 13:41:03 -04:00
Guillaume Poirier-Morency 2653000ac7 python3: Add tests for platform-dependant paths and cover include path 2017-08-17 09:42:33 -04:00
Guillaume Poirier-Morency 92e2e1e2d8 python3: Fix 'sysconfig_path' for platform-dependant paths
Include 'platbase' for stripping the prefix for 'platlib' and 'platinclude'.

This is necessary for installing platform-dependant Python modules such as GI overrides.
2017-08-15 16:39:38 -04:00
Jussi Pakkanen 80d665e8de Converted some modules. 2017-06-26 21:10:27 +03:00
Patrick Griffis a9c30ce8b5 python3: Add sysconfig_path() method
This returns the value of sysconfig paths, useful for
installing modules for example.
2017-03-30 09:13:01 -04:00
Patrick Griffis b6e06dd80b python3: Add language_version() method 2017-03-30 09:13:01 -04:00
Jussi Pakkanen 6ac9a8e738 Add .find_python() method. Supersedes #777. 2017-01-09 21:23:18 +02:00
Jussi Pakkanen fbabe8ad85 There are two different kinds of extensions: modules that create new
objects directly and snippets that just call into interpreter methods.
2017-01-09 21:11:48 +02:00
Jussi Pakkanen 24221d71cc Created a Python 3 module for simpler building of Python extension modules. 2017-01-09 21:07:23 +02:00