Commit Graph

98 Commits

Author SHA1 Message Date
Eli Schwartz 906aec0df5
ac_converter: use better style for header check iteration
underscorifying and upper casing the header name is superior to
duplicating it.
2022-04-14 18:37:03 -04:00
Jussi Pakkanen 139020c2fc Fix exponential regex in doc regeneration. 2022-03-09 18:02:04 -05:00
Eli Schwartz a038fa80f5
docs: fix command help regenerator on python 3.10
In https://github.com/python/cpython/pull/23858 the section header for
option flags was changed from "optional arguments" to "options" with the
rationale that they are not (necessarily) at all optional, while GNU
coreutils calls them options.

In fact, POSIX calls them options (-o) and option-arguments (-o val) and
operands ("positional arguments") so it is indeed a mess, but argparse
is not yet perfect.

Still, fix the documentation generator for now so that it is compatible
with python 3.10 as well.

Fixes traceback on building the docs with:

```
[1/4] Generating gen_docs with a custom command
FAILED: gen_docs.stamp
/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py --output-dir /home/eschwartz/git/meson/docs/builddir --dummy-output-file gen_docs.stamp
Traceback (most recent call last):
  File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 160, in <module>
    regenerate_docs(output_dir=args.output_dir,
  File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 146, in regenerate_docs
    generate_hotdoc_includes(root_dir, output_dir)
  File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 113, in generate_hotdoc_includes
    cmd_data = get_commands_data(root_dir)
  File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 106, in get_commands_data
    cmd_data[cmd] = parse_cmd(cmd_output)
  File "/home/eschwartz/git/meson/docs/../tools/regenerate_docs.py", line 65, in parse_cmd
    assert arguments_start
AssertionError
```
2022-01-25 01:47:39 -05:00
Eli Schwartz 140097faf0
port from embedded data to importlib.resources 2022-01-10 18:36:57 -05:00
Jussi Pakkanen 4101ca6eaa Fix files in the unittests subdir. 2022-01-02 19:07:36 +02:00
Eli Schwartz 81a2c1b36d
remove unused imports 2021-10-26 20:53:43 -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 59d4f771d2
editorconfig: add setting to trim trailing whitespace
and clean up all outstanding issues

