diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-06-13 19:00:12 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-06-13 19:00:12 +0300 |
commit | a1988277bda68d3ff878b45bc561eb52e679afce (patch) | |
tree | 07024c657c6aeff86beaccebedcff7cab08dc062 | |
parent | 79f6f38a16fc47d56b4518bee2bba871a02614e2 (diff) | |
download | meson-a1988277bda68d3ff878b45bc561eb52e679afce.zip meson-a1988277bda68d3ff878b45bc561eb52e679afce.tar.gz meson-a1988277bda68d3ff878b45bc561eb52e679afce.tar.bz2 |
Traverse the entire autotools tree.
-rwxr-xr-x | tools/autotools2meson.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/autotools2meson.py b/tools/autotools2meson.py index 37ec5bc..a71efa6 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__': |