diff options
author | Iñigo MartÃnez <inigomartinez@gmail.com> | 2017-12-19 21:30:55 +0100 |
---|---|---|
committer | Iñigo MartÃnez <inigomartinez@gmail.com> | 2017-12-19 21:31:27 +0100 |
commit | 1eab075c8e74f24260f0e1d8c1c1fa4f74343a21 (patch) | |
tree | 254bc6890a3e97f46eefd39b5bb03c253a510fe9 | |
parent | 3a1f4ab34c8fc752a6c25cd8e494344d9c2b7b26 (diff) | |
download | meson-1eab075c8e74f24260f0e1d8c1c1fa4f74343a21.zip meson-1eab075c8e74f24260f0e1d8c1c1fa4f74343a21.tar.gz meson-1eab075c8e74f24260f0e1d8c1c1fa4f74343a21.tar.bz2 |
Deprecate duplicated values in array options
Duplicated options in array types have been removed by a previous
commit but someone could be using it.
The previous behaviour has been restored but the existence of
duplicates is now tested, and in that case a `DEPRECATION` message
is shown.
-rw-r--r-- | mesonbuild/coredata.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index bc903cf..d4a91a7 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from . import mlog import pickle, os, uuid import sys from pathlib import PurePath @@ -147,7 +148,10 @@ class UserArrayOption(UserOption): if value.startswith('['): newvalue = ast.literal_eval(value) else: - newvalue = [v.strip() for v in OrderedDict.fromkeys(value.split(','))] + newvalue = [v.strip() for v in value.split(',')] + if len(set(newvalue)) != len(newvalue): + mlog.log(mlog.red('DEPRECATION:'), '''Duplicated values in an array type is deprecated. +This will become a hard error in the future.''') if not isinstance(newvalue, list): raise MesonException('"{0}" should be a string array, but it is not'.format(str(newvalue))) for i in newvalue: |