Commit Graph

42 Commits

Author SHA1 Message Date
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
Luca Weiss 398df56298 Add Qt6 module 2021-02-07 22:43:00 +02:00
Eli Schwartz 478feb39ed qt module: fix error message typo, translation qresource accepts qm not ts
Fixes #7925
2020-11-04 17:23:34 +02:00
Dylan Baker f342efd080 pylint: turn on bad-indentation error
and fix all of the bad indentation
2020-09-22 17:57:03 -07:00
Eli Schwartz 1de1cc22e2 qt module: add qresource support to compile_translations
A common pattern in Qt5 applications is to embed translations in the
executable using the qresource system. In this case, the list of
translation files is already available in the .qrc file and there's no
good reason to duplicate this info in meson.build.

Let compile_translations optionally take a qrc input, in which case it
will go straight to generating the relevant translations and
rcc-generated .cpp, and directly return the thing users actually care
about -- the .cpp for linking.
2020-08-25 23:46:45 +03:00
Eli Schwartz f2dad788e7 qt module: rcc supports depfiles now, given a recent enough version of Qt5
Add depfile support to generated targets for Qt >= 5.14.

Move warning into the module init itself, to check if the version is too
old before issuing. Also tweak the wording itself, to advise upgrading
to a suitable version of Qt5 instead of advising to wait for a Qt bug to
be fixed.
2020-07-13 22:28:58 +00:00
Xavier Claessens f66c8c35da qt: Fix has_tools() when required=False
Improve logs by making it clear when the program is found but has
wrong version.
2020-07-04 13:57:08 +03:00
Jussi Pakkanen 44ff3e6c7d
Merge pull request #6736 from dcbaker/mesonlib-type-annotations
Mesonlib type annotations
2020-03-08 14:49:23 +02:00
Xavier Claessens ecb076ba00 qt5: Add has_tools() method 2020-03-08 13:48:27 +02:00
Dylan Baker 06b1a317d2 Make use of unholder
We have a lot of cases of code like:
```python
if hasattr(var, 'held_object'):
    var = var.held_object`
