Commit Graph

47 Commits

Author SHA1 Message Date
Dylan Baker e991c4d454 Use SPDX-License-Identifier consistently
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-12-13 15:19:21 -05:00
Eli Schwartz 680b5ff819
treewide: add future annotations import 2023-02-01 17:01:30 -05:00
Chun-wei Fan 9528e7deb0 gtkdochelper.py: Use os.pathsep for --path argument
This way, we can ensure that gtk-doc parses the --path argument
correctly when passed in from the cmd.exe console, since ':' is normally
used to denote that a drive is being used on local paths.
2022-04-21 12:13:51 -04:00
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
Daniel Mensinger a4f4379c44
typing: fully annotate scripts 2020-09-08 20:15:56 +02:00
Jon Turney 9f0e75bb40 Also adjust PATH in gtkdochelper for Cygwin
Also do Windows loader specific PATH adjustment (to emulate rpath) in
gtkdochelper for Cygwin.
2020-06-13 18:48:35 +00:00
Chun-wei Fan 89bd55b9da gtkdochelper.py: Ignore UnicodeEncodeError when printing output
Windows cmd.exe consoles may be using a code page that might choke
print() when we are outputting the output from calling gtk-doc.  Let's
just ignore the error when it happens and print as much as we could in
this situation.
2020-04-21 00:17:36 +03:00
Chun-wei Fan 415c9e14e7 gtkdochelper.py: Support Windows cmd.exe consoles
On Windows, prepend the commands to call the gtk-doc scripts using the
currently-used Python executable, since Windows cmd.exe consoles do not
support shebang lines.
2020-04-21 00:17:36 +03:00
Aleksey Gurtovoy 75daed27bc mesonlib.split_args/quote_arg/join_args 2019-09-05 23:42:47 +03:00
Xavier Claessens 44ac680e55 gtkdoc: Use find_program() to get gtkdoc tools
This will allow using gtk-doc as a subproject instead of having to
install it on the system. It also has the side effect of failing at
configuration time with a proper message if gtkdoc is not installed,
instead of failing at build time with a python backtrace.
2019-08-04 21:40:55 +03: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
Ross Burton 1efcca637b gtkdochelper: show full command if it fails
Instead of showing just the command invoked, it's useful when debugging to also
show all of the arguments.
2018-09-28 17:18:24 +01:00
Marco Trevisan (Treviño) 5bec6c28e7 gnome: add support for `module_version`
gtk-doc for autotools has the concept of module version, that is used to define
the module install path and the devhelp2 basename.

Add a `module_version` parameter to gnome.gtkdoc to replicate the same behavior.
Updated the test checking that the install_dir is properly computed (if not
passed), and that the .devhelp2 file has proper name.

https://gitlab.gnome.org/GNOME/gtk-doc/blob/GTK_DOC_1_29/buildsystems/autotools/gtk-doc.make#L269
2018-09-21 09:13:21 +02:00
Christoph Reiter 69a65006f2 gtkdoc: set PATH on Windows when executing gtkdoc-scangobj. Fixes #3307
The code was adding the library paths to LD_LIBRARY_PATH, but that
doesn't work on Windows where they need to be added to PATH instead.

Move the environ handling into gtkdoc_run_check() and add paths to PATH
instead of LD_LIBRARY_PATH when on Windows.