Skip 'test cases/common/141 special characters/meson.build' since it
intentionally uses trailing newlines.
2021-08-15 09:36:18 -04:00
Daniel Mensinger 3e396b3782
fix: Always explicitly set encoding for text files (fixes #8263) 2021-06-29 11:28:08 +02:00
Daniel Mensinger 765aff5a42 coverage: Enable coverage reports 2021-06-22 21:05:11 +03:00
Xavier Claessens 769fd50373 docs: Generate a table of all wrapdb releases
wrapdb CI will trigger Meson's CI to regenerate the list when
releases.json is updated.
2021-06-05 17:01:34 -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
Eli Schwartz 4340bf34fa
various python neatness cleanups
All changes were created by running

"pyupgrade --py3-only --keep-percent-format"

and committing the results. I have not touched string formatting for
now.

- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
2021-03-04 17:11:26 -05:00
Eli Schwartz ccb15bc0e9 gen_data.py: even more sorting
glob.glob() is not sorted, despite using shell-style wildcards, and the
documentation does not mention this: https://bugs.python.org/issue21748

Recently, it does start mentioning "Whether or not the results are
sorted depends on the file system." which does not really get to the
heart of the matter...

This is causing fuzz too.
2021-01-13 15:57:06 +00:00
Eli Schwartz 0063bd35d7
gen_data.py: sort files when generating mesondata
The current way this works is chaos since the tool might return files in
any order and thus shuffle around the order of embedded files. This
results in big diffs that cannot be easily reviewed.

Also regenerate the data according to the, going forward, canonical
ordering algorithm.
2021-01-12 19:19:00 -05:00
Eli Schwartz c18a9715b8
Hotdoc: use template for Commands.md instead of generating the entire file (#8154)
* doc: fix hotdoc misuse for dynamically generated content

hotdoc has a native include feature for including files inline. Use this
to generate one file for each dynamically generated code block, and
include that file in Commands.md; see:
https://hotdoc.github.io/syntax-extensions.html#smart-file-inclusion-syntax

This permits us to move back to using the in-tree version of the hotdoc
*.md sources, thus fixing the incorrect inclusion of "builddir/" in the
"Edit on github" links which resulted from using copies as the source.

Fixes #8061

* doc: call the dummy file a "stamp" as it is a better known term
2021-01-10 14:48:34 +02:00
Dylan Baker f6672c7a19 use real pathlib module
We added the _pathlib module to work around defeciencies in python 3.5's
implementation, since we now rely on 3.6 lets drop this
2020-11-20 15:08:40 -08:00
Daniel Mensinger fc57089bc5 cmake: Disable the new (CMake 3.16) PCH support
Subprojects that use the CMake PCH feature will cause
compilation/linker errors. The CMake PCH support
should thus be disabled until this can be properly
translated to meson.
2020-10-24 19:31:15 +02:00
Daniel Mensinger 96c31d9dbc typing: fix mypy typing error 2020-10-12 00:23:59 +03:00
Daniel Mensinger e681235e5f
typing: fix code review 2020-09-08 20:15:58 +02:00
Daniel Mensinger 0d57e307b2
typing: fully annotate tools 2020-09-08 20:15:56 +02:00
Daniel Mensinger 019ed04331
mdata: Generate mesondata.py from */data folders 2020-07-16 21:03:18 +02:00
Jussi Pakkanen 14cc2efcfe Store website build script. [skip ci] 2020-07-01 18:12:44 +03:00
TheQwertiest b6981bd16e
Made Commands.md dynamically generated (#7346) 2020-06-30 23:56:08 +03:00
Dylan Baker 85708facae
Merge pull request #6620 from jon-turney/test-output-check
Add a mechanism for validating meson output in tests
2020-05-13 11:32:28 -07:00
Daniel Mensinger 59db1f18ea boost: Only use usage-requirements defines (fixes #7046) 2020-05-01 22:08:59 +03:00
Jon Turney 630cfd84ad
Update dircondenser.py tool to update paths in test.json as well
Update dircondenser.py tool to update paths appearing in the expected
stdout in test.json when the containing directory is renamed.
2020-04-30 20:41:36 +01:00
Yann Dirson ee94cb6c15
cmake2meson fix if nesting (#6676) 2020-02-23 20:19:13 +02:00
Daniel Mensinger 893c246550
boost: Rewrite boost_names.py generator 2020-02-20 13:38:20 +01:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Michael Brockus c0a9bca627 Update Python2 syntax to Python3 syntax in ghwt.py 2019-12-06 14:43:21 +02:00
Michael Hirsch, Ph.D 6e708208dd CI: add initial type annotation checking 2019-11-07 22:18:21 +02:00
Michael Hirsch, Ph.D ba7428c9d3 cmake2meson: improve exceptions, add type annotations, use argparse 2019-10-19 14:28:03 +03:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Michael Hirsch, Ph.D 2ba2c7771f allow nested if loop
close paren
2019-01-16 23:43:30 +02:00
Michael Hirsch, Ph.D 142cf1459f modernize library default syntax, be like CMake static default 2019-01-06 22:29:34 +02:00
Jon Turney b338add554 Fix flake8 whitespace reports
$ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)'
./mesonbuild/build.py:964:5: E303 too many blank lines (2)
./tools/dircondenser.py:70:36: E221 multiple spaces before operator
2018-09-13 20:33:17 +03:00
Jussi Pakkanen 10a07ebf70 Add script to condense test directory names. 2018-07-31 19:17:49 +03:00
Niklas Claesson 14e7b0af25 Boost: Add Python libraries
Fixes: #2507
2017-10-25 21:08:54 +03:00
Niklas Claesson c97e7749a6 Boost: Jamfile has two syntaxes for boost libraries
Fixes #2456
2017-10-12 21:45:23 +03:00
Niklas Claesson bbdba876af Boost: Improve search algorithm
The new implementation will correctly pick boost from 3 possible
locations on windows and two locations on posix compatible OSs.

The new search algorithm also differentiates between debug and
release builds of Boost and multi or single threading builds.

It was also decided to map "Meson modules" to Boost software libraries
and not Boost modules since it there are a lot of options regarding
linking. Some modules can even be used either as headers-only or with
dynamic linking.

This commit also fixes a bug that prevented header-only use on Windows.

Fixes: #2274 #2239 #1803 #669
2017-10-01 18:49:27 +02:00
Georg Müller 4cbca49976 cmake2meson: convert varexp to lowercase
since variable names in 'set' statements are converted to lowercase, the
variable itself should be converted to lower-case too when used.
2017-09-14 10:23:54 +02:00
Georg Müller 567b51ac71 cmake2meson: strip comments from statements
Without this change, the following correct cmake will cause an error:

statement(
    arg1
    # arg2
    arg3
)
2017-09-14 10:18:26 +02:00
Georg Müller c60c21a60d cmake2meson: convert statements to lower case
cmake does not distinguish between upper and lower case, so convert it to
lower case for the later comparisons.
2017-09-14 10:17:25 +02:00
Jussi Pakkanen 4c00297112 Improve ac_converter to print a help message. 2017-07-31 11:20:09 +01:00
Jussi Pakkanen b2a90f1838 Removed unnecessary pass statements. 2017-07-16 12:02:48 +03:00
Jussi Pakkanen cdfb416425 Removed duplicate key in dictionary. 2017-07-16 12:01:01 +03:00
Jussi Pakkanen 5311a274e3 A few typo fixes in the converter script. 2017-06-04 20:19:15 +03:00
Jussi Pakkanen 83e778118d Added more functions to the list of checks. 2017-06-04 14:14:14 +03:00
Mike Sinkovsky dac8351ff1 cleanup: Unbound local variable 2017-01-18 21:22:47 +02:00