diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-11-03 17:56:21 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-11-03 17:56:21 +0000 |
commit | 43120df44b629cc1ef0b587007bec5c31fb799a1 (patch) | |
tree | 0ea54a02345aab81bf4e42dae19b3b13c3d0c4f6 /utils/llvm-build/llvmbuild/componentinfo.py | |
parent | 00b4b4f5cb95b5984174ac8086dcf878e2fa24e4 (diff) |
llvm-build: Add --write-llvmbuild option, which writes out the component tree.
- Useful for migrating or auto-upgrading the format schema.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/llvm-build/llvmbuild/componentinfo.py')
-rw-r--r-- | utils/llvm-build/llvmbuild/componentinfo.py | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py index 30ec23b833..3ea80016a1 100644 --- a/utils/llvm-build/llvmbuild/componentinfo.py +++ b/utils/llvm-build/llvmbuild/componentinfo.py @@ -3,6 +3,7 @@ Descriptor objects for entities that are part of the LLVM project. """ import ConfigParser +import StringIO import sys from util import * @@ -57,6 +58,9 @@ class ComponentInfo(object): for r in self.dependencies: yield ('dependency', r) + def get_llvmbuild_fragment(self): + abstract + class GroupComponentInfo(ComponentInfo): """ Group components have no semantics as far as the build system are concerned, @@ -73,13 +77,20 @@ class GroupComponentInfo(ComponentInfo): def __init__(self, subpath, name, parent): ComponentInfo.__init__(self, subpath, name, [], parent) + def get_llvmbuild_fragment(self): + result = StringIO.StringIO() + print >>result, 'type = %s' % self.type_name + print >>result, 'name = %s' % self.name + print >>result, 'parent = %s' % self.parent + return result.getvalue() + class LibraryComponentInfo(ComponentInfo): type_name = 'Library' @staticmethod def parse(subpath, items): kwargs = ComponentInfo.parse_items(items) - kwargs['library_name'] = items.get_optional_string('name') + kwargs['library_name'] = items.get_optional_string('library_name') kwargs['required_libraries'] = items.get_list('required_libraries') kwargs['add_to_library_groups'] = items.get_list( 'add_to_library_groups') @@ -109,6 +120,21 @@ class LibraryComponentInfo(ComponentInfo): for r in self.add_to_library_groups: yield ('library group', r) + def get_llvmbuild_fragment(self): + result = StringIO.StringIO() + print >>result, 'type = %s' % self.type_name + print >>result, 'name = %s' % self.name + print >>result, 'parent = %s' % self.parent + if self.library_name is not None: + print >>result, 'library_name = %s' % self.library_name + if self.required_libraries: + print >>result, 'required_libraries = %s' % ' '.join( + self.required_libraries) + if self.add_to_library_groups: + print >>result, 'add_to_library_groups = %s' % ' '.join( + self.add_to_library_groups) + return result.getvalue() + class LibraryGroupComponentInfo(ComponentInfo): type_name = 'LibraryGroup' @@ -140,6 +166,19 @@ class LibraryGroupComponentInfo(ComponentInfo): for r in self.add_to_library_groups: yield ('library group', r) + def get_llvmbuild_fragment(self): + result = StringIO.StringIO() + print >>result, 'type = %s' % self.type_name + print >>result, 'name = %s' % self.name + print >>result, 'parent = %s' % self.parent + if self.required_libraries: + print >>result, 'required_libraries = %s' % ' '.join( + self.required_libraries) + if self.add_to_library_groups: + print >>result, 'add_to_library_groups = %s' % ' '.join( + self.add_to_library_groups) + return result.getvalue() + class ToolComponentInfo(ComponentInfo): type_name = 'Tool' @@ -163,6 +202,15 @@ class ToolComponentInfo(ComponentInfo): for r in self.required_libraries: yield ('required library', r) + def get_llvmbuild_fragment(self): + result = StringIO.StringIO() + print >>result, 'type = %s' % self.type_name + print >>result, 'name = %s' % self.name + print >>result, 'parent = %s' % self.parent + print >>result, 'required_libraries = %s' % ' '.join( + self.required_libraries) + return result.getvalue() + class BuildToolComponentInfo(ToolComponentInfo): type_name = 'BuildTool' |