aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-08-31interpreter: Introduce operators support for InterpreterObjectsDaniel Mensinger5-5/+202
2021-08-31interpreter: Make comparisons of different types a hard errorDaniel Mensinger3-15/+13
2021-08-31pyllint: enable consider-user-enumerateDylan Baker4-10/+5
This caught a couple of cases of us doing: ```python for i in range(len(x)): v = x[i] ``` which are places to use enumerate instead. It also caught a couple of cases of: ```python assert len(x) == len(y) for i in range(len(x)): xv = x[i] yv = y[i] ``` Which should instead be using zip() ```python for xv, yv in zip(x, y): ... ```
2021-08-31pylint: turn on superflous-parensDylan Baker46-125/+125
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-08-31pylint: turn on superfluous parens warningDylan Baker3-8/+9
Which is really useful for catching parens used with keywords like assert. Don't use parens with assert, it's bad.
2021-08-31pylint: enable consider-iterating-dictionaryDylan Baker3-2/+3
This didn't actually catch what it's supposed to, which is cases of: ```python for x in dict.keys(): y = dict[x] ``` But it did catch one unnecessary use of keys(), and one case where we were doing something in an inefficient way. I've rewritten: ```python if name.value in [x.value for x in self.kwargs.keys() if isinstance(x, IdNode)]: ``` as ``python if any((isinstance(x, IdNode) and name.value == x.value) for x in self.kwargs): ``` Which avoids doing two iterations, one to build the list, and a second to do a search for name.value in said list, which does a single short circuiting walk, as any returns as soon as one check returns True.
2021-08-31pylint: enable unnecessary-not checkDylan Baker2-3/+4
This finds things like ```python if not x == 1: ``` which should be ```python if x != 1: ```
2021-08-31Merge pull request #9185 from dcbaker/submit/env-object-as-holderJussi Pakkanen6-90/+125
Make EnvironmentVariablesObject a holder
2021-08-31Merge pull request #9193 from dcbaker/submit/aarch64-beJussi Pakkanen2-7/+110
Handle aarch64_be as a cpu family
2021-08-31Make assignment a statement in Syntax.md (#9188) [skip-ci]jimman20031-3/+3
* Make assignment a statement in Syntax force to change line 709 to something kind of non sensical * Applied code review changes
2021-08-31python module: fix error message mentioning setuptoolsEli Schwartz1-1/+1
We use distutils, not setuptools, for probing information.
2021-08-30interpreter: rename EnvironmentVariablesObject -> EnvironmentVariablesHolderDylan Baker2-4/+4
This is more consistent with other Holder classes
2021-08-30interpreterobjects: Use typed_kwargs for EnvironmentVariablesObjectDylan Baker1-24/+19
2021-08-30make EnvironmentVariablesObject a proper holderDylan Baker4-63/+42
Currently, EnvironmentVariablesObject is a strange holder-that's-not-a-holder. This has implicaitons for things that expect to get an EnvironmentVariables object, as we can't automatically unholder it, and instead have to to manually do so. Now we can automatically unholder it, which makes everything much nicer.
2021-08-30Allow EnvironmentVariablesObject to be passed an EnvironmentVariables instanceDylan Baker1-1/+3
2021-08-30interperter/kwargs: narrow type checkingDylan Baker1-1/+1
Since the convertor has been added env, we are now only going to be an EnvironmentVariables object, nothing else.
2021-08-30interpreter/type_checking: Add convertor to env keyword argumentDylan Baker1-3/+16
This does the conversion to an EnvironmentVariables, so that the receiver always gets a EnvironmentVariables object and not a list, dict, or string
2021-08-30interpreter/type_checking: add a validator to envDylan Baker1-2/+34
Let's start moving the validation out of the interpreter object
2021-08-30interpreter: move 'env' to type_checkingDylan Baker2-1/+8
2021-08-30build: add ability to set initial value of EnvironmentVariablesDylan Baker1-1/+5
Which is useful as we move the validation out of the the EnvironmentVariablesObject
2021-08-30build: Fully annotate EnvironmentVariablesDylan Baker1-6/+9
2021-08-30wraptool: Fix version comparisonXavier Claessens1-4/+4
2021-08-30decorators: Make unknown kwarg fatalXavier Claessens5-19/+10
2021-08-30Add missing "disabler" kwarg to python.dependency()Xavier Claessens2-0/+3
There is a unit test using it and now fails because the warning about unknown kwarg became fatal.
2021-08-30Simplify get_callee_argsXavier Claessens4-87/+34
2021-08-30Simplify condition in can_run_host_binaries()Xavier Claessens1-7/+6
2021-08-30environment: correctly handle cpu value aarch64_beDylan Baker2-1/+11
Fixes #9191
2021-08-30environment: add ppc -> ppc64 for aix to detect_cpuDylan Baker2-1/+5
This seems like an oversight, that we'd replace ppc with ppc64 on AIX for the cpu_family, but not for the specific cpu.
2021-08-30unittests: add tests for detect_cpuDylan Baker1-0/+35
Same thing, but for the more specific cases
2021-08-30unittests: Add a test case for detect_cpu_familyDylan Baker1-0/+56
This should help prevent regressions.
2021-08-30environment: Add a few type annotationsDylan Baker1-6/+4
These are just annotations in code that I'm working for this series
2021-08-29mcompile: treat load-average as a floatMike Gilbert1-1/+1
`ninja -l` accepts a double. We should do the same. Bug: https://bugs.gentoo.org/810655
2021-08-29gnome: Prepend devenv, not appendTing-Wei Lan1-4/+4
Otherwise, if these environment variables already exist, they will override values we set for the developer environment.
2021-08-28Merge pull request #9183 from dcbaker/submit/validate-defaultDylan Baker10-35/+52
Validate default values for KwargInfo
2021-08-28docs: update LD docs link in FAQ.mdAndrea Pappacoda1-1/+1
2021-08-28Try to fix NoneTypeDylan Baker1-1/+1
Because mypy doesn't like the type alias.
2021-08-28Delete old outputs that are no longer in the Ninja file.Jussi Pakkanen1-0/+1
2021-08-27interpreterbase: ensure that the default vaule to KwargInfo is a valid typeDylan Baker1-0/+4
Because currently you can write something like: ```python KwargInfo('capture', bool) ``` Which proclaims "this must be bool", but the default is then not valid.
2021-08-27interpreter: fix cases of `KwargInfo(..., T, default=None)`Dylan Baker8-33/+46
The correct way to mark these is `KwargInfo(..., (T, type(None)))`. There's also a few cases of `(T, None)` which is invalid, as `None` isn't a type
2021-08-27interpreter: fix name of typed_kwargs for `test()`Dylan Baker2-2/+2
There was a copy-n-paste error here, and it was benchmark instead.
2021-08-27build: add annotations for DependencyOverrideDylan Baker1-2/+3
2021-08-27environment: Add correct annotation for wrap_resolverDylan Baker1-1/+2
2021-08-27interpreter: Add a helper for checking constrained inputsDylan Baker4-4/+17
This is quite valuable for enum-like inputs, where only a certain set of values is allowed.
2021-08-27interpreter: fix IndexError when specifying dependency 'include_type'Rihards Skuja2-1/+4
Exception is thrown when dependency name is empty and when its 'include_type' differs from the default one. Regression from b6d754a40c.
2021-08-27FAQ: document some community work toward implementing Meson in C/C++Eli Schwartz1-0/+10
This is useful information for solving the OS bootstrapping problem. Give it some visibility. Also, I don't want to forget where I found any of these. :D ref. #2335
2021-08-27python module: produce the correct install path on every OSEli Schwartz1-1/+1
The sysconfig paths are, by default, correct for every OS -- they are supposed to follow the scheme that python knows about per default. For some reason, this overrode the scheme to posix_prefix, which is the default for posix OSes like linux and macOS, but wrong on Windows. Simply deleting this entirely makes everything that used to work, still work, and a couple new things start working.
2021-08-26Add typed_kwargs to add_languages()Tristan Partin2-4/+9
2021-08-23gnome: don't let fortify defines into the g-ir-scanner after stripping -OEli Schwartz1-1/+3
The tool needs to run the preprocessor (but does not actually produce compiled outputs), and meanwhile ignores lots of flags it doesn't think it needs. In the case of -D_FORTIFY_SOURCE=... this is only valid if -O is there too, but otherwise spits out confusing warnings. The warnings are spurious and can be safely ignored, but in this case let's go the extra mile and fix g-ir-scanner's upstream bug by removing the fortify flag first. Fixes #9161
2021-08-23java module: fix FeatureNew versionEli Schwartz1-1/+1
It should apply to the *next* stable release. Reported-by: Tristan Partin <tristan@partin.io>
2021-08-23interpreter: Fix dependency(..., static: true) fallbackXavier Claessens7-10/+150
It should build the fallback subprject with default_library=static and override the dependency for both static=True and static kwarg not given. Fixes: #8050.