Commit Graph

892 Commits

Author SHA1 Message Date
Dylan Baker 61f2866a9f modules/i18n: use typed_pos_args 2021-09-30 16:09:14 -07:00
Dylan Baker b923163109 modules/i18n: add easy type annotations 2021-09-30 16:09:14 -07:00
Dylan Baker 57d0d4e95a modules/i18n: sort and clean up imports 2021-09-30 16:09:14 -07:00
Dylan Baker c4aa8c2521 modules: make ReturnValue.new_objects covariant
Otherwise we have to do a lot of casting to ensure that we get the
appropriate invariant type
2021-09-30 16:09:14 -07:00
Dylan Baker c3c30d4b06 interpreter: Use typed_kwargs for func_custom_target
This does not convert the build side, or remove any of the checking it
does. We still need that for other callers of custom target. What we'll
do for those is add an internal interface that defaults things, then
we'll be able to have those callers do their own validation, and the
CustomTarget validation machinary can be removed.

Fixes #9096
2021-09-30 21:01:38 +02:00
Xavier Claessens e836076e24 external-project: variables must be dict not list
Fixes: #9316
2021-09-29 19:01:44 -04:00
Filipe Laíns 05b5a1e56f modules: python: better handling of the Python paths for Debian
Hardcoding the name is fragile, and enabling it based on the existence of
/etc/debian_version (as the is_debianlike helper does) will result in
incorrect paths if the Python binary is not provided by Debian.

Using the deb_system distuils scheme instead makes sure we use the
install path from the current interpreter, which Debian could change
between releases, and gives us the correct value on Python installations
that are not provided by Debian (eg. deadsnakes, Github Action Python,
etc.)

Do notice, though, that there is still no guarantee that these are the
correct paths, as they assume all schemes paths have the install prefix
as a base, see #9284.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-29 08:54:05 -04:00
Dylan Baker 9795323b86 pylint: check for duplicate imports
I ran into one of these from LGTM, and it would be nice if pylint could
warn me as part of my local development process instead of waiting for
the CI to tell me.
2021-09-24 10:36:05 -07:00
Dylan Baker d661a0cd96 build: use an object rather than a dict for the dep_manifest
This really is more of a struct than a dict, as the types are disjoint
and they are internally handled, (ie, not from user input). This cleans
some things up, in addition I spotted a bug in the ModuleState where the
dict with the version and license is passed to a field that expects just
the version string.
2021-09-24 10:36:05 -07:00
Eli Schwartz 87e13af1c8
apply flake8 fixes for unused imports and missing imports 2021-09-14 15:55:07 -04:00
Eli Schwartz 2c34b2f063
fix traceback for undefined exception when trying to raise exception 2021-09-14 15:50:29 -04:00
Eli Schwartz f291b637b1
qt module: consolidate on one list of bins 2021-09-10 17:57:28 -04:00
Eli Schwartz d2bf77342e
qt module: fix regression in building translations via qresource
In commit 3c4c7d0429 the qresource
variable stopped being overwritten with a mesonlib.File, which is
reasonable. However, one call site for it which relied on being a built
file did not get renamed when needed.

Make the build target use the built file.
2021-09-10 17:57:28 -04:00
Eli Schwartz 7171d22f5f
qt module: correctly register a found tool and stop looking for it
Regression in commit d7ac2f1065 since
self.{tool_name} is not how it used to be tracked, and the "found"
dictionary is a legacy of the old location.
2021-09-10 17:57:28 -04:00
Filipe Laíns af8b55d49b mintro: add installed_plan
Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-09-06 18:10:55 +02:00
Eli Schwartz 1dbb6d6b8c
make the display name of a gettext translation build, look prettier
And more accurate too, TBH. Currently it says it is building "lang.mo",
even though it is actually building "domain.mo" inside
lang/LC_MESSAGES/.

Since meson loudly complains if I try to name the display name
"lang/domain.mo", name it with a dash instead of a slash. The actual
name isn't a priority here IMO, and this is nicely readable.
2021-09-01 21:18:44 -04:00
Eli Schwartz 22c38a0006
i18n module: restore the <packagename>-gmo target
Removed in commit 487d45c1e5 but perhaps
it should not have -- people may have been depending on ensuring those
are built somehow. Even though the internal implementation changed and
it is now built by the all target, let's keep the old target around too.

Now it just aliases the actual build rules, though.
2021-08-31 23:37:33 -04:00
Eli Schwartz 2fc7592e13
i18n module: provide targets as return value for gettext()
Users may wish to make use of these files for their own purposes.

For example, the -pot and -update-po pseudo targets could be reused in
an alias_target(), and at least one person wanted to reuse the built .mo
files as custom_target input.

Fixes #6227
2021-08-31 23:37:33 -04:00
Dylan Baker 4d7031437c pylint: turn on superflous-parens
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-31 16:28:54 -04:00
Eli Schwartz 34ac77d619 python module: fix error message mentioning setuptools
We use distutils, not setuptools, for probing information.
2021-08-31 08:42:27 -07:00
Xavier Claessens 276063a1d2 Add missing "disabler" kwarg to python.dependency()
There is a unit test using it and now fails because the warning about
unknown kwarg became fatal.
2021-08-30 14:00:54 -04:00
Ting-Wei Lan a70cdebfe7 gnome: Prepend devenv, not append
Otherwise, if these environment variables already exist, they will
override values we set for the developer environment.
2021-08-29 08:36:59 -04:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
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-27 14:54:29 -07:00
Eli Schwartz 6170f1175e python module: produce the correct install path on every OS
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-27 07:46:58 -04:00
Eli Schwartz 1dce556dc2 gnome: don't let fortify defines into the g-ir-scanner after stripping -O
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-23 21:01:16 -04:00
Eli Schwartz b3c240989b java module: fix FeatureNew version
It should apply to the *next* stable release.

