Exemplo n.º 1
0
    def merge(self):
        arch_inputs = {}
        for arch, recipe in self._recipes.items():
            # change the prefix temporarly to the arch prefix where files are
            # actually installed
            recipe.config.prefix = os.path.join(self.config.prefix, arch)
            arch_inputs[arch] = set(recipe.files_list())
            recipe.config.prefix = self._config.prefix

        # merge the common files
        inputs = reduce(lambda x, y: x & y, arch_inputs.values())
        output = self._config.prefix
        generator = OSXUniversalGenerator(output, logfile=self.logfile)
        dirs = [
            os.path.join(self._config.prefix, arch)
            for arch in self._recipes.keys()
        ]
        generator.merge_files(inputs, dirs)

        # Collect files that are only in one or more archs, but not all archs
        arch_files = {}
        for arch in self._recipes.keys():
            for f in list(inputs ^ arch_inputs[arch]):
                if f not in arch_files:
                    arch_files[f] = {arch}
                else:
                    arch_files[f].add(arch)
        # merge the architecture specific files
        for f, archs in arch_files.items():
            generator.merge_files(
                [f],
                [os.path.join(self._config.prefix, arch) for arch in archs])
Exemplo n.º 2
0
    def merge(self):
        arch_inputs = {}
        for arch, recipe in self._recipes.items():
            # change the prefix temporarly to the arch prefix where files are
            # actually installed
            recipe.config.prefix = os.path.join(self.config.prefix, arch)
            arch_inputs[arch] = set(recipe.files_list())
            recipe.config.prefix = self._config.prefix

        # merge the common files
        inputs = reduce(lambda x, y: x & y, arch_inputs.values())
        output = self._config.prefix
        generator = OSXUniversalGenerator(output)
        dirs = [
            os.path.join(self._config.prefix, arch)
            for arch in self._recipes.keys()
        ]
        generator.merge_files(inputs, dirs)

        # merge the architecture specific files
        for arch in self._recipes.keys():
            ainputs = list(inputs ^ arch_inputs[arch])
            output = self._config.prefix
            generator = OSXUniversalGenerator(output)
            generator.merge_files(ainputs,
                                  [os.path.join(self._config.prefix, arch)])
 def testMergeFiles(self):
     for arch in [Architecture.X86, Architecture.X86_64]:
         with open(os.path.join(self.tmp, arch, 'share', 'test'), 'w') as f:
             f.write("test")
     gen = OSXUniversalGenerator(
             os.path.join(self.tmp, Architecture.UNIVERSAL))
     gen.merge_files(['share/test'],
             [os.path.join(self.tmp, Architecture.X86),
              os.path.join(self.tmp, Architecture.X86_64)])
     self.assertTrue(os.path.exists(os.path.join(self.tmp,
     Architecture.UNIVERSAL, 'share', 'test')))
 def testMergePCFiles(self):
     for arch in [Architecture.X86, Architecture.X86_64]:
         pc_file = os.path.join(self.tmp, arch, 'test.pc')
         with open(pc_file, 'w') as f:
             f.write(os.path.join(self.tmp, arch, 'lib', 'test'))
     gen = OSXUniversalGenerator(
             os.path.join(self.tmp, Architecture.UNIVERSAL))
     gen.merge_files(['test.pc'],
             [os.path.join(self.tmp, Architecture.X86),
              os.path.join(self.tmp, Architecture.X86_64)])
     pc_file = os.path.join(self.tmp, Architecture.UNIVERSAL, 'test.pc')
     self.assertEqual(open(pc_file).readline(),
             os.path.join(self.tmp, Architecture.UNIVERSAL, 'lib', 'test'))
Exemplo n.º 5
0
 def testMergeFiles(self):
     for arch in [Architecture.X86, Architecture.X86_64]:
         with open(os.path.join(self.tmp, arch, 'share', 'test'), 'w') as f:
             f.write("test")
     gen = OSXUniversalGenerator(
         os.path.join(self.tmp, Architecture.UNIVERSAL))
     gen.merge_files(['share/test'], [
         os.path.join(self.tmp, Architecture.X86),
         os.path.join(self.tmp, Architecture.X86_64)
     ])
     self.assertTrue(
         os.path.exists(
             os.path.join(self.tmp, Architecture.UNIVERSAL, 'share',
                          'test')))
Exemplo n.º 6
0
 def testMergePCFiles(self):
     for arch in [Architecture.X86, Architecture.X86_64]:
         pc_file = os.path.join(self.tmp, arch, 'test.pc')
         with open(pc_file, 'w') as f:
             f.write(os.path.join(self.tmp, arch, 'lib', 'test'))
     gen = OSXUniversalGenerator(
         os.path.join(self.tmp, Architecture.UNIVERSAL))
     gen.merge_files(['test.pc'], [
         os.path.join(self.tmp, Architecture.X86),
         os.path.join(self.tmp, Architecture.X86_64)
     ])
     pc_file = os.path.join(self.tmp, Architecture.UNIVERSAL, 'test.pc')
     self.assertEquals(
         open(pc_file).readline(),
         os.path.join(self.tmp, Architecture.UNIVERSAL, 'lib', 'test'))
Exemplo n.º 7
0
    def merge(self):
        arch_inputs = {}
        for arch, recipe in self._recipes.items():
            # change the prefix temporarly to the arch prefix where files are
            # actually installed
            recipe.config.prefix = os.path.join(self.config.prefix, arch)
            arch_inputs[arch] = set(recipe.files_list())
            recipe.config.prefix = self._config.prefix

        # merge the common files
        inputs = reduce(lambda x, y: x & y, arch_inputs.values())
        output = self._config.prefix
        generator = OSXUniversalGenerator(output)
        dirs = [os.path.join(self._config.prefix, arch) for arch in self._recipes.keys()]
        generator.merge_files(inputs, dirs)

        # merge the architecture specific files
        for arch in self._recipes.keys():
            ainputs = list(inputs ^ arch_inputs[arch])
            output = self._config.prefix
            generator = OSXUniversalGenerator(output)
            generator.merge_files(ainputs,
                    [os.path.join(self._config.prefix, arch)])