summaryrefslogtreecommitdiff
path: root/mesonbuild/wrap/wraptool.py
AgeCommit message (Collapse)Author
2025-10-17make wrap search custom subprojects dirsCharlie Hutcheson
Changes from Dylan: - Don't use Path - merge the lint fixes - Fix some typing issues - Handle non-meson projects - Remove some code duplication by putting `get_subproject_dir` in utils
2025-05-21wrap: Support gzip Content-Encoding when fetching WrapDB metadataBenjamin Gilbert
When fetching wrap files and releases.json, ask for gzipped data and decompress it if the server obliges. Wrap files come from GitHub releases, thus from Azure blob storage, and Azure currently doesn't compress these responses. releases.json comes from Git master, and GitHub does support compression there, reducing the response body from ~64 KiB to ~10 KiB. That's a small change in absolute terms, but straightforward to support.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
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-11-22wraptool: Remove dead codeXavier Claessens
Update command is implemented in msubprojects.py, because it can update all wraps in parallel.
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-02-01treewide: add future annotations importEli Schwartz
2022-10-11Make `meson wrap update` command update all wraps in parallelXavier Claessens
This moves the implementation into msubprojects because it has all the infrastructure to update wraps in parallel while keeping "meson wrap" UX.
2022-10-10Move some code from wraptool.py to wrap.pyXavier Claessens
2022-10-09Add "meson wrap update-db" commandXavier Claessens
It downloads releases.json from wrapdb and store it in subprojects/wrapdb.json. That file will be used by Meson to find dependency fallbacks offline.
2022-06-13flake8: don't use f-strings for strings without formattingEli Schwartz
2022-03-27wrap: implement allow-insecure for 'meson wrap'Eli Schwartz
2022-03-27wrap: use shared function to connect to wrapdb with better errorsEli Schwartz
We currently inconsistently handle connection, `has_ssl`, and printing errors on urlopen failure between `meson subprojects` and `meson wrap`. Make the latter work more like the former.
2022-03-07treewide: string-quote the first argument to T.castEli Schwartz
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
2022-02-27wraptool: report name of wrap in status message for "not in wrapdb"Eli Schwartz
2022-02-27wraptool: be forgiving of local wrap filesEli Schwartz
Do not traceback when trying to update a wrap that isn't a [wrap-file], just report the problem. Do not traceback on perfectly valid WrapDB wraps that don't have a patch_url because they have upstream meson.build, instead try to parse the version from the source tarball filename.
2021-11-28Add typing to msubprojects.pyTristan Partin
2021-10-10improve wraptool searchDaniel Jacobs
2021-08-31pylint: turn on superflous-parensDylan Baker
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-30wraptool: Fix version comparisonXavier Claessens
2021-06-04wrap: Port to v2 protocolXavier Claessens
Fixes: #8754.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz
performed by running "pyupgrade --py36-plus" and committing the results
2020-09-08typing: fully annotate wrapDaniel Mensinger
2020-01-27Always disable interpolation for ini parsers.Jussi Pakkanen
2019-12-06Update Python2 syntax to Python3 syntax in WrapMichael Brockus
2019-11-07wrap.py: catch connection error with WrapExceptionMichael Hirsch, Ph.D
fixes #6130 wrap: more error verbosity
2019-11-07wrap.py: apply type annotation, modernize syntaxMichael Hirsch, Ph.D
correct syntax issues, missing imports revealed by type annotation checking
2019-04-29Fixed unnecessary .items()Daniel Mensinger
2018-12-02Add 'meson subprojects update' commandXavier Claessens
This is inspired by gst-build's git-update script.
2018-10-04Use a single ArgumentParser for all subcommandsXavier Claessens
This has the adventage that "meson --help" shows a list of all commands, making them discoverable. This also reduce the manual parsing of arguments to the strict minimum needed for backward compatibility.
2018-08-22Remove useless __main__ in files that cannot be executedXavier Claessens
2018-08-17wraptool: fix manual selection of wrap file to promoteDaniel Pirch
Fixed manually promoting wrap files with a full path, e.g. `meson wrap promote subprojects/s1/subprojects/projname.wrap`, which resulted in an error before (new test added: `./run_unittests.py AllPlatformTests.test_subproject_promotion_wrap`). Additionally, running promote with an invalid subproject path now fails properly. Before, it just silently did nothing (added to test: `./run_unittests.py AllPlatformTests.test_subproject_promotion`).
2018-06-06wraptool: Convert to argparseXavier Claessens
2018-01-30Use os.path: basename() and dirname() instead of split()Aleksey Filippov
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-06Add promote to list of wrap commands.Jussi Pakkanen
2017-12-17Also promote wrap files.Jussi Pakkanen
2017-12-17Print instructions on how to promote subsubprojects.Jussi Pakkanen
2017-12-17Add functionality to promote nested dependencies to top level.Jussi Pakkanen
2017-05-02Don't use len() to test emptiness vs not emptinessDylan Baker
Meson has a common pattern of using 'if len(foo) == 0:' or 'if len(foo) != 0:', however, this is a common anti-pattern in python. Instead tests for emptiness/non-emptiness should be done with a simple 'if foo:' or 'if not foo:' Consider the following: >>> import timeit >>> timeit.timeit('if len([]) == 0: pass') 0.10730923599840025 >>> timeit.timeit('if not []: pass') 0.030033907998586074 >>> timeit.timeit('if len(['a', 'b', 'c', 'd']) == 0: pass') 0.1154778649979562 >>> timeit.timeit("if not ['a', 'b', 'c', 'd']: pass") 0.08259823200205574 >>> timeit.timeit('if len("") == 0: pass') 0.089759664999292 >>> timeit.timeit('if not "": pass') 0.02340641999762738 >>> timeit.timeit('if len("foo") == 0: pass') 0.08848102600313723 >>> timeit.timeit('if not "foo": pass') 0.04032287199879647 And for the one additional case of 'if len(foo.strip()) == 0', which can be replaced with 'if not foo.isspace()' >>> timeit.timeit('if len(" ".strip()) == 0: pass') 0.15294511600222904 >>> timeit.timeit('if " ".isspace(): pass') 0.09413968399894657 >>> timeit.timeit('if len(" abc".strip()) == 0: pass') 0.2023209120015963 >>> timeit.timeit('if " abc".isspace(): pass') 0.09571301700270851 In other words, it's always a win to not use len(), when you don't actually want to check the length.
2017-01-18cleanup: Remove redundant parenthesesMike Sinkovsky
2016-12-18remove shebang from wraptoolIgor Gnatenko
meson.noarch: E: non-executable-script /usr/lib/python3.5/site-packages/mesonbuild/wrap/wraptool.py 644 /usr/bin/python3 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-08-27Use context manager for file I/O.Elliott Sales de Andrade
There are a few cases where a context manager cannot be used, such as the logger.
2016-01-17Some more command line guarding.Jussi Pakkanen
2016-01-16Renamed meson package to mesonbuild so that we can have a script named meson ↵Jussi Pakkanen
in the same toplevel dir.