From a1988277bda68d3ff878b45bc561eb52e679afce Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 13 Jun 2014 19:00:12 +0300 Subject: [PATCH] Traverse the entire autotools tree. --- tools/autotools2meson.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/autotools2meson.py b/tools/autotools2meson.py index 37ec5bc87..a71efa6ad 100755 --- a/tools/autotools2meson.py +++ b/tools/autotools2meson.py @@ -26,7 +26,7 @@ class Converter(): while line != '': line = line.rstrip() while line.endswith('\\'): - line = line[:-1] + file.readline.rstrip() + line = line[:-1] + file.readline().rstrip() yield line line = file.readline() @@ -37,8 +37,20 @@ class Converter(): ifile = open(os.path.join(subdir, 'Makefile.am')) except FileNotFoundError: print('Makefile.am not found in subdir', subdir) + ofile = open(os.path.join(subdir, 'meson.build'), 'w') for line in self.readlines(ifile): - print(line) + items = line.strip().split() + if len(items) == 0: + ofile.write('\n') + continue + if items[0] == 'SUBDIRS': + for i in items[2:]: + if i != '.': + ofile.write("subdir('%s')\n" % i) + self.convert(os.path.join(subdir, i)) + else: + ofile.write(line) + ofile.write('\n') if __name__ == '__main__':