Reported-by: Tristan Partin <tristan@partin.io>
2021-08-23 12:53:26 -04:00
Xavier Claessens 0063eb251e python: Workaround broken install path 2021-08-22 22:14:59 -04:00
Tristan Partin be92e37837 Add Java module
The Java module will serve as a source for easing Java development
within Meson. Currently it only supports generating native header files.
2021-08-22 07:57:29 -07:00
Tristan Partin cd9db63bfb Add typing to ModuleState machine members 2021-08-22 07:57:29 -07:00
Jussi Pakkanen 3d98d54fc5
Merge pull request #9012 from dcbaker/submit/qt-custom-targets
Qt module generated sources
2021-08-20 21:09:49 +03:00
Xavier Claessens 12e5bfbc1c external-project: Add support for WAF build system
Fixes: #7638
2021-08-20 09:12:20 -04:00
Jussi Pakkanen e2f4126e41
Merge pull request #9126 from dcbaker/submit/rust-use-full-typing
Fully type check rust.bindgen
2021-08-19 18:07:43 +03:00
Dylan Baker a7f3703440 modules/qt: Allow using generated sources for compile_translations ts_files 2021-08-18 19:47:07 -07:00
Dylan Baker a16335a958 modules/qt: Allow Generated sources in compile_resources 2021-08-18 19:46:47 -07:00
Dylan Baker ff573620b0 modules/qt: allow passing generated targets to compile_ui 2021-08-18 19:46:47 -07:00
Dylan Baker 965fcf2883 modules/qt: Allow generated sources for arguemnts to compile_moc 2021-08-18 19:46:47 -07:00
Eli Schwartz b0ffb80ecf
python module: fix extensions without explicit subdir being installed to libdir
They are documented to go in site-packages, and indeed belong there.

Regression from the initial implementation via commit ad296976f0

Fixes #6331
2021-08-18 17:58:30 -04:00
Eli Schwartz d9a9c3b5da
python module: make external program wrapper have access to useful metadata
Basically just reorganize code. Try to make it a little neater, while
we're at it.
2021-08-18 17:54:52 -04:00
Eli Schwartz 445f08869b
Fix incorrect .name attribute for python program
It is always set to python3 even if we asked for python2...
2021-08-18 17:54:52 -04:00
Eli Schwartz 9eac9e0ff2
fix some confusingly indirect code
rsplit(..., 1) always produces exactly one split, by design, there's no
need to then join a 1-element list via a generator comprehension after
extracting the end of it via pop. If this commit message sounds
confusing, then so was I when trying to figure out what this actually
did and if it needed extracting to PythonExternalModule.
2021-08-18 17:54:51 -04:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Dylan Baker 65b8c2663b modules/rust: fix initialize signature
So that it's accurate, and we don't need to use to use `#type: ignore`
declaration
2021-08-16 12:07:57 -07:00
Dylan Baker 8f3695fc53 modules/rust: use typed_kwargs for bindgen
This was the only function left in here that wasn't fully typed, so
let's fix that
2021-08-16 12:07:56 -07:00
Eli Schwartz c2592bc921
correct a copy-pasted comment 2021-08-15 09:36:18 -04:00
Xavier Claessens 223991c09e Fix i18n target name when using @BASENAME@ and configure_file() input
Fixes: #9022
2021-08-09 19:43:45 -04:00
Eli Schwartz 487d45c1e5
i18n: use real build/install targets for gmo files
Don't just create a .PHONY target which runs a script that magically
generates files ninja doesn't know about. It results in untracked files,
and `meson install` has to run additional commands instead of copying
over files, and then cannot track them to uninstall them later.

I'm not even really sure why it was originally done via a proxy script,
most likely bad legacy design. This is after all one of the oldest
modules...

One side effect of this is that meson doesn't know how to rename
build.CustomTarget files on install (only data files are supported?),
and every file needs to be installed as "domainname.mo" so it must be
named that in-tree too. To prevent clashes, every locale gets its own
locale-specific subdirectory.

Once we are doing that anyway, we can output them to the actual
structure required by the gettext family of functions, and
bindtextdomain() can therefore point to this location if desired. This
might be useful for running localized programs from the build tree.
2021-08-09 18:25:17 -04:00
Emmanuele Bassi d9acd7505c gnome: Filter all compiler and linker flags
When sending them to the introspection scanner, we must always filter
all compiler and linker flags, because g-ir-scanner does not accept any
random argument but only a specific subset.

Fixes: #8876
2021-08-09 14:43:57 -04:00
Xavier Claessens 59478ce2da modules: Fix typo in state.test()
Fixes: #9081
2021-08-09 14:11:09 -04:00
Xavier Claessens 1dcde9da61 modules: Add API to add test
This fix kwargs not going through typed_kwargs() decorator that sets
defaults.

Fixes: #9009
2021-08-06 15:04:38 -04:00
Xavier Claessens 3f71779f8a Fix python module leaving PKG_CONFIG_LIBDIR set in os.environ. 2021-08-03 14:44:03 -04:00