This fixes the gtk-doc build for glib on Windows
(in case glib isn't installed already)
2018-08-07 04:42:03 -07:00
Ross Burton d365bde555 scripts/gtkdochelper: add support for --run
gtkdoc-scangobj has a --run argument that specifies a wrapper to be used when
executing the GObject scanner.  Typically this can be libtool but it is also
useful in cross-compilation environments.

This patch adds support for this argument to the gtkdochelper so that tools
using the helper can pass --run if required.
2018-07-09 23:44:35 +01:00
Xavier Claessens 32c22ec492 gtkdoc: Use generated types file if there is one
Closes: #3773.
2018-06-26 22:58:45 +03:00
Ross Burton 57b3f98586 gtkdochelper: pass CC to gtkdoc-scangobj
The helper is told what CC to use already, but doesn't pass it to
gtkdoc-scangobj.
2018-06-20 13:53:09 +00:00
Xavier Claessens c5cb65eb7c gtkdoc: Run gtkdoc-scangobj command from build directory
All paths in CFLAGS are relative to build_root, so current directory
must be there we invoking gtkdoc-scangobj.

Closes: #3379
2018-06-17 15:38:30 +03:00
Nirbheek Chauhan c1f275bfa6 gnome.gtkdoc: Allow passing file objects as xml_files
If we pass a source files() object, we will look for it in the build
directory, which is wrong. If we pass a build files() object (from
configure_file()), we will find it in the build directory, and then
try to copy it on top of itself in gtkdochelper.py getting a
SameFileError.

Add a test for it, and also properly iterate custom target outputs
when adding to content files.
2018-05-06 20:25:16 +05:30
Sébastien Wilmet 51a1952172 gtkdochelper: print warnings
The GTK-Doc commands output was never printed, except in case of error.
So there was no way to see the warnings.

https://github.com/mesonbuild/meson/issues/2396
2018-04-02 19:49:22 +03:00
Ting-Wei Lan 9ec950c4ae gtkdochelper: Set LD_LIBRARY_PATH from -Wl,-rpath arguments
gnome.gtkdoc uses -Wl,-rpath to ensure the scanner executable built by
gtkdoc-scangobj will load shared libraries from the correct directories.
However, FreeBSD configures its linker to use --enable-new-dtags by
default, which converts RPATH to RUNPATH. If users have LD_LIBRARY_PATH
environment variable set, RUNPATH will be overrided by LD_LIBRARY_PATH
and libraries will be loaded from wrong directories, causing undefined
symbol error when running the executable.

In order to solve the problem, we have to prepend directories specified
with -Wl,-rpath to LD_LIBRARY_PATH to avoid relying on the deprecated
RPATH attribute.
2018-01-07 01:56:05 +08:00
Xavier Claessens 7121eb8c51 gtkdoc: Pass the linker down to gtkdoc-scangobj
Closes #2540
2017-11-07 23:56:18 +02:00
Nirbheek Chauhan 04ac7a4844 gnome.gtkdoc: Handle absolute install_dirs correctly
Must prepend DESTDIR in case it's absolute. Also document that by
default it is relative to the gtk-doc html directory.
2017-07-17 12:40:41 +05:30
Emmanuele Bassi f3aa309fa1 Add mkdb_args support to gnome.gtkdoc()
There are cases where we need to specify arguments to gtkdoc-mkdb, like
telling it to scan extensions that are not '.h' and '.c'. Let's add a
new named argument to gnome.gtkdoc(), as well as the plumbing needed for
the gtk-doc helper script.
2017-05-28 23:58:54 +01:00
Rafael Fontenelle 7c43edb840 gtkdochelper: Fix type file name option
'gtkdoc-scangobj' script was recently ported to Python (it was Perl), and it now requires providing '--type' option to specify the name of the file to store the types in. Without this option, 'gtkdockelper' will exit with error status 2 and will throw a message "gtkdoc-scangobj: error: unrecognized arguments: <typefile>"
2017-04-13 23:39:22 +03:00
Mike Sinkovsky 77515ee541 style: [E303] too many blank lines (2) 2017-01-11 12:33:27 -05:00
Igor Gnatenko 116da33cdd style: fix E128 violations
E128: continuation line under-indented for visual indent

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-01-01 12:02:05 -05:00
Igor Gnatenko 4fbaf295f6 remove shebangs from scripts
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/regen_checker.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_test.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_benchmark.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_exe.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/symbolextractor.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/commandrunner.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/gtkdochelper.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/meson_install.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/depfixer.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/dirchanger.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/delwithsuffix.py 644 /usr/bin/python3
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/scripts/vcstagger.py 644 /usr/bin/python3

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 16:55:34 +01:00
Patrick Griffis c42167dc6f gnome.gtkdoc(): Include builddir variant of include dirs also
This avoids the need for users to constantly join paths themselves
as this is commonly included.
2016-12-12 21:01:49 +02:00
Nirbheek Chauhan 60716fcd6d Use universal_newlines=True for all Popen calls
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.

This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.

Closes #1079
2016-12-11 01:59:58 +02:00
Jussi Pakkanen c58da4ee52 Merge pull request #1151 from mesonbuild/tingping/gtk-doc
gnome: Various improvements to gtkdoc
2016-12-06 23:27:41 +02:00
Patrick Griffis e265887ac3 gnome.gtkdoc(): Add keyword to override the mode
I'm not entirely sure if you ever want to mix and match but
I can say that glib required none of them to be passed so
this allows for that.
2016-12-06 14:07:45 -05:00
Nirbheek Chauhan b9a7c0cf39 misc: Use relative imports everywhere
Using 'mesonbuild' as the module can cause it to use the
system-installed module and can also break if we rename the directory,
so avoid that by always using relative imports.
2016-12-07 00:24:17 +05:30
Patrick Griffis d764c7dc91 gnome.gtkdoc(): Add namespace keyword 2016-12-06 13:23:58 -05:00
Patrick Griffis a626d1a7bc gnome.gtkdoc(): Allow passing multiple source dirs
This is valid and used by glib for example.
2016-12-06 12:23:29 -05:00
Patrick Griffis 9b560c29b6 gnome.gtkdoc(): Fix including doc source dir in path 2016-12-06 10:58:18 -05:00
Nirbheek Chauhan 55288b0fcc scripts/gtkdochelper: ignore_headers is a list
Also, only add it if it's defined.

Closes #1020
2016-11-12 11:54:13 -05:00
Emmanuele Bassi e226d702bc gtkdoc: Add `ignore_headers` positional argument
Not all headers are public, or contain public types. GTK-Doc allows
adding headers to be ignored during the "scan" phase, by passing the
`--ignore-headers` command line argument to gtkdoc-scan.

Currently, you can do something like:

  ignored_headers = [ 'foo-private.h', 'bar-private.h', ]

  gnome.gtkdoc(...
               scan_args: [
                 '--ignore-headers=' + ' '.join(ignored_headers),
               ],
               ...)

But it does not guarantee escaping rules and it's definitely not nice.

We can add a simpler version of that mechanism through a new positional
argument, `ignore_headers`, which behaves like `content_files` or
`html_assets`, and takes an array of header files to ignore:

  gnome.gtkdoc(...
               ignore_headers: ignored_headers,
               ...)
2016-11-01 14:11:48 +00:00
Emmanuele Bassi 6eeecb8585 gtkdochelper: Add 'overrides.txt' to the content files
If a `<modulename>-overrides.txt` file exists in the docs directory it
means it's intended to be used in place of the one gtk-doc generates.

GLib and GTK+, for instance, ship with one because some of the types
they provide — like the thread primitives, or the platform macros —
contain architecture-dependent fields that should not be accessed
directly.

This commit should close the last bit of issue #550.
2016-11-01 14:10:56 +00:00
Patrick Griffis 44690763b0 gnome: Include build dir in gtkdoc-mkhtml path 2016-10-19 21:16:29 +03:00
Jussi Pakkanen 1f4cce86ad Remove shebangs on files that are not runnable and add execute bits to those that are. 2016-10-07 21:10:33 +03:00
Thibault Saunier bb3823e6f4 gnome: Allow specifying gtkdoc where to install directory 2016-09-26 15:25:59 -03:00
Thibault Saunier f86fbf6ebf gnome: Run gtkdoc-scanobjs and add a way to get assets working
Allowing the object tree to be generated.

We need to add options to allow copying the ncesseary sources and
assets so the HTML generator can work with them (everything is
relative so we need to copy them in the build directory).

Until now the documentation was not generated from the user provided
main sgml file but it was using a generated one, which lead to a broken
documentation. Starting using it revealed the other bugs fixed in that
commit.
2016-09-26 15:25:59 -03:00
Nirbheek Chauhan 042e0b3467 gtkdochelper: Add error checking and printing
This helps debug why things are failing
2016-07-24 13:48:12 +05:30
Nirbheek Chauhan b2fb4f9d66 scripts: Use destdir_join fix for all DESTDIR prefixing (#598) 2016-06-16 20:43:23 +03:00
Emmanuele Bassi 8998e44cd9 Support passing extra arguments to gtkdoc-fixxref
The extra arguments are typically used to specified the location of
installed API references that gtk-doc can use to create cross links
for symbols.

Fixes #555
2016-05-25 11:36:33 +01:00
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00