Ejemplo n.º 1
0
 def add_module_file(self, name, lines):
     my_lines = helper.normalize_lines(lines)
     existing_file = self.directory().get(name)
     if existing_file is None:
         self.directory().add(name=name, entry=File(lines=my_lines))
     elif helper.md5_hexdigest_from_lines(
             my_lines) != helper.md5_hexdigest_from_lines(
                 existing_file.lines()):
         debug.warn('Module file ' + name +
                    ' already exists with different content')
         existing_file.truncate()
         existing_file.add_lines(my_lines)
         pass
     pass
Ejemplo n.º 2
0
 def add_find_call(self, find_call):
     assert type(find_call) in (str, list, tuple)
     if type(find_call) is str:
         find_call = [find_call]
         pass
     md5 = helper.md5_hexdigest_from_lines(find_call)
     if md5 in self.__find_call_md5:
         return
     self.__find_call_md5.add(md5)
     self.__find_calls.extend(find_call)
     pass
Ejemplo n.º 3
0
 def set_marshalling_data(self, data):
     version = data[Marshallable.VERSIONS]['BuildInfo_ACInclude_m4']
     if version == 1:
         self.__lines = data[Marshallable.ATTRIBUTES]['lines']
         self.__md5 = helper.md5_hexdigest_from_lines(self.__lines)
     elif version == 2:
         self.__lines = data[Marshallable.ATTRIBUTES]['lines']
         self.__md5 = data[Marshallable.ATTRIBUTES]['md5']
     else:
         raise MarshalledVersionUnknownError(klass=self.__class__,
                                             marshalled_version=version,
                                             current_version=2)
     BuildInformation.set_marshalling_data(self, data)
     pass
Ejemplo n.º 4
0
 def add_include(self, include):
     """
     Add a CMake INCLUDE() statement. This can be called multiple
     times with the same include; only the first will be added to
     the resulting CMakeLists.txt file.
     """
     if type(include) is str:
         include = [include]
         pass
     md5 = helper.md5_hexdigest_from_lines(include)
     if md5 in self.__includes_have:
         return
     self.__includes.extend(include)
     self.__includes_have.add(md5)
     pass
Ejemplo n.º 5
0
 def __init__(self, lines, order):
     BuildInformation.__init__(self)
     self.__lines = lines
     self.__order = order
     self.__md5 = helper.md5_hexdigest_from_lines(lines)
     pass
Ejemplo n.º 6
0
 def unique_key(self):
     return '%s:%s:%s' % (self.__class__.__name__, self.__name, helper.md5_hexdigest_from_lines(self.__lines))