Python is a whitespace significant language, changing indent level
implies that scope is changing. So when a string like
```python
def foo():
a = '''
somthing
'''
return a
```
It's visually misleading. Couple that with folding editors like vim
getting utterly confused by this, and it turns into a real pain. Using
textwrap.dedent allows us to get rid of that:
```python
def foo():
a = texwrap.dedent(
'''
something
''')
return a
```
But we still get the same result
There is no reason for these inititializers to exist, all they do is
defer to the parent initializer. Worse, since they are not type
annotated thy prevent the parent type annotations from being used
It turns out this could be missing in GResource*Target as well, due
mostly to the same problem, side effects of mutating a shared
dictionary; though it could also happen with a specific set of keywords
given and other omitted.
Fixes#9350
The `mkenums` functions can have this unset if, and only if, the
c file only variant is called. Due to side effects if the header file is
generated then `install_dir` is ensured to be set for the c file. I have
removed this side effect so that our tests actually cover this case.
Fixes#9472
We already have this magic string in mesonlib, and this should always
have used the cmake@ format which is identical to the meson format other
than the regex.
For example the OpenRC build files install libraries to install_dir: '/lib'
and this works, but causes the generated pkg-config to say:
prefix=/usr
Libs: -L${prefix}//lib
which is both ugly (double //) and resolves to /usr/lib which is exactly
what does not work.
install_dir needs to be set to something, because CustomTarget expects
that. genmarshal still relies on CustomTarget setting it internally
itself.
Fixes#9350
Theere is no 'output' key in the kwargs, so if this was it it would
result in an exception. Mypy spotted this in a branch I'm working on
full typing for gnome, but since that seems unlikely to be done before
the 0.60 branchpoint I'd like to get this in sooner
If either 'name' or 'name_formatted' are absolute paths,
then they are of the form:
C:\path/to/file.ext (example)
By only substituting slashes with the underscore, we get:
C:_path_to_file.ext
This is still not quite right, infact os.path.basename()
returns:
_path_to_file.ext
Also replace colons with underscores to overcome issues when
absolute paths are involved.
Yelp currently can take sources two different ways, the first is via
variadic arguments, the second is by a keyword argument. If the keyword
is passed then the variadic arguments are silently ignored, which is
obviously not ideal. Fortunately the variadic form was never documented,
and is likely not in wide use.
This patch fixes it by deprecating the variadic form, and warning if
both are passed. It does not change behavior as someone may be relying
on it.
All changes were created by running
"pyupgrade --py3-only"
and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted
Also catch a few creeping cases of new code added using older styles.
The previous commit bd2fcb268b
accidentally used the wrong var so the param name was missing,
leading to an error of "unrecognized arguments" for the
datadirs parameter value.