```

replace that with the unholder function.
2020-03-05 09:58:52 -08:00
Dylan Baker 581d69a8d3 remove ability to pass multiple keys to extract_as_list
This makes the typing annotations basically impossible to get right, but
if we only have one key then it's easy. Fortunately python provides
comprehensions, so we don't even need the ability to pass multiple keys,
we can just [extract_as_list(kwargs, c) for c in ('a', 'b', 'c')] and
get the same result.
2020-03-05 09:58:52 -08:00
Marc Herbert adcd70861d modules/qt.py: friendlier "lrelease-qtN not found" error message
When lrelease-qtN is missing, upgrade the error message from the
cryptic:

  meson.build:75:4: ERROR: Tried to use not-found external program in "command"

to the meaningful:

  meson.build:75:4: ERROR: qt.compile_translations: lrelease-qt5 not found

Issue found and tested with "test cases/frameworks/4 qt/"
2019-11-27 02:28:20 +02:00
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
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.
2019-04-25 12:28:51 -07:00
Luca Weiss 7c461582a2 Add feature warning for qt.compile_translations 2019-03-17 19:29:06 +02:00
Jon Turney d3f2172de8 lgtm: Too few arguments for string format.
Too few arguments for string format. Format "{0} sources specified and
couldn't find {1}, please check your qt{2} installation" requires at least
3, but 2 are provided.
This alert was introduced in f7f439c a year ago
2018-11-19 21:07:37 +02:00
Dylan Baker aa04147a4a dependencies/ui: Allow qt compilers and qmake to be specified in native file 2018-11-14 15:57:37 -08:00
xiannox 5b3192534c module-qt: add rcc_extra_arguments to pass extra arguments to rcc (#4406) 2018-10-24 19:11:08 +03:00
Salamandar 26a5e9a95f Add support for uic_extra_arguments to qt5 (#4178) 2018-09-28 13:01:27 -07:00
Alexey Rochev 862019e6de Qt: Allow passing dependency objects to preprocess method (#3470, #3875) 2018-09-03 21:13:03 +03:00
Salamandar c90885de6d Add 0.44.0 features 2018-06-01 14:23:24 +02:00
Salamandar fa6550b277 Add 0.40.0 features 2018-06-01 14:23:24 +02:00
Alexis Jeandet 4b98898c7c [Qt module] refactor b4cd949c48
Since relative path in qrc files are always relative to qrc file
itself then we just need to check that normpath(qrc file + resource)
doesn't start with build dir path, this would mean that the resource is
generated.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-04-04 09:36:45 +02:00
Alexis Jeandet b4cd949c48 [Qt module] More qrc fixes
When several qrc files are given all qrc files dependencies were mixed.
Fixed non working use case:
	When user try to guess build dir layout and add use a relative
	path between a generated qrc file and a generated resource.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-04-04 01:06:43 +02:00
Alexis Jeandet ebeb248c07 [Qt module] Added generated resource test case + some fixes
Subdir is already in generated resource path.
Some PEP8 fixes.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-03-30 01:58:09 +02:00
Alexis Jeandet fd245ce5cf [Qt module] add some logic to detect if resources are in build dir
In order to handle generated resources embedded in qrc file, we
need to be able to detect if files pointed from qrc are in build
directory or not.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-03-30 01:07:43 +02:00
Alexis Jeandet 0407fac59e [Qt module] Add File object support for generated or not qrc files
Added missing sub-folder test

Closes #3324

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-03-26 23:05:17 +02:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Alexis Jeandet 81126264cd Fixed bug
Adding the current subdir when extracting resources deps wasn't good,
it is CustomTarget job to handle that.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-01-20 13:51:50 +01:00
Alexis Jeandet 120f7a4c40 [Qt module] Added workaround for qt tools version detection
Depending on the tool (moc, uic, rcc, lrelease), the Qt version
(4.8, 5.7, 5.9) and the distribution (Fedora, debian,...) it seems you
cannot predict which of -v or -version will be supported.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-11-28 22:50:31 +02:00
Alexis Jeandet 5c5eac3571 [Qt module] Added translation files compilation method
- Added a new compile_translations method since preprocess was already quite
full and translations compilation is quite different from ui, qrc, cpp files
preprocessing.
- Updated translation.
- Updated test case.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-11-23 07:09:07 +01:00
Alexis Jeandet 1fd743e6ad [Qt module] Added lrelease detection
Just detect lrelease as done with other Qt tools.
Uses -version instead of -v to probe version since lrelease don't
support it.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-11-22 23:28:32 +01:00
Alexis Jeandet 5de5e7673f [Qt module] Few minor fixes
- removed a typo in tools detection loop
- added include dir also when parsing cpp sources with moc, not only headers

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-11-22 22:52:38 +01:00
Markus Theil 3f8a082a68 Qt-Module: fix name option with multiple rcc files
Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
2017-11-08 23:08:53 +01:00
Markus Theil b36475ff44 Qt-Module: fix rcc `name` with Qt4
Qt5's rcc knows --name and -name, Qt4's only -name.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
2017-11-03 18:42:35 +01:00
Markus Theil 51bc364a10 Qt5-Module: add `name` option to rcc
This patch sets the --name option for files processed with
rcc. It generates an additional initialization function,
which can be used with static linking.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
2017-11-03 18:16:51 +01:00
Martin Kelly 02bea7d5bf namespace run_targets by subproject
Currently, run_target does not get namespaced for each subproject,
unlike executable and others. This means that two subprojects sharing
the same run_target name cause meson to crash.

Fix this by moving the subproject namespacing logic from the BuildTarget
class to the Target class.
2017-10-31 01:04:38 +02:00
Leif Middelschulte cf759e529c Fixes the `kwargs` handling.
As suggested by @jeandet.

Details:
https://github.com/mesonbuild/meson/pull/2529#pullrequestreview-72703268
2017-10-29 18:06:38 +01:00
Leif Middelschulte b919e05821 removes unnecessary code as suggested by @jeandet
Details: https://github.com/mesonbuild/meson/pull/2529#discussion_r146985692
2017-10-26 13:06:58 +02:00
Leif Middelschulte 32a8ab40c1 removes unnecessary if/else-statement as suggested by @jeandet
Details: https://github.com/mesonbuild/meson/pull/2529#discussion_r146985692
2017-10-26 12:04:41 +02:00
Leif Middelschulte 050a56ad47 Qt5-Module: Add `moc_extra_arguments` keyword support.
This commit adds support for an additional `moc_extra_arguments` keyword.
It becomes especially handy, when `moc`-ed sources conditionally provide
`slots`, depending on compile time macros (i.e. defines).
2017-10-25 21:09:16 +02:00
Alexis Jeandet 4410c73efa Factorized Qt compilers version probing.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-10-12 08:58:31 +02:00
Alexis Jeandet f7f439caeb Factorized Qt4 and Qt5 modules in one base class.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-10-10 23:03:57 +02:00