aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/python.py
AgeCommit message (Collapse)AuthorFilesLines
2021-01-04Use a single coredata dictionary for optionsDylan Baker1-1/+1
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
2020-11-20use real pathlib moduleDylan Baker1-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
2020-10-06python.dependency() is not respecting 'required' kwargXavier Claessens1-2/+9
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-05-10python: install_sources() should default to pure, following the docMarc-André Lureau1-1/+1
As stated by the doc, default to install python sources to purelib location, as they should not depend on platform. This also fixes discrepancy between get_install_dir() and install_sources() locations. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-04-28find_program: Fixes when the program has been overridden by executableXavier Claessens1-5/+5
- ExternalProgramHolder has path() method while CustomTargetHolder and BuildTargetHolder have full_path(). - The returned ExternalProgramHolder's path() method was broken, because build.Executable object has no get_path() method, it needs the backend. - find_program('overridden_prog', version : '>=1.0') was broken because it needs to execute the exe that is not yet built. Now assume the program has the (sub)project version. - If the version check fails, interpreter uses ExternalProgramHolder.get_name() for the error message but build.Executable does not implement get_name() method.
2020-03-23Fix legacy env var support with crossJohn Ericson1-2/+2
Fix #3969
2020-02-17modules/python: Do not error out if positional args are passedNirbheek Chauhan1-1/+5
Also update the documentation. Fixes https://github.com/mesonbuild/meson/issues/6470
2020-01-29dependencies: Make Dependency initializer signatures matchDylan Baker1-1/+1
Currently PkgConfig takes language as a keyword parameter in position 3, while the others take it as positional in position 2. Because most dependencies don't actually set a language (they use C style linking), using a positional argument makes more sense. ExtraFrameworkDependencies is even more different, and duplicates some arguments from the base ExternalDependency class. For later changes I'm planning to make having all of the dependencies use the same signature is really, really helpful.
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-4/+4
2019-12-18python: add embed to the python dependency functionDaniel Mensinger1-9/+15
2019-10-01Make Python 2 tests optional(er) to prepare for py2 purge in Debian.Jussi Pakkanen1-3/+2
2019-09-12modules/python: improve log when probing Python binaryRoss Burton1-9/+8
If the Python binary that we find doesn't return valid JSON when asked to run a small script, show the command being ran and stdout/stderr in meson-log.txt. Fixes: #5914
2019-06-27Improve error message when Python is not usable. [skip ci]Jussi Pakkanen1-1/+1
2019-06-12modules/python: add a modules keyword argumentDylan Baker1-4/+34
This mirrors the modules keyword argument that some dependencies (such as qt and llvm) take. This allows an easier method to determine if modules are installed.
2019-06-09Purge `is_cross` and friends without changing user interfacesJohn Ericson1-1/+1
In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed.
2019-04-29Fix builtin variable namesDaniel Mensinger1-3/+3
2019-04-21Can run argument strings with internal Python. Closes #5217.Jussi Pakkanen1-5/+3
2019-04-03modules/python: normalize output for disabled by featureDylan Baker1-1/+1
Instead of printing a message about how python was skipped, print the normal 'Program foo found:' message, with a "disabled by feature" message added.
2019-04-03modules/python: Do disabler check after validating inputsDylan Baker1-3/+4
This will help developers not introduce bugs (say putting 3 instead of "python3"), and will be useful for the next patch.
2019-04-03modules/python: Report program found in find_installation()Dylan Baker1-3/+5
Currently find_installation is silent, which is pretty annoying. Let's log it.
2019-04-02modules/python: Remove spaces around keyword argumentsDylan Baker1-2/+2
just small style cleanups.
2019-03-18dependencies: fix Python linking for windows+mingwNacho García1-3/+7
For dynamic linking, some mingw releases don't link correctly with pythonXX.lib in all cases. This patch forces mingw to link against pyhthonXX.dll instead of the .lib file, which has a better compatiblity. Note that msys 1.0 old platform is detected as windows instead of 'mingw'
2019-02-04python: don't require a Python lib in case we don't link against it. Fixes #4841Christoph Reiter1-3/+4
In case extensions aren't linked against libpython we can't assume one exists at all or is available in a known directory.
2019-01-16Fix flake8 errorsXavier Claessens1-2/+1
2019-01-02Remove cross_info; cross file is parsed up front and discardedJohn Ericson1-6/+3
2019-01-02Avoid exception looking for python on windows if the launcher (py.exe) is ↵guruDanny671-0/+4
not installed
2018-12-12modules/python: Add path methodDylan Baker1-3/+7
This would normally be exposed by the ExternalProgramHolder, but wasn't due to the implementation of the PythonInstallation module. Because of that I've duplicated the method so that we can add the FeatureNew decorator. Fixes #4070
2018-12-12modules/python: Refactor the PythonInstallation objectDylan Baker1-40/+33
Into a generic interpreter object. This isn't a module, it's an object returned by a module, it also happens to be a special case of an ExternalProgram, which is a normal interpreter object. Let's treat it like one.
2018-12-12modules/python: don't inherit from InterpreterObjectDylan Baker1-2/+2
Because ExternalProjectHolder already does
2018-12-12modules/python: Don't pass instance variable to instance methodDylan Baker1-9/+9
2018-12-10python: only link extension modules against libpython when distutils does ↵Christoph Reiter1-0/+20
too. Fixes #4117 Windows requires things to be linked, on macOS distutils doesn't link by default. On Linux etc. things are not so clear, some distros like Debian patch distutils to not link, some don't. In addition the manylinux wheels spec prohibits linking against libpython and upstream is thinking about changing the default: https://bugs.python.org/issue34814 Call into distutils to figure out what distutils does and in case it doesn't link against libpython replace the passed in Python dependency with a partial one.
2018-12-05modules/python: Do not override link_args with None largsPhilippe Normand1-2/+2
None is not iterable so it would trigger a TypeError later when link_args are passed on to CompilerArgs.extend_direct().
2018-11-14modules/python: Allow use of the native fileDylan Baker1-1/+3
Currently this just allows setting a "python" variable that always overrides, probably we want to have the option for "python2" and "python3" as well.
2018-10-23Add 'disabler' argument to functions returning not-found objectsXavier Claessens1-1/+3
When dependency(), find_library(), find_program(), or python.find_installation() return a not-found object and disabler is true, they return a Disabler object instead.
2018-09-18python module: Only run command once to get all infoXavier Claessens1-43/+33
2018-09-17Fix version check when passing feature option to find_installation()Xavier Claessens1-1/+2
2018-09-16find_installation: Add support for feature option in required kwargXavier Claessens1-4/+5
Closes: #4165.
2018-08-09Make python module more robustDavid Seifert1-15/+40
* Lookup is now performed according to the following order: 1. use `pkg-config` with `PKG_CONFIG_LIBDIR=LIBPC` from python 2. use plain `PKG_CONFIG_{LIBDIR,PATH}` from the environment 3. try to extract the information from SYSCONFIG The second step is necessary for relocated python installations and cross compilation scenarios, where the value of `LIBPC` might be wrong.
2018-07-27python.find_installation: only try to find python with the py launcher if it ↵Christoph Reiter1-2/+5
isn't in PATH Meson tries to find the interpreter path through the "py" launcher on Windows in all cases which breaks if meson is run under MSYS2 and an official CPython is installed as well. MSYS2 Python doesn't install a py launcher which results in meson finding the system one instead even though python2/python3 is in PATH. Always check if the interpreter name is in PATH before falling back to checking the py launcher.
2018-07-02FeatureNew: Fix method names for some feature checksNirbheek Chauhan1-1/+2
2018-07-02Remove permittedSnippetKwargs, snippets are not specialNirbheek Chauhan1-4/+3
All we needed to do was change _get_callee_args() to also support snippets.
2018-06-20dependencies: Don't assume self.compiler is a C compilerNirbheek Chauhan1-1/+1
All dependencies were using find_library, has_header, get_define, etc on self.compiler assuming that it's a compiler that outputs and consumes C-like libraries. This is not true for D (and in the future, for Rust) since although they can consume C libraries, they do not use the C ecosystem. For such purposes, we now have self.clib_compiler. Nothing uses self.compiler anymore as a result, and it has been removed.
2018-06-01Add 0.46.0 featuresSalamandar1-1/+4
2018-05-04Interpreter: don't flatten the arguments of various methodsMathieu Duponchelle1-0/+4
this fixes eg set_variable('foo', ['bar', 'baz']), which was previously erroring out complaining about the number of arguments. Closes #1481
2018-05-03python module: make it work with pypyMathieu Duponchelle1-4/+47
pypy installations don't usuallyy ship with pkg-config files, we thus need to replicate what their version of distutils does. In addition, we also try our best to build against other pythons that do not have pkg-config files.
2018-04-21modules/python: add some more options around path and config_varsHavard Graff1-13/+39
What is actually defined here varies wildly on different python-versions for different platforms. On my python2.7 on Windows len(sysconfig.get_config_vars()) returns 17, whereas in my Ubuntu that number is 517! Hence it is useful to be able to check which keys are available, as well as allowing specifying a default option.
2018-04-18Made Python module match the new init interface.Jussi Pakkanen1-4/+4
2018-04-09[fixup]: various minor tweaks found while documentingMathieu Duponchelle1-9/+5
2018-04-09[fixup]: Rename find to find_installationMathieu Duponchelle1-4/+4