diff options
Diffstat (limited to 'utils/llvm-build/llvmbuild/componentinfo.py')
-rw-r--r-- | utils/llvm-build/llvmbuild/componentinfo.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py index b9a2d4f..230ae21 100644 --- a/utils/llvm-build/llvmbuild/componentinfo.py +++ b/utils/llvm-build/llvmbuild/componentinfo.py @@ -42,6 +42,13 @@ class ComponentInfo(object): self.parent_instance = None self.children = [] + # The original source path. + self._source_path = None + + # A flag to mark "special" components which have some amount of magic + # handling (generally based on command line options). + self._is_special_group = False + def set_parent_instance(self, parent): assert parent.name == self.parent, "Unexpected parent!" self.parent_instance = parent @@ -138,6 +145,23 @@ class LibraryComponentInfo(ComponentInfo): def get_library_name(self): return self.library_name or self.name + def get_prefixed_library_name(self): + """ + get_prefixed_library_name() -> str + + Return the library name prefixed by the project name. This is generally + what the library name will be on disk. + """ + + basename = self.get_library_name() + + # FIXME: We need to get the prefix information from an explicit project + # object, or something. + if basename in ('gtest', 'gtest_main'): + return basename + + return 'LLVM%s' % basename + def get_llvmconfig_component_name(self): return self.get_library_name().lower() @@ -177,7 +201,7 @@ class LibraryGroupComponentInfo(ComponentInfo): print >>result, 'type = %s' % self.type_name print >>result, 'name = %s' % self.name print >>result, 'parent = %s' % self.parent - if self.required_libraries: + if self.required_libraries and not self._is_special_group: print >>result, 'required_libraries = %s' % ' '.join( self.required_libraries) if self.add_to_library_groups: @@ -357,6 +381,16 @@ def load_from_path(path, subpath): parser = ConfigParser.RawConfigParser() parser.read(path) + # Extract the common section. + if parser.has_section("common"): + common = IniFormatParser(parser.items("common")) + parser.remove_section("common") + else: + common = IniFormatParser({}) + + return common, _read_components_from_parser(parser, path, subpath) + +def _read_components_from_parser(parser, path, subpath): # We load each section which starts with 'component' as a distinct component # description (so multiple components can be described in one file). for section in parser.sections(): @@ -390,4 +424,5 @@ def load_from_path(path, subpath): fatal("unable to load component %r in %r: %s" % ( section, path, e.message)) + info._source_path = path yield info |