From f1fe823763bf0b9b7320639e918ab32b56065145 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sun, 19 Feb 2017 05:41:38 +0530 Subject: [PATCH] Add repr() for EnvironmentVariables{,Holder} Makes it easier to debug issues with it --- mesonbuild/build.py | 4 ++++ mesonbuild/interpreter.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 5f2de3bdb..7ab656e1c 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -227,6 +227,10 @@ class EnvironmentVariables: def __init__(self): self.envvars = [] + def __repr__(self): + repr_str = "<{0}: {1}>" + return repr_str.format(self.__class__.__name__, self.envvars) + def get_value(self, name, values, kwargs): separator = kwargs.get('separator', os.pathsep) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index f6065d5a0..020f84c28 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -134,6 +134,10 @@ class EnvironmentVariablesHolder(MutableInterpreterObject): 'prepend': self.prepend_method, }) + def __repr__(self): + repr_str = "<{0}: {1}>" + return repr_str.format(self.__class__.__name__, self.held_object.envvars) + @stringArgs def add_var(self, method, args, kwargs): if not isinstance(kwargs.get("separator", ""), str):