Esempio n. 1
0
    def write_macros_file(self,
                          macros_file="Macros.make",
                          output_format="make",
                          xml=None):
        if self._version == "1.0":
            # Parse the xml settings into the $macros hash structure
            # put conditional settings in the _COND_ portion of the hash
            # and handle them seperately
            macros = {"_COND_": {}}

            # Do worst matches first
            for compiler_node in reversed(self.compiler_nodes):
                _add_to_macros(compiler_node, macros)
            write_macros_file_v1(macros,
                                 self.compiler,
                                 self.os,
                                 self.machine,
                                 macros_file="Macros.make",
                                 output_format=output_format)
        else:
            if output_format == "make":
                format_ = "Makefile"
            elif output_format == "cmake":
                format_ = "CMake"
            else:
                format_ = output_format

            if isinstance(macros_file, basestring):
                with open(macros_file, "w") as macros:
                    self._write_macros_file_v2(format_, macros)
            else:
                self._write_macros_file_v2(format_, macros_file, xml)
Esempio n. 2
0
    def write_macros_file(self, macros_file="Macros.make", output_format="make", xml=None):
        if self._version <= 1.0:
            # Parse the xml settings into the $macros hash structure
            # put conditional settings in the _COND_ portion of the hash
            # and handle them seperately
            macros = {"_COND_" : {}}

            # Do worst matches first
            for compiler_node in reversed(self.compiler_nodes):
                _add_to_macros(compiler_node, macros)
            write_macros_file_v1(macros, self.compiler, self.os,
                                        self.machine, macros_file=macros_file,
                                        output_format=output_format)
        else:
            if output_format == "make":
                format_ = "Makefile"
            elif output_format == "cmake":
                format_ = "CMake"
            else:
                format_ = output_format

            if isinstance(macros_file, six.string_types):
                with open(macros_file, "w") as macros:
                    self._write_macros_file_v2(format_, macros)
            else:
                self._write_macros_file_v2(format_, macros_file, xml)