diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2018-03-24 23:44:50 +0100 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2018-04-06 23:48:48 +0200 |
commit | 31f0242a6fad3f15dc42f81927b5627c73516958 (patch) | |
tree | ed05c9eb260a825fa3c8659a9d2789568c28d154 | |
parent | aef1a81b3586aeb48988b60fbeaef5c19e112c45 (diff) | |
download | meson-31f0242a6fad3f15dc42f81927b5627c73516958.zip meson-31f0242a6fad3f15dc42f81927b5627c73516958.tar.gz meson-31f0242a6fad3f15dc42f81927b5627c73516958.tar.bz2 |
new wrap-mode: forcefallback
This can be useful to make sure that a project builds when
its fallbacks are used on systems where external dependencies
satisfy the version requirements, or to easily hack on the sources
of a dependency for which a fallback exists.
-rw-r--r-- | data/shell-completions/zsh/_meson | 2 | ||||
-rw-r--r-- | docs/markdown/FAQ.md | 6 | ||||
-rw-r--r-- | docs/markdown/snippets/new-wrap-mode.md | 3 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 11 | ||||
-rw-r--r-- | mesonbuild/wrap/__init__.py | 7 |
5 files changed, 23 insertions, 6 deletions
diff --git a/data/shell-completions/zsh/_meson b/data/shell-completions/zsh/_meson index 877d700..481d04c 100644 --- a/data/shell-completions/zsh/_meson +++ b/data/shell-completions/zsh/_meson @@ -31,7 +31,7 @@ local -i ret local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})" local __meson_build_types="(plain debug debugoptimized minsize release)" -local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload})" +local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload,forcefallback})" local -a meson_commands=( 'setup:set up a build directory' diff --git a/docs/markdown/FAQ.md b/docs/markdown/FAQ.md index f4cf89b..dffef8a 100644 --- a/docs/markdown/FAQ.md +++ b/docs/markdown/FAQ.md @@ -288,3 +288,9 @@ has a option called `wrap-mode` which can be used to disable wrap downloads altogether with `--wrap-mode=nodownload`. You can also disable dependency fallbacks altogether with `--wrap-mode=nofallback`, which also implies the `nodownload` option. + +If on the other hand, you want meson to always use the fallback +for dependencies, even when an external dependency exists and could +satisfy the version requirements, for example in order to make +sure your project builds when fallbacks are used, you can use +`--wrap-mode=forcefallback`. diff --git a/docs/markdown/snippets/new-wrap-mode.md b/docs/markdown/snippets/new-wrap-mode.md new file mode 100644 index 0000000..e33dd83 --- /dev/null +++ b/docs/markdown/snippets/new-wrap-mode.md @@ -0,0 +1,3 @@ +A new wrap mode was added, `--wrap-mode=forcefallback`. When this is set, +dependencies for which a fallback was provided will always use it, even +if an external dependency exists and satisfies the version requirements. diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 88565af..acb86f0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2404,10 +2404,13 @@ to directly access options of other subprojects.''') dep = None # Search for it outside the project - try: - dep = dependencies.find_external_dependency(name, self.environment, kwargs) - except DependencyException as e: - exception = e + if self.coredata.wrap_mode != WrapMode.forcefallback or 'fallback' not in kwargs: + try: + dep = dependencies.find_external_dependency(name, self.environment, kwargs) + except DependencyException as e: + exception = e + else: + exception = DependencyException("fallback for %s not found" % name) # Search inside the projects list if not dep or not dep.found(): diff --git a/mesonbuild/wrap/__init__.py b/mesonbuild/wrap/__init__.py index 019634c..6e2bc83 100644 --- a/mesonbuild/wrap/__init__.py +++ b/mesonbuild/wrap/__init__.py @@ -25,7 +25,12 @@ from enum import Enum # to use 'nofallback' so that any 'copylib' wraps will be # download as subprojects. # +# --wrap-mode=forcefallback will ignore external dependencies, +# even if they match the version requirements, and automatically +# use the fallback if one was provided. This is useful for example +# to make sure a project builds when using the fallbacks. +# # Note that these options do not affect subprojects that # are git submodules since those are only usable in git # repositories, and you almost always want to download them. -WrapMode = Enum('WrapMode', 'default nofallback nodownload') +WrapMode = Enum('WrapMode', 'default nofallback nodownload forcefallback') |