diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 14:43:51 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-07-01 20:50:47 +0530 |
commit | 4516e8a49ffff2c8781cce2de9680ed0ce2aab7d (patch) | |
tree | b45817b22e1c787fb7ce11e32b1975c1b8b0089e /mesonbuild/build.py | |
parent | 761ac8d8c460182a7b450dc3c55c825d3411bf44 (diff) | |
download | meson-4516e8a49ffff2c8781cce2de9680ed0ce2aab7d.zip meson-4516e8a49ffff2c8781cce2de9680ed0ce2aab7d.tar.gz meson-4516e8a49ffff2c8781cce2de9680ed0ce2aab7d.tar.bz2 |
Add repr() implementations for build targets and File
This aids debugging
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 3ca7bf2..d33f692 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -239,6 +239,10 @@ class BuildTarget(): raise InvalidArguments('Build target %s has no sources.' % name) self.validate_sources() + def __repr__(self): + repr_str = "<{0} {1}: {2}>" + return repr_str.format(self.__class__.__name__, self.get_id(), self.filename) + def get_id(self): # This ID must also be a valid file name on all OSs. # It should also avoid shell metacharacters for obvious @@ -623,6 +627,10 @@ class Generator(): self.exe = exe self.process_kwargs(kwargs) + def __repr__(self): + repr_str = "<{0}: {1}>" + return repr_str.format(self.__class__.__name__, self.exe) + def get_exe(self): return self.exe @@ -953,6 +961,10 @@ class CustomTarget: mlog.log(mlog.bold('Warning:'), 'Unknown keyword arguments in target %s: %s' % (self.name, ', '.join(unknowns))) + def __repr__(self): + repr_str = "<{0} {1}: {2}>" + return repr_str.format(self.__class__.__name__, self.get_id(), self.command) + def get_id(self): return self.name + self.type_suffix() @@ -1079,6 +1091,10 @@ class RunTarget: self.args = args self.subdir = subdir + def __repr__(self): + repr_str = "<{0} {1}: {2}>" + return repr_str.format(self.__class__.__name__, self.get_id(), self.command) + def get_id(self): return self.name + self.type_suffix() @@ -1129,6 +1145,12 @@ class ConfigureFile(): self.targetname = targetname self.configuration_data = configuration_data + def __repr__(self): + repr_str = "<{0}: {1} -> {2}>" + src = os.path.join(self.subdir, self.sourcename) + dst = os.path.join(self.subdir, self.targetname) + return repr_str.format(self.__class__.__name__, src, dst) + def get_configuration_data(self): return self.configuration_data @@ -1146,6 +1168,9 @@ class ConfigurationData(): super().__init__() self.values = {} + def __repr__(self): + return repr(self.values) + def get(self, name): return self.values[name] |