aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/minit.py
AgeCommit message (Collapse)AuthorFilesLines
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker1-12/+1
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott1-0/+2
line argument code
2023-07-25templates: fix typo in function name `sameple` -> `sample`Dylan Baker1-2/+2
2023-07-25minit: use a Protocol for argumentsDylan Baker1-7/+23
Which gives better type hinting. It also points out that we're changing the type of sourcefiles. That's now fixed
2023-07-25minit: put imports togetherDylan Baker1-4/+1
2023-07-25minit: fix docstringDylan Baker1-1/+2
Which must come before `from __future__`
2023-03-29Make --vsenv a readonly builtin optionXavier Claessens1-1/+2
We need to remember its value when reconfiguring, but the Build object is not reused, only coredata is. This also makes CLI more consistent by allowing `-Dvsenv=true` syntax. Fixes: #11309
2023-02-01treewide: add future annotations importEli Schwartz1-0/+1
2023-01-22meson init --build should call meson setup and vsenvCharles Brunet1-2/+8
2022-11-30pylint: enable the set_membership pluginDylan Baker1-1/+1
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-29pylint: enable the bad_builtin checkerDylan Baker1-1/+1
This finds uses of deny-listed functions, which defaults to map and filter. These functions should be replaced by comprehensions in idiomatic python because: 1. comprehensions are more heavily optimized and are often faster 2. They avoid the need for lambdas in some cases, which make them faster 3. you can do the equivalent in one statement rather than two, which is faster 4. They're easier to read 5. if you need a concrete instance (ie, a list) then you don't have to convert the iterator to a list afterwards
2022-05-05minit: refuse to allow creating broken projectsEli Schwartz1-0/+4
Some executable names are invalid, and while it's unlikely anyone will specify such a thing using the --executable argument, it's not unlikely that people experimenting will attempt to use meson init in a directory named "test". This then defaults to that for both the project name and the sample target name, and the latter produces errors when you try to build it. Fixes #10321
2021-11-16Add vala templateAlberto Fanjul1-2/+5
2021-10-04f-stringsEli Schwartz1-6/+4
2021-07-07resolve symlinks passed to -CPaolo Bonzini1-1/+2
"meson setup" is resolving symlinks for the build directory in validate_core_dirs. For consistency with it, do the same when the build directory is passed via -C to devenv, dist, init, install and test. This ensures for example that the path to test dependencies is computed correctly in "meson test". Fixes: #8765
2021-06-13minit: do not misdetect files suffixed as "" or named "." or "c" or "s" as c#Eli Schwartz1-1/+1
You cannot `str() in str()` and expect it to act like `str() in list()`. Fixes regression in commit bbc2745dccc40761989a3e1efbe5a69eea0bc77e Unbreaks #6573 Fixes #8872
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-2/+2
performed by running "pyupgrade --py36-plus" and committing the results
2021-01-23split mesonlib into a packageDylan Baker1-1/+1
Currently mesonlib does some import tricks to figure out whether it needs to use windows or posix specific functions. This is a little hacky, but works fine. However, the way the typing stubs are implemented for the msvcrt and fnctl modules will cause mypy to fail on the other platform, since the functions are not implemented. To aleviate this (and for slightly cleaner design), I've split mesonlib into a pacakge with three modules. A universal module contains all of the platform agnositc code, a win32 module contains window specific code, a posix module contains the posix specific code, and a platform module contains no-op implementations. Then the package's __init__ file imports all of the universal functions and all of the functions from the approriate platform module, or the no-op versions as fallbacks. This makes mypy happy, and avoids `if`ing all over the code to switch between the platform specific code.
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-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-09-08typing: fully annotate mcompile, minit, and msetupDaniel Mensinger1-4/+8
2020-09-04environment: use ExternalProgram to find ninjaPaolo Bonzini1-1/+1
This allows the NINJA environment variable to support all the Windows special cases, especially allowing an absolute path without extension. Based on a patch by Yonggang Luo. Fixes: #7659 Suggested-by: Nirbheek Chauhan <nirbheek@centricular.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-06-21update meson init info message. [skip ci]Michael Brockus1-2/+2
2020-06-09Made --help options sortedTheQwertiest1-1/+1
2020-03-19sample factory implementationMichael1-84/+7
2020-03-02fix typoMichael1-1/+1
2020-03-02add -C to meson initMichael1-0/+7
2020-02-24Update minit.pyMichael Brockus1-3/+2
2020-02-24fixed issue with auto-detection failingMichael Brockus1-1/+2
2020-02-24use python set to tuple for checking membersMichael Brockus1-2/+2
2020-02-19make use of default project constMichael1-1/+1
2020-02-19make use of enumsMichael1-22/+24
2020-02-19removed hardcoded values for more add less work in the long run.Michael1-24/+27
2020-02-19switch Python list for setMichael1-3/+3
2020-02-19remove uneeded '(' and ')'Michael1-1/+1
2020-02-19Update minit.pyMichael Brockus1-52/+58
2020-02-02update the init commandMichael1-56/+80
2019-11-07CI: add initial type annotation checkingMichael Hirsch, Ph.D1-1/+1
2019-11-02Minit templates modularizationMichael Hirsch, Ph.D1-330/+76
2019-04-25Don't use len() to test for container emptinessDylan Baker1-1/+1
I ran the numbers once before (it's in the meson history) but it's *much* faster to *not* use len for testing if a container is empty or not.
2018-10-04Use a single ArgumentParser for all subcommandsXavier Claessens1-4/+4
This has the adventage that "meson --help" shows a list of all commands, making them discoverable. This also reduce the manual parsing of arguments to the strict minimum needed for backward compatibility.
2018-08-09Call it gnu_symbol_visibility instead.Jussi Pakkanen1-2/+2
2018-08-09Updated sample projects to use visibility kwarg.Jussi Pakkanen1-14/+2
2018-04-17Use visual studio solution directoriesNiklas Claesson1-3/+5
This implements support for visual studio solution directories. Projects will by default be put into directories that map their sub-directory name in the source folder. No directories are created if `--layout=flat` is used. Fixes: #2524
2018-03-06Generate meson.build based on existing source files when meson init is run ↵Jukka Laurila1-7/+117
in a non-empty directory.
2018-03-06Fix the C and C++ project template options, they were reversed before.Jukka Laurila1-3/+3
2018-03-03Fix flake8 'variable assigned value but unused' reportsJon Turney1-2/+0
$ flake8 | grep -E 'F841' ./run_unittests.py:1987:13: F841 local variable 'objc' is assigned to but never used ./run_unittests.py:1988:13: F841 local variable 'objcpp' is assigned to but never used ./mesonbuild/minit.py:272:5: F841 local variable 'uppercase_token' is assigned to but never used ./mesonbuild/minit.py:307:5: F841 local variable 'uppercase_token' is assigned to but never used ./mesonbuild/modules/unstable_icestorm.py:36:9: F841 local variable 'result' is assigned to but never used ./mesonbuild/modules/unstable_icestorm.py:78:9: F841 local variable 'up_target' is assigned to but never used ./mesonbuild/modules/unstable_icestorm.py:81:9: F841 local variable 'time_target' is assigned to but never used ./msi/createmsi.py:226:17: F841 local variable 'file_source' is assigned to but never used
2018-03-03Fix various flake8 indentation reportsJon Turney1-3/+3
$ flake8 | grep -E '(E123|E127|E128)' ./run_unittests.py:1358:37: E127 continuation line over-indented for visual indent ./run_unittests.py:1360:37: E127 continuation line over-indented for visual indent ./mesonbuild/minit.py:311:66: E128 continuation line under-indented for visual indent ./mesonbuild/minit.py:312:66: E128 continuation line under-indented for visual indent ./mesonbuild/minit.py:313:66: E128 continuation line under-indented for visual indent ./mesonbuild/compilers/cpp.py:115:63: E127 continuation line over-indented for visual indent ./msi/createmsi.py:156:13: E123 closing bracket does not match indentation of opening bracket's line ./msi/createmsi.py:188:13: E123 closing bracket does not match indentation of opening bracket's line
2018-03-03Fix various flake8 whitespace reportsJon Turney1-8/+8
$ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)' ./run_unittests.py:1503:5: E303 too many blank lines (2) ./mesonbuild/interpreter.py:2342:64: E226 missing whitespace around arithmetic operator ./mesonbuild/minit.py:110:17: E221 multiple spaces before operator ./mesonbuild/minit.py:131:1: W293 blank line contains whitespace ./mesonbuild/minit.py:135:19: E221 multiple spaces before operator ./mesonbuild/minit.py:155:1: W293 blank line contains whitespace ./mesonbuild/minit.py:181:1: W293 blank line contains whitespace ./mesonbuild/minit.py:183:1: W293 blank line contains whitespace ./mesonbuild/minit.py:294:47: W291 trailing whitespace ./mesonbuild/minit.py:331:47: W291 trailing whitespace ./mesonbuild/modules/unstable_icestorm.py:49:1: W293 blank line contains whitespace ./mesonbuild/modules/unstable_icestorm.py:76:31: E203 whitespace before ':' ./mesonbuild/modules/unstable_icestorm.py:82:22: E203 whitespace before ':'
2018-03-03Fix flake8 'imported but unused' reportsJon Turney1-2/+1
$